Skip to content

Commit 4c31b16

Browse files
committed
Add hook for GetCommandLineA
1 parent 4a336c9 commit 4c31b16

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

hook_misc.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,14 @@ HOOKDEF(int, WINAPI, WideCharToMultiByte,
17581758
return Old_WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar);
17591759
}
17601760

1761+
HOOKDEF(LPSTR, WINAPI, GetCommandLineA,
1762+
void
1763+
) {
1764+
LPSTR ret = Old_GetCommandLineA();
1765+
LOQ_nonnull("misc", "s", "CommandLine", ret);
1766+
return ret;
1767+
}
1768+
17611769
HOOKDEF(LPWSTR, WINAPI, GetCommandLineW,
17621770
void
17631771
) {

hooks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ hook_t full_hooks[] = {
318318
#endif
319319
HOOK(msvcrt, memcpy),
320320
//HOOK(ntdll, RtlMoveMemory),
321+
HOOK(kernel32, GetCommandLineA),
321322
HOOK(kernel32, GetCommandLineW),
322323
HOOK(kernel32, OutputDebugStringA),
323324
HOOK(kernel32, OutputDebugStringW),

hooks.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3393,6 +3393,10 @@ HOOKDEF(int, WINAPI, WideCharToMultiByte,
33933393
__out_opt LPBOOL lpUsedDefaultChar
33943394
);
33953395

3396+
HOOKDEF(LPSTR, WINAPI, GetCommandLineA,
3397+
void
3398+
);
3399+
33963400
HOOKDEF(LPWSTR, WINAPI, GetCommandLineW,
33973401
void
33983402
);

0 commit comments

Comments
 (0)