theatrhythm: touchscreen OK

This commit is contained in:
Kevin Trocolli
2024-02-17 02:29:52 -05:00
parent fe7d1269ea
commit 3df21a749e
7 changed files with 62 additions and 8 deletions
+41 -5
View File
@@ -162,15 +162,18 @@ void createprocess_hook_init() {
}
did_init = true;
hook_table_apply(
NULL,
"kernel32.dll",
win32_hooks,
_countof(win32_hooks));
createprocess_hook_insert_hook(NULL);
InitializeCriticalSection(&createproc_lock);
dprintf("CreateProcess: Init\n");
}
void createprocess_hook_insert_hook(HMODULE target) {
hook_table_apply(
target,
"kernel32.dll",
win32_hooks,
_countof(win32_hooks));
}
static BOOL WINAPI my_CreateProcessA(
LPCSTR lpApplicationName,
@@ -185,6 +188,7 @@ static BOOL WINAPI my_CreateProcessA(
LPPROCESS_INFORMATION lpProcessInformation
)
{
//dprintf("my_CreateProcessA: %s %s\n", lpApplicationName, lpCommandLine);
for (int i = 0; i < process_nsyms_a; i++) {
if (strncmp(process_syms_a[i].name, lpCommandLine, strlen(process_syms_a[i].name))) {
continue;
@@ -242,6 +246,38 @@ BOOL my_CreateProcessW(
LPSTARTUPINFOW lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation)
{
//dprintf("my_CreateProcessW: %S %S\n", lpApplicationName, lpCommandLine);
for (int i = 0; i < process_nsyms_w; i++) {
if (wcsncmp(process_syms_w[i].name, lpCommandLine, wcslen(process_syms_w[i].name))) {
continue;
}
dprintf("CreateProcess: Hooking child process %S %S\n", lpApplicationName, lpCommandLine);
wchar_t new_cmd[MAX_PATH] = {0};
wcscat_s(new_cmd, MAX_PATH, process_syms_w[i].head);
if (!process_syms_w[i].replace_all) {
wcscat_s(new_cmd, MAX_PATH, lpCommandLine);
}
if (process_syms_w[i].tail != NULL) {
wcscat_s(new_cmd, MAX_PATH, process_syms_w[i].tail);
}
dprintf("CreateProcess: Replaced CreateProcessW %S\n", new_cmd);
return next_CreateProcessW(
lpApplicationName,
new_cmd,
lpProcessAttributes,
lpThreadAttributes,
bInheritHandles,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
lpStartupInfo,
lpProcessInformation
);
}
return next_CreateProcessW(
lpApplicationName,
lpCommandLine,