@@ -270,8 +270,6 @@ QString WinExtras::getForegroundWindowExePath()
270
270
if (windowProcess != NULL )
271
271
{
272
272
WCHAR filename[MAX_PATH];
273
- TCHAR filename_xp[MAX_PATH];
274
- // qDebug() << QString::number(sizeof(filename)/sizeof(TCHAR));
275
273
if (pQueryFullProcessImageNameW)
276
274
{
277
275
// Windows Vista and later
@@ -283,12 +281,8 @@ QString WinExtras::getForegroundWindowExePath()
283
281
exePath = QString::fromWCharArray (filename);
284
282
} else
285
283
{
286
- // Windows XP
287
- memset (filename_xp, 0 , sizeof (filename_xp));
288
- GetModuleFileNameEx (windowProcess, NULL , filename_xp, MAX_PATH * sizeof (TCHAR));
289
- exePath = QString (filename_xp);
284
+ qWarning () << " Windows XP is not supported" ;
290
285
}
291
-
292
286
CloseHandle (windowProcess);
293
287
}
294
288
@@ -360,8 +354,12 @@ bool WinExtras::elevateAntiMicro()
360
354
char *tempfile = ba.data ();
361
355
tempverb[5 ] = ' \0 ' ;
362
356
tempfile[antiProgramLocation.length ()] = ' \0 ' ;
363
- sei.lpVerb = tempverb;
364
- sei.lpFile = tempfile;
357
+ wchar_t lpVerb[20 ];
358
+ wchar_t lpFile[MAX_PATH];
359
+ mbstowcs (lpVerb, tempverb, strlen (tempverb) + 1 ); // Plus null
360
+ mbstowcs (lpFile, tempfile, strlen (tempfile) + 1 ); // Plus null
361
+ sei.lpVerb = lpVerb;
362
+ sei.lpFile = lpFile;
365
363
sei.hwnd = NULL ;
366
364
sei.nShow = SW_NORMAL;
367
365
BOOL result = ShellExecuteEx (&sei);
0 commit comments