Rev | Line | |
---|
[232] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[245] | 3 | #include <NativeCode.h>
|
---|
| 4 | #include <Procedure.h>
|
---|
| 5 |
|
---|
[237] | 6 | #define BREAK_EIP(checkEip) (obp+0x00401000>=checkEip)
|
---|
[232] | 7 |
|
---|
| 8 | void ObpPlus( int step )
|
---|
| 9 | {
|
---|
| 10 | extern int obp;
|
---|
| 11 | obp += step;
|
---|
| 12 |
|
---|
| 13 | // 例:epi=0x00401999
|
---|
[237] | 14 | if( BREAK_EIP(0x00433FD7) )
|
---|
[232] | 15 | {
|
---|
| 16 | int test=0;
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
[245] | 19 |
|
---|
[257] | 20 | void NativeCode::Put( const NativeCode &nativeCode )
|
---|
| 21 | {
|
---|
| 22 | long baseOffset = size;
|
---|
| 23 |
|
---|
| 24 | Put( nativeCode.codeBuffer, nativeCode.size );
|
---|
| 25 |
|
---|
| 26 | BOOST_FOREACH( const Schedule &schedule, nativeCode.schedules )
|
---|
| 27 | {
|
---|
| 28 | this->schedules.push_back(
|
---|
| 29 | Schedule(
|
---|
| 30 | schedule.GetType(),
|
---|
| 31 | baseOffset + schedule.GetOffset()
|
---|
| 32 | )
|
---|
| 33 | );
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
| 36 |
|
---|
[245] | 37 | void NativeCode::PutUserProcSchedule( const UserProc *pUserProc, bool isCall )
|
---|
| 38 | {
|
---|
| 39 | pUserProc->Using();
|
---|
| 40 |
|
---|
| 41 | Schedule schedule( pUserProc, size );
|
---|
| 42 | if( isCall == false )
|
---|
| 43 | {
|
---|
| 44 | schedule.SpecifyAddressOf();
|
---|
| 45 | }
|
---|
| 46 | schedules.push_back( schedule );
|
---|
| 47 |
|
---|
| 48 | *((long *)(codeBuffer+size))=0;
|
---|
| 49 | size += sizeof(long);
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | // 未完成
|
---|
| 54 | if( isCall )
|
---|
| 55 | {
|
---|
| 56 | pobj_SubAddrSchedule->add(pUserProc,1);
|
---|
| 57 | }
|
---|
| 58 | else
|
---|
| 59 | {
|
---|
| 60 | pobj_SubAddrSchedule->add(pUserProc,0);
|
---|
| 61 | }
|
---|
| 62 | extern char *OpBuffer;
|
---|
| 63 | extern int obp;
|
---|
| 64 | *((long *)(OpBuffer+obp))=0;
|
---|
| 65 | ObpPlus( sizeof(long) );
|
---|
| 66 | }
|
---|
[250] | 67 |
|
---|
| 68 | void NativeCode::PutDllProcSchedule( const DllProc *pDllProc )
|
---|
| 69 | {
|
---|
| 70 | pDllProc->Using();
|
---|
| 71 |
|
---|
| 72 | schedules.push_back( Schedule( pDllProc, size ) );
|
---|
| 73 |
|
---|
| 74 | *((long *)(codeBuffer+size))=0;
|
---|
| 75 | size += sizeof(long);
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 |
|
---|
| 79 | // 未完成
|
---|
| 80 | pobj_ImportAddrSchedule->add(pDllProc);
|
---|
| 81 | extern char *OpBuffer;
|
---|
| 82 | extern int obp;
|
---|
| 83 | *((long *)(OpBuffer+obp))=0;
|
---|
| 84 | ObpPlus( sizeof(long) );
|
---|
| 85 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.