Skip to content

Instantly share code, notes, and snippets.

@koteyur
Created August 24, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koteyur/416a680433dc3bb61a338a93b8214554 to your computer and use it in GitHub Desktop.
Save koteyur/416a680433dc3bb61a338a93b8214554 to your computer and use it in GitHub Desktop.
static void __stdcall FixKeywordLexer_4CF6F0(void *arg, SCodeHookCtx *context)
{
auto text = (const char *)context->Esi;
auto keyword = Patcher::ReadStr((void *)context->Ebp);
auto keywordLen = context->Ebx;
char nextChar = text[keywordLen];
if (isalpha(keyword[0]) && (isalnum(nextChar) || nextChar == '_' || nextChar == '#'))
context->RetAddr = EI_ADDR(0x4CF717);
}
...
// OCP_AFTER - выполнить оригинальный код (который был запатчен хуком) после вызова хука
if (!CreateCodeHook(PATCH_ADDR(0x4CF6F0), OCP_AFTER, FixKeywordLexer_4CF6F0, NULL, patch))
return PS_ERROR;
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment