All pastes #174142 Raw Edit

Someone

public text v1 · immutable
·published 2006-09-17 17:15 UTC
rendered paste body

	; War3_Dl hook inside jass node creation switch
	;	First we scan to find the ecx variable for the mem allocation and also find the 
	;   low and high range for the switch table cases.
	;	Then we do two sub repeating scans to hook all memory allocations after patching 
	;	in the ecx variable to the scan patterns.
	; Scan low pattern
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	; 6F6B4F4E  |. 57             PUSH EDI
	; 6F6B4F4F  |. 68 8C36846F    PUSH game.6F84368C                       ;  ASCII "Jass2/Nodes.h"
	; 6F6B4F54  |. 57             PUSH EDI
	; 6F6B4F55  |. B9 DCC9876F    MOV ECX,game.6F87C9DC <--- we need that constant
	; 6F6B4F5A  |. E8 D95E95FF    CALL <JMP.&War3.#230>
	; 6F6B4F5F  |. 3BC7           CMP EAX,EDI
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	; Scan high pattern
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	; 6F6B6FFA  |. C2 0400        RETN 4
	; 6F6B6FFD  |> 5F             POP EDI                                  ;  Default case of switch 6F6B694C
	; 6F6B6FFE  |. 5E             POP ESI
	; 6F6B6FFF  |. B8 01000000    MOV EAX,1
	; 6F6B7004  |. 5B             POP EBX
	; 6F6B7005  |. 8BE5           MOV ESP,EBP
	; 6F6B7007  |. 5D             POP EBP
	; 6F6B7008  \. C2 0400        RETN 4
	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

	War3DiHook proto stdcall :dword, :dword, :dword

	skip
		jassnode_switch_scan_low	dd 0
		jassnode_switch_scan_high	dd 0
	skip_end
	
	reset
	
	scan
		db 057h
		db 068h,  000h,000h,000h,000h
		db 057h
		db 0b9h,  000h,000h,000h,000h
		db 0e8h,  000h,000h,000h,000h
		db 03bh,0c7h
		
		db 0ffh
		db 0ffh,  000h,000h,000h,000h
		db 0ffh
		db 0ffh,  000h,000h,000h,000h
		db 0ffh,  000h,000h,000h,000h
		db 0ffh,0ffh
	scan_end
	
	setoffset	8
	read		a32, write_ecx_param_here_a
	read		a32, write_ecx_param_here_b
	setoffset	7
	saveaddr	jassnode_switch_scan_low
	
	scan
		db 0c2h,  004h,000h
		db 05fh
		db 05eh
		db 0b8h,  001h,000h,000h,000h
		db 05bh
		db 08bh,0e5h
		db 05dh
		db 0c2h,  004h,000h
		
		db 0ffh,  0ffh,0ffh
		db 0ffh
		db 0ffh
		db 0ffh,  0ffh,0ffh,0ffh,0ffh
		db 0ffh
		db 0ffh,0ffh
		db 0ffh
		db 0ffh,  0ffh,0ffh
	scan_end
	
	saveaddr	jassnode_switch_scan_high
	
	setlow		jassnode_switch_scan_low
	sethigh		jassnode_switch_scan_high
	
	scan
		db 0b9h
	write_ecx_param_here_a:
			db 000h,000h,000h,000h
		db 0e8h	
		
		db 0ffh,  0ffh,0ffh,0ffh,0ffh
		db 0ffh
	scan_end
	
	setoffset	6
	write		r32, War3DiHook
	continue
	
	
	setlow		jassnode_switch_scan_low
	sethigh		jassnode_switch_scan_high
	
	scan
		db 0b9h
	write_ecx_param_here_b:
			db 000h,000h,000h,000h
		db 000h,000h
		db 0e8h	
		
		db 0ffh,  0ffh,0ffh,0ffh,0ffh
		db 000h,000h
		db 0ffh	
	scan_end
	setoffset	8
	write		r32, War3DiHook
	continue