mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-30 18:24:36 +01:00
Formatted printed messages in Start menu module
This commit is contained in:
parent
72b66ebf6b
commit
0b53fcf6bf
@ -288,6 +288,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("[StartMenu] Process found.\n");
|
||||||
LPVOID lpRemotePath = VirtualAllocEx(
|
LPVOID lpRemotePath = VirtualAllocEx(
|
||||||
hProcess,
|
hProcess,
|
||||||
NULL,
|
NULL,
|
||||||
@ -297,10 +298,11 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
);
|
);
|
||||||
if (!lpRemotePath)
|
if (!lpRemotePath)
|
||||||
{
|
{
|
||||||
printf("Unable to allocate path memory.\n");
|
printf("[StartMenu] Unable to allocate path memory.\n");
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("[StartMenu] Allocated path memory.\n");
|
||||||
if (!WriteProcessMemory(
|
if (!WriteProcessMemory(
|
||||||
hProcess,
|
hProcess,
|
||||||
lpRemotePath,
|
lpRemotePath,
|
||||||
@ -309,10 +311,11 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
NULL
|
NULL
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
printf("Unable to write path.\n");
|
printf("[StartMenu] Unable to write path.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
wprintf(L"[StartMenu] Wrote path: %s.\n", params->wszModulePath);
|
||||||
HANDLE hThread = CreateRemoteThread(
|
HANDLE hThread = CreateRemoteThread(
|
||||||
hProcess,
|
hProcess,
|
||||||
NULL,
|
NULL,
|
||||||
@ -324,17 +327,21 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
);
|
);
|
||||||
if (!hThread)
|
if (!hThread)
|
||||||
{
|
{
|
||||||
printf("Unable to inject DLL.\n");
|
printf("[StartMenu] Unable to inject DLL.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("[StartMenu] Injected DLL.\n");
|
||||||
if (WaitForSingleObject(hThread, INFINITE) != WAIT_OBJECT_0)
|
if (WaitForSingleObject(hThread, INFINITE) != WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
printf("Unable to determine LoadLibrary outcome.\n");
|
printf("[StartMenu] Unable to determine LoadLibrary outcome.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
DWORD dwExitCode = 10;
|
||||||
|
GetExitCodeThread(hThread, &dwExitCode);
|
||||||
CloseHandle(hThread);
|
CloseHandle(hThread);
|
||||||
|
printf("[StartMenu] Library loaded: 0x%x.\n", dwExitCode);
|
||||||
DWORD cbNeeded = 0;
|
DWORD cbNeeded = 0;
|
||||||
EnumProcessModules(
|
EnumProcessModules(
|
||||||
hProcess,
|
hProcess,
|
||||||
@ -344,14 +351,14 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
);
|
);
|
||||||
if (!cbNeeded)
|
if (!cbNeeded)
|
||||||
{
|
{
|
||||||
printf("Unable to determine number of modules in process.\n");
|
printf("[StartMenu] Unable to determine number of modules in process.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
HMODULE* hMods = malloc(cbNeeded);
|
HMODULE* hMods = malloc(cbNeeded);
|
||||||
if (!hMods)
|
if (!hMods)
|
||||||
{
|
{
|
||||||
printf("Out of memory.\n");
|
printf("[StartMenu] Out of memory.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -363,10 +370,12 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
LIST_MODULES_ALL
|
LIST_MODULES_ALL
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
printf("Unable to enumerate modules of process.\n");
|
printf("[StartMenu] Unable to enumerate modules of process.\n");
|
||||||
Sleep(params->dwTimeout);
|
Sleep(params->dwTimeout);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
printf("[StartMenu] Remote module enumeration succeeded.\n");
|
||||||
|
BOOL bFound = FALSE;
|
||||||
for (unsigned int i = 0; i < (cbNeeded / sizeof(HMODULE)); ++i)
|
for (unsigned int i = 0; i < (cbNeeded / sizeof(HMODULE)); ++i)
|
||||||
{
|
{
|
||||||
TCHAR szModName[MAX_PATH];
|
TCHAR szModName[MAX_PATH];
|
||||||
@ -375,7 +384,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
{
|
{
|
||||||
if (!wcscmp(szModName, params->wszModulePath))
|
if (!wcscmp(szModName, params->wszModulePath))
|
||||||
{
|
{
|
||||||
printf("Found module in process memory space.\n");
|
printf("[StartMenu] Found module in process memory space.\n");
|
||||||
HANDLE hTh = CreateRemoteThread(
|
HANDLE hTh = CreateRemoteThread(
|
||||||
hProcess,
|
hProcess,
|
||||||
NULL,
|
NULL,
|
||||||
@ -387,19 +396,25 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
|
|||||||
);
|
);
|
||||||
if (hTh)
|
if (hTh)
|
||||||
{
|
{
|
||||||
printf("Waiting for remote initialization.\n");
|
printf("[StartMenu] Waiting for remote initialization.\n");
|
||||||
WaitForSingleObject(hTh, INFINITE);
|
WaitForSingleObject(hTh, INFINITE);
|
||||||
DWORD dwExitCode = 0;
|
DWORD dwExitCode = 0;
|
||||||
GetExitCodeThread(hTh, &dwExitCode);
|
GetExitCodeThread(hTh, &dwExitCode);
|
||||||
printf("Initialization exited with code 0x%x.\n", dwExitCode);
|
printf("[StartMenu] Initialization exited with code 0x%x.\n", dwExitCode);
|
||||||
CloseHandle(hTh);
|
CloseHandle(hTh);
|
||||||
printf("HOOKED START MENU\n");
|
printf("[StartMenu] HOOKED START MENU\n");
|
||||||
}
|
}
|
||||||
|
bFound = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(hMods);
|
free(hMods);
|
||||||
|
if (!bFound)
|
||||||
|
{
|
||||||
|
printf("[StartMenu] Remote module not found.\n");
|
||||||
|
|
||||||
|
}
|
||||||
WaitForSingleObject(
|
WaitForSingleObject(
|
||||||
hProcess,
|
hProcess,
|
||||||
INFINITE
|
INFINITE
|
||||||
|
Loading…
Reference in New Issue
Block a user