Skip to content

Instantly share code, notes, and snippets.

@dd86k
Created April 22, 2022 22:58
Show Gist options
  • Save dd86k/2817f264ac4851bde8b0132accf6e7cd to your computer and use it in GitHub Desktop.
Save dd86k/2817f264ac4851bde8b0132accf6e7cd to your computer and use it in GitHub Desktop.
A simple GetCommandLineW-x86 implementation. Works from Windows XP to 11 thanks to the instroduction of TLS.
wchar* GetCommandLineWFast() {
version (X86_64) asm {
mov RAX,GS:[0x60];
mov RAX,[RAX+0x20];
mov RAX,[RAX+0x78];
} else version (X86) asm {
mov EAX,FS:[0x30];
mov EAX,[EAX+0x10];
mov EAX,[EAX+0x44];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment