*/
static bool x264_process_is_elevated(bool *bIsUacEnabled = NULL)
{
- typedef enum { x264_token_elevationType_class = 18, x264_token_elevation_class = 20 } X264_TOKEN_INFORMATION_CLASS;
- typedef enum { x264_elevationType_default = 1, x264_elevationType_full, x264_elevationType_limited } X264_TOKEN_ELEVATION_TYPE;
-
bool bIsProcessElevated = false;
if(bIsUacEnabled) *bIsUacEnabled = false;
HANDLE hToken = NULL;
if(OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
{
- X264_TOKEN_ELEVATION_TYPE tokenElevationType;
+ TOKEN_ELEVATION_TYPE tokenElevationType;
DWORD returnLength;
- if(GetTokenInformation(hToken, (TOKEN_INFORMATION_CLASS) x264_token_elevationType_class, &tokenElevationType, sizeof(X264_TOKEN_ELEVATION_TYPE), &returnLength))
+ if(GetTokenInformation(hToken, TokenElevationType, &tokenElevationType, sizeof(TOKEN_ELEVATION_TYPE), &returnLength))
{
- if(returnLength == sizeof(X264_TOKEN_ELEVATION_TYPE))
+ if(returnLength == sizeof(TOKEN_ELEVATION_TYPE))
{
switch(tokenElevationType)
{
- case x264_elevationType_default:
+ case TokenElevationTypeDefault:
qDebug("Process token elevation type: Default -> UAC is disabled.\n");
break;
- case x264_elevationType_full:
+ case TokenElevationTypeFull:
qWarning("Process token elevation type: Full -> potential security risk!\n");
bIsProcessElevated = true;
if(bIsUacEnabled) *bIsUacEnabled = true;
break;
- case x264_elevationType_limited:
+ case TokenElevationTypeLimited:
qDebug("Process token elevation type: Limited -> not elevated.\n");
if(bIsUacEnabled) *bIsUacEnabled = true;
break;
break;
}
}
+ else
+ {
+ qWarning("GetTokenInformation() return an unexpected size!");
+ }
}
CloseHandle(hToken);
}
}
//If not elevated and UAC is not available -> user must be in admin group!
- if(isAdmin)
+ if(!isAdmin)
{
qDebug("UAC is disabled/unavailable -> checking for Administrators group");
isAdmin = x264_user_is_admin_helper();
#define VER_X264_MAJOR 2
#define VER_X264_MINOR 2
-#define VER_X264_PATCH 8
-#define VER_X264_BUILD 723
+#define VER_X264_PATCH 9
+#define VER_X264_BUILD 726
#define VER_X264_MINIMUM_REV 2363
#define VER_X264_CURRENT_API 140
}
//Add files from command-line
- bool bAddFile = false;
- QStringList files, args = qApp->arguments();
- while(!args.isEmpty())
- {
- QString current = args.takeFirst();
- if(!bAddFile)
- {
- bAddFile = (current.compare("--add", Qt::CaseInsensitive) == 0);
- continue;
- }
- if((!current.startsWith("--")) && QFileInfo(current).exists() && QFileInfo(current).isFile())
- {
- files << QFileInfo(current).canonicalFilePath();
- }
- }
- if(files.count() > 0)
- {
- createJobMultiple(files);
- }
+ parseCommandLineArgs();
}
/*
WinSevenTaskbar::setOverlayIcon(this, icon.isNull() ? NULL : &icon);
}
+
+/*
+ * Parse command-line arguments
+ */
+void MainWindow::parseCommandLineArgs(void)
+{
+ QStringList files, args = qApp->arguments();
+ while(!args.isEmpty())
+ {
+ QString current = args.takeFirst();
+ if((current.compare("--add", Qt::CaseInsensitive) == 0) || (current.compare("--add-file", Qt::CaseInsensitive) == 0))
+ {
+ if(!args.isEmpty())
+ {
+ current = args.takeFirst();
+ if(QFileInfo(current).exists() && QFileInfo(current).isFile())
+ {
+ files << QFileInfo(current).canonicalFilePath();
+ }
+ else
+ {
+ qWarning("File '%s' not found!", current.toUtf8().constData());
+ }
+ }
+ else
+ {
+ qWarning("Argument for '--add-file' is missing!");
+ }
+ }
+ else if(current.compare("--add-job", Qt::CaseInsensitive) == 0)
+ {
+ if(args.size() >= 3)
+ {
+ const QString fileSrc = args.takeFirst();
+ const QString fileOut = args.takeFirst();
+ const QString templId = args.takeFirst();
+ if(QFileInfo(fileSrc).exists() && QFileInfo(fileSrc).isFile())
+ {
+ OptionsModel options;
+ if(!(templId.isEmpty() || (templId.compare("-", Qt::CaseInsensitive) == 0)))
+ {
+ if(!OptionsModel::loadTemplate(&options, templId.trimmed()))
+ {
+ qWarning("Template '%s' could not be found -> using defaults!", templId.trimmed().toUtf8().constData());
+ }
+ }
+ appendJob(fileSrc, fileOut, &options, true);
+ }
+ else
+ {
+ qWarning("Source file '%s' not found!", fileSrc.toUtf8().constData());
+ }
+ }
+ else
+ {
+ qWarning("Argument(s) for '--add-job' are missing!");
+ args.clear();
+ }
+ }
+ else
+ {
+ qWarning("Unknown argument: %s", current.toUtf8().constData());
+ }
+ }
+
+ if(files.count() > 0)
+ {
+ createJobMultiple(files);
+ }
+}
unsigned int countPendingJobs(void);
unsigned int countRunningJobs(void);
+ void parseCommandLineArgs(void);
+
private slots:
void addButtonPressed();
void openActionTriggered();