|
- __declspec(naked) BOOL FASTCALL Comment(ActionParams params)
- {_asm{
- SUB ESP,0x1C
- PUSH EDI
- MOV EDI,ECX
- MOV AL,BYTE PTR DS:[EDI]
- TEST AL,AL
- JNZ SHORT starcraf_004C4196
- MOV EAX,1
- POP EDI
- ADD ESP,0x1C
- RETN
- starcraf_004C4196:
- DEC AL
- PUSH ESI
- MOV BYTE PTR SS:[ESP+8],AL
- MOV EAX,DWORD PTR SS:[ESP+8]
- AND EAX,0xFF
- LEA EDX,DWORD PTR SS:[ESP+8]
- LEA ESI,DWORD PTR DS:[EAX+EAX*4]
- SHL ESI,2
- LEA EAX,DWORD PTR DS:[ESI+0x517288]
- MOV ECX,EAX
- NEG ECX
- SBB ECX,ECX
- NEG EDX
- SBB EDX,EDX
- TEST EDX,ECX
- JNZ SHORT starcraf_004C41CD
- PUSH 0x57
- MOV EAX,0x4CDBB0;=<JMP.&Storm.#465>
- CALL EAX
- JMP SHORT starcraf_004C41F0
- starcraf_004C41CD:
- MOV CX,WORD PTR DS:[EAX]
- MOV WORD PTR SS:[ESP+8],CX
- MOV DX,WORD PTR DS:[EAX+8]
- MOV WORD PTR SS:[ESP+0xC],DX
- MOV CX,WORD PTR DS:[EAX+4]
- MOV WORD PTR SS:[ESP+0xA],CX
- MOV DX,WORD PTR DS:[EAX+0xC]
- MOV WORD PTR SS:[ESP+0xE],DX
- starcraf_004C41F0:
- MOV EAX,DWORD PTR DS:[EDI+0x10]
- MOV CX,WORD PTR DS:[ESI+0x51729A]
- MOV DX,WORD PTR DS:[EDI+0x18]
- MOV DWORD PTR SS:[ESP+0x10],EAX
- MOV AL,BYTE PTR DS:[EDI+0x1B]
- MOV WORD PTR SS:[ESP+0x14],CX
- TEST AL,AL
- MOV WORD PTR SS:[ESP+0x16],DX
- JE SHORT starcraf_004C421E
- MOVZX AX,AL
- MOV WORD PTR SS:[ESP+0x18],AX
- JMP SHORT starcraf_004C4225
- starcraf_004C421E:
- MOV WORD PTR SS:[ESP+0x18],0xFFFF
- starcraf_004C4225:
- MOV ECX,DWORD PTR DS:[EDI+0x14]
- LEA EDX,DWORD PTR SS:[ESP+0x10]
- MOV DWORD PTR SS:[ESP+0x20],ECX
- PUSH EDX
- MOV EDX,0x04C40A0
- LEA ECX,DWORD PTR SS:[ESP+0xC]
- MOV EAX,[EDI+0xC]
- TEST EAX,EAX
- JZ DEFAULT
- MOV EAX,[0x515ABC+EAX*4]
- TEST EAX,EAX
- JZ DEFAULT
- MOV DWORD PTR SS:[ESP+0x20],EAX
- JMP SHORT EXIT
- DEFAULT:
- MOV DWORD PTR SS:[ESP+0x20],0x04C4260
- EXIT:
- PUSH 0x04C4247
- PUSH 0x04453F0
- RETN
- }}
复制代码
============================================================================================
- __declspec(naked) BOOL FASTCALL Comment(ActionParams params)
- {_asm{
- pushad
- call CODE_COPY
- }_asm{
- SUB ESP,0x1C
- PUSH EDI
- MOV EDI,ECX
- MOV AL,BYTE PTR DS:[EDI]
- TEST AL,AL
- JNZ SHORT starcraf_004C4196
- MOV EAX,1
- POP EDI
- ADD ESP,0x1C
- RETN
- starcraf_004C4196:
- DEC AL
- PUSH ESI
- MOV BYTE PTR SS:[ESP+8],AL
- MOV EAX,DWORD PTR SS:[ESP+8]
- AND EAX,0xFF
- LEA EDX,DWORD PTR SS:[ESP+8]
- LEA ESI,DWORD PTR DS:[EAX+EAX*4]
- SHL ESI,2
- LEA EAX,DWORD PTR DS:[ESI+0x517288]
- MOV ECX,EAX
- NEG ECX
- SBB ECX,ECX
- NEG EDX
- SBB EDX,EDX
- TEST EDX,ECX
- JNZ SHORT starcraf_004C41CD
- PUSH 0x57
- MOV EAX,0x4CDBB0;=<JMP.&Storm.#465>
- CALL EAX
- JMP SHORT starcraf_004C41F0
- starcraf_004C41CD:
- MOV CX,WORD PTR DS:[EAX]
- MOV WORD PTR SS:[ESP+8],CX
- MOV DX,WORD PTR DS:[EAX+8]
- MOV WORD PTR SS:[ESP+0xC],DX
- MOV CX,WORD PTR DS:[EAX+4]
- MOV WORD PTR SS:[ESP+0xA],CX
- MOV DX,WORD PTR DS:[EAX+0xC]
- MOV WORD PTR SS:[ESP+0xE],DX
- starcraf_004C41F0:
- MOV EAX,DWORD PTR DS:[EDI+0x10]
- MOV CX,WORD PTR DS:[ESI+0x51729A]
- MOV DX,WORD PTR DS:[EDI+0x18]
- MOV DWORD PTR SS:[ESP+0x10],EAX
- MOV AL,BYTE PTR DS:[EDI+0x1B]
- MOV WORD PTR SS:[ESP+0x14],CX
- TEST AL,AL
- MOV WORD PTR SS:[ESP+0x16],DX
- JE SHORT starcraf_004C421E
- MOVZX AX,AL
- MOV WORD PTR SS:[ESP+0x18],AX
- JMP SHORT starcraf_004C4225
- starcraf_004C421E:
- nop
- MOV WORD PTR SS:[ESP+0x18],0xFFFF
- starcraf_004C4225:
- MOV ECX,DWORD PTR DS:[EDI+0x14]
- LEA EDX,DWORD PTR SS:[ESP+0x10]
- MOV DWORD PTR SS:[ESP+0x20],ECX
- PUSH EDX
- MOV EDX,0x04C40A0
- nop
- LEA ECX,DWORD PTR SS:[ESP+0xC]
- MOV EAX,[EDI+0xC]
- TEST EAX,EAX
- JZ DEFAULT
- MOV EAX,[0x515ABC+EAX*4]
- TEST EAX,EAX
- JZ DEFAULT
- MOV DWORD PTR SS:[ESP+0x20],EAX
- JMP SHORT EXIT
- DEFAULT:
- MOV DWORD PTR SS:[ESP+0x20],0x04C4260
- EXIT:
- PUSH 0x04C4247
- PUSH 0x04453F0
- RETN
- CODE_COPY:
- pop esi
- mov edi,[ecx+14h]//读取Value指定的触发编号
- mov [502870+edi*4],esi//重写触发函数之争表
- mov edi,[ecx+10h]//拷贝到指定的永久内存
- mov ecx,[esi-4]//获取代码长度
- rep movsb//执行拷贝
- popad
- ret
- }}
复制代码
编译结果:
- Comment("H>P60@00Pn`LEh_i?XX7Q<1e2[P10000Gh?47<?nb5HfR4@T23J;A2@89Ol0000fSE@T23j==831iP8nSHJ8LU40RlSgfA_9mmXKdXGAM@]ZEkR`fd`0om3[:fHnR`QV=XU<90QV?X]@26HfRE@T36HnRdP4ISJ9C2@:ISj;D0aV=XUD90hnRdL@ISj;SYYbD@1V?X]G63J9A2@@?XY76fHfRD`T58C0ISJ9E2@FM0aV3kK0ISJ9A2@Hj`V@ISK7A2@HoolnRdlD=XeD910fRD`T85:jX41<090fSD`T38]738G0M1:;18FlFU40QL1d1cJ9A2@Pj`Tfad@T8612C01XAd9<06S`Dd@0`ej;NAB9=;eF[0L0RgT@RdklljAQ`lc<c<c<c<c<c<c<c<c<c<?<", 0 , ###在这里写上安装序号### , 1);
复制代码
功能:将一个新的功能函数安装至触发指针表,覆盖标准触发。
参数:
Address 填写一个永久内存地址,新函数将被安装至这里,大约260字节。
Value 要被覆盖的标准触发的编号,填写49即可,此代码为49号触发专门设计。
安装完成后,修改Actions.lst文件,给49号触发的第4个参数声明为Number类型,填写子功能的安装序号,修改血量的百分数视子功能而定。 |
|