Skip to content

Commit

Permalink
Add hook for GetCommandLineA
Browse files Browse the repository at this point in the history
  • Loading branch information
kevoreilly committed Dec 2, 2022
1 parent 4a336c9 commit 4c31b16
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hook_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1758,6 +1758,14 @@ HOOKDEF(int, WINAPI, WideCharToMultiByte,
return Old_WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar);
}

HOOKDEF(LPSTR, WINAPI, GetCommandLineA,
void
) {
LPSTR ret = Old_GetCommandLineA();
LOQ_nonnull("misc", "s", "CommandLine", ret);
return ret;
}

HOOKDEF(LPWSTR, WINAPI, GetCommandLineW,
void
) {
Expand Down
1 change: 1 addition & 0 deletions hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ hook_t full_hooks[] = {
#endif
HOOK(msvcrt, memcpy),
//HOOK(ntdll, RtlMoveMemory),
HOOK(kernel32, GetCommandLineA),
HOOK(kernel32, GetCommandLineW),
HOOK(kernel32, OutputDebugStringA),
HOOK(kernel32, OutputDebugStringW),
Expand Down
4 changes: 4 additions & 0 deletions hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -3393,6 +3393,10 @@ HOOKDEF(int, WINAPI, WideCharToMultiByte,
__out_opt LPBOOL lpUsedDefaultChar
);

HOOKDEF(LPSTR, WINAPI, GetCommandLineA,
void
);

HOOKDEF(LPWSTR, WINAPI, GetCommandLineW,
void
);
Expand Down

0 comments on commit 4c31b16

Please sign in to comment.