Skip to content

Commit

Permalink
Update LRHookFunc.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
InWILL committed Sep 15, 2024
1 parent 15a24c3 commit 8b2aabb
Showing 1 changed file with 6 additions and 48 deletions.
54 changes: 6 additions & 48 deletions LRHook/LRHookFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ void AttachFunctions()
DetourAttach(&(PVOID&)OriginalCreateProcessW, HookCreateProcessW);
//DetourAttach(&(PVOID&)OriginalShellExecuteA, HookShellExecuteA);
//DetourAttach(&(PVOID&)OriginalShellExecuteW, HookShellExecuteW);
DetourAttach(&(PVOID&)OriginalShellExecuteExA, HookShellExecuteExA);
DetourAttach(&(PVOID&)OriginalShellExecuteExW, HookShellExecuteExW);
//DetourAttach(&(PVOID&)OriginalShellExecuteExA, HookShellExecuteExA);
//DetourAttach(&(PVOID&)OriginalShellExecuteExW, HookShellExecuteExW);


DetourAttach(&(PVOID&)OriginalSetWindowTextA, HookSetWindowTextA);
Expand Down Expand Up @@ -112,8 +112,8 @@ void DetachFunctions()
DetourDetach(&(PVOID&)OriginalCreateProcessW, HookCreateProcessW);
//DetourDetach(&(PVOID&)OriginalShellExecuteA, HookShellExecuteA);
//DetourDetach(&(PVOID&)OriginalShellExecuteW, HookShellExecuteW);
DetourDetach(&(PVOID&)OriginalShellExecuteExA, HookShellExecuteExA);
DetourDetach(&(PVOID&)OriginalShellExecuteExW, HookShellExecuteExW);
//DetourDetach(&(PVOID&)OriginalShellExecuteExA, HookShellExecuteExA);
//DetourDetach(&(PVOID&)OriginalShellExecuteExW, HookShellExecuteExW);

DetourDetach(&(PVOID&)OriginalSetWindowTextA, HookSetWindowTextA);
//DetourDetach(&(PVOID&)OriginalGetWindowTextA, HookGetWindowTextA);
Expand Down Expand Up @@ -562,28 +562,7 @@ BOOL WINAPI HookShellExecuteExA(
{
//MessageBoxA(NULL, pExecInfo->lpFile, "ShellExecuteExA", NULL);

STARTUPINFOA si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFOA));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFOA);

bool ret = DetourCreateProcessWithDllExA(
pExecInfo->lpFile,
(LPSTR)pExecInfo->lpParameters,
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
NULL,
pExecInfo->lpDirectory,
&si,
&pi,
Original.DllPath,
OriginalCreateProcessA
);

return ret;
return OriginalShellExecuteExA(pExecInfo);
}

BOOL WINAPI HookShellExecuteExW(
Expand All @@ -592,28 +571,7 @@ BOOL WINAPI HookShellExecuteExW(
{
//MessageBoxW(NULL, L"ShellExecuteExW", L"ShellExecuteExW", NULL);

STARTUPINFOW si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFOW));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFOW);

bool ret = DetourCreateProcessWithDllExW(
pExecInfo->lpFile,
(LPWSTR)pExecInfo->lpParameters,
NULL,
NULL,
FALSE,
CREATE_DEFAULT_ERROR_MODE,
NULL,
pExecInfo->lpDirectory,
&si,
&pi,
Original.DllPath,
OriginalCreateProcessW
);

return ret;
return OriginalShellExecuteExW(pExecInfo);
}

BOOL WINAPI HookSetWindowTextA(
Expand Down

0 comments on commit 8b2aabb

Please sign in to comment.