Last active
June 6, 2016 09:40
-
-
Save daiakushi/21e3e76837406981a559 to your computer and use it in GitHub Desktop.
This file contains 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
#include <iostream> | |
#define STRINGIZE(something) STRINGIZE_HELPER(something) | |
#define STRINGIZE_HELPER(something) #something | |
using namespace std; | |
int Test02() | |
{ | |
int foo = 999; | |
if (true) | |
cout << __LINE__ << " : foo = " << foo << endl; | |
else | |
cout << __LINE__ << " : foo = " << foo << endl; | |
cout << __LINE__ << " : foo = " << foo << endl; | |
return 0; | |
} | |
void F01() | |
{ | |
// __asm int 3 | |
__asm { jmp XX } | |
__asm { _emit 0xb8 } | |
XX: | |
Test02(); | |
} | |
void F02() | |
{ | |
// __asm int 3 | |
__asm { jmp XX1 } | |
__asm { | |
_emit 0x90 | |
_emit 0x90 | |
_emit 0x90 | |
_emit 0x90 | |
_emit 0x90 | |
_emit 0x90 | |
_emit 0x90 | |
} | |
XX1: | |
__asm { mov eax, XX2 } | |
XX2: | |
Test02(); | |
} | |
/* | |
// Disassembled by OllyDbg | |
004010D0 $ 55 push ebp | |
004010D1 . 8BEC mov ebp, esp | |
004010D3 . CC int3 | |
004010D4 . B8 0000FFE0 mov eax, E0FF0000 | |
004010D9 . 05 E410411F add eax, 1F4110E4 | |
004010DE .^ E9 F4FFFFFF jmp 004010D7 | |
004010E3 E8 db E8 | |
004010E4 . E8 17FFFFFF call 00401000 | |
004010E9 . 5D pop ebp | |
004010EA . C3 retn | |
004010EB CC int3 | |
// Disassembled by IDA Pro | |
push ebp | |
.text:004010D1 mov ebp, esp | |
.text:004010D3 int 3 ; Trap to Debugger | |
.text:004010D4 loc_4010D4: ; CODE XREF: .text:004010DE | |
.text:004010D4 mov eax, 0E0FF0000h | |
.text:004010D9 add eax, 1F4110E4h | |
.text:004010DE jmp near ptr loc_4010D4+3 | |
.text:004010E3 dd 0FF17E8E8h, 0C35DFFFFh, 0CCCCCCCCh // WTF? poor disassembler... | |
*/ | |
void F03() | |
{ | |
// __asm int 3 | |
__asm { | |
_BLINE_L01: | |
mov eax, 0xE0FF0000 // B8 00 00 FF E0 | |
add eax, (offset _BLINE_L02) - 0xE0FF0000 // 05 E4 10 41 1F | |
jmp _BLINE_L01 + 3 // E9 F4 FF FF FF | |
_emit 0xE8 // E8 | |
_BLINE_L02: // E8 17 FF FF FF | |
} | |
Test02(); | |
} | |
int main() | |
{ | |
// Pick one each time for test... | |
// F01(); | |
// F02(); | |
// F03(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment