Last active
October 8, 2016 23:56
-
-
Save toptensoftware/a2ed963920524c06592696191f90de92 to your computer and use it in GitHub Desktop.
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
| public void CallVM(uint lpfnProc) | |
| { | |
| // Save the old IP | |
| var oldCS = cs; | |
| var oldIP = ip; | |
| // Setup the new IP | |
| cs = lpfnProc.Hiword(); | |
| ip = lpfnProc.Loword(); | |
| // Push address of the system return thunk | |
| this.PushDWord(_sysRetThunk); | |
| // Handle re-entrancy | |
| _sysRetDepth++; | |
| uint sysCallDepthAtCall= _sysRetDepth; | |
| // Process until the sys return thunk is invoked | |
| while (_sysRetDepth >= sysCallDepthAtCall) | |
| { | |
| Step(); | |
| } | |
| // Restore instruction pointer | |
| cs = oldCS; | |
| ip = oldIP; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment