![]() |
PCDVD數位科技討論區
(https://www.pcdvd.com.tw/index.php)
- 七嘴八舌異言堂
(https://www.pcdvd.com.tw/forumdisplay.php?f=12)
- - 請教一個VC++的問題
(https://www.pcdvd.com.tw/showthread.php?t=1183942)
|
|---|
直接改編譯後的exe會不會比較簡單?
|
...
想知道最後怎麼拔? 更稍早的整段c改成asm ? . |
改成這樣,並用release mode編譯看看
void __stdcall Fun() |
引用:
這樣就有辦法處理了... Debug: 代碼:
void Fun() 1000100A E9 51000000 jmp 10001060 (跳到FUN) .... 10001060 55 push ebp 10001061 8BEC mov ebp,esp 10001063 83EC 40 sub esp,0x40 10001066 53 push ebx 10001067 56 push esi 10001068 57 push edi 10001069 8D7D C0 lea edi,dword ptr ss:[ebp-0x40] 1000106C B9 10000000 mov ecx,0x10 10001071 B8 CCCCCCCC mov eax,0xCCCCCCCC 10001076 F3:AB rep stos dword ptr es:[edi] 10001078 81F9 00400000 cmp ecx,0x4000 ; ASM 開始處 1000107E 0F85 B9000000 jnz 1000113D 10001084 6A 1E push 0x1E 10001086 68 0CDE0210 push Trinity.1002DE0C ; ASCII "RANDOM_PORTAL_TRINITY_Tutorial" 1000108B 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20] 1000108E C705 B0FA0210 E0404 mov dword ptr ds:[0x1002FAB0],0x4040E0 10001098 FF15 B0FA0210 call dword ptr ds:[0x1002FAB0] (DWORD)FUN 的位置會在 0x1000100A jmp 指令上面,而且開場 Push 代碼 比較多, 長度固定是 0x18 byte。 Release: 代碼:
void Fun() 10001000 55 push ebp 10001001 8BEC mov ebp,esp 10001003 53 push ebx 10001004 56 push esi 10001005 57 push edi 10001006 81F9 00400000 cmp ecx,0x4000 ; ASM 開始處 1000100C 0F85 B9000000 jnz Trinity.100010CB 10001012 6A 1E push 0x1E 10001014 68 FC720010 push Trinity.100072FC ; ASCII "RANDOM_PORTAL_TRINITY_Tutorial" 10001019 8D4D E0 lea ecx,dword ptr ss:[ebp-0x20] 1000101C C705 40780010 E0404>mov dword ptr ds:[0x10007840],0x4040E0 10001026 FF15 40780010 call dword ptr ds:[0x10007840] (DWORD)FUN 直接就在 0x10001000 沒有 jmp 跳到 FUN,而且開場 Push 代碼 比較少,長度固定 6 byte。 所以我現在Hook寫法改成: 代碼:
SIZE = 5; Target_Address = 0x006A7871; Proc_Address = (DWORD)Fun + 6; // 計算跳轉距離 Distance = ((DWORD)Proc_Address - (DWORD)Target_Address - SIZE); (DWORD)Fun + 上 6 byte 去計算JMP距離, Hook 好就直接是我要的ASM開始部份,然後用 Release 模式編譯就完工了。 另外我想請教,VC++ 6.0 要怎麼樣才能用 uint8_t uint16_t uint32_t .... 去定義長度 預設只能用 char short int ... 我用uint8_t int8_t 比較習慣。 是少了 Header 沒加嗎? 我用的是 VC++ 6.0 免安裝版。 |
引用:
typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; 你還必須注意的你編譯器是 32 還是 64 位元的,不然有些預設 int 是 64bits 但是你用 VC6 基本上沒這個問題 |
引用:
這個要自己加進去阿 VC6 本身不支援 int uint 定義長度就對了 ? |
引用:
VC6 只有 int 沒有 uint 就自己放在 header file 就好 |
| 所有的時間均為GMT +8。 現在的時間是07:49 PM. |
vBulletin Version 3.0.1
powered_by_vbulletin 2025。