Original Post
I''m getting really tired of looking through these lines of code... all that happens is that QLMonitor- the executable- goes into a loop.
WCHAR TargetDirectoryPath[MAX_PATH] = L"C:\\QLProtected";
if(DoesFolderExist(TargetDirectoryPath))
{
//if(DoTheseFilesExist(TargetDirectoryPath, "QLMonitor.exe", "QLDriver.sys"))
WCHAR CurrentDirectoryPath[MAX_PATH];
GetCurrentDirectoryW(sizeof(CurrentDirectoryPath), CurrentDirectoryPath);
if(0 != wcscmp(CurrentDirectoryPath, TargetDirectoryPath))
{
CopyFileW(L"QLMonitor.exe", L"C:\\QLProtected\\QLMonitor.exe", FALSE);
CopyFileW(L"QLDriver.sys", L"C:\\QLProtected\\QLDriver.sys", FALSE);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(π, sizeof(pi));
CreateProcess(NULL, "C:\\QLProtected\\QLMonitor.exe", NULL, NULL,
FALSE, 0, NULL, NULL, &si, π); //Reload the ''new'' executable...
//WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return TRUE;
}
}
else
{
CreateDirectoryW(TargetDirectoryPath, NULL);
CopyFileW(L"QLMonitor.exe", L"C:\\QLProtected\\QLMonitor.exe", FALSE);
CopyFileW(L"QLDriver.sys", L"C:\\QLProtected\\QLDriver.sys", FALSE);
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(π, sizeof(pi));
CreateProcess(NULL, "C:\\QLProtected\\QLMonitor.exe", NULL, NULL,
FALSE, 0, NULL, NULL, &si, π); //Reload the ''new'' executable...
//WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
return TRUE;
}