Created
April 28, 2016 14:14
-
-
Save Konctantin/124bdda46e1a9fa86c1830467dee08d6 to your computer and use it in GitHub Desktop.
opcode_dumper.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void DumpHandlers(DWORD_PTR baseAddr) | |
| { | |
| int getPtrOffset = 0x257D58; // x86 21463 | |
| typedef DWORD*(*GetPtr)(); | |
| typedef BOOL(__cdecl *CheckOpcode)(WORD); | |
| DWORD* ptrTable = GetPtr(baseAddr + getPtrOffset)(); | |
| DWORD v7 = *ptrTable; | |
| for (const auto& element : opcodeList) | |
| { | |
| int opcode = element.first; | |
| char* name = element.second; | |
| while (1) | |
| { | |
| if (CheckOpcode(*(DWORD *)v7 + 4)(opcode)) | |
| { | |
| DWORD handler = (*(DWORD*)v7 + 20) - baseAddr; | |
| printf("Opcode: 0x%04X Handler: 0x%08X %s\n", opcode, handler, name); | |
| break; | |
| } | |
| // todo: need validate this check | |
| if (v7 == (*(DWORD*)(ptrTable + 4) * *(ptrTable+4))) | |
| break; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment