800分求解,变速齿轮DELPHI源码 ( 积分: 300 )

  • 主题发起人 主题发起人 楼兰
  • 开始时间 开始时间

楼兰

Unregistered / Unconfirmed
GUEST, unregistred user!
要求在XP下用的。<br>不是改系统时钟用PORTTALK那种,应该是用HOOK截取GETTICKCOUNT。。。。等等<br>不散分,800分集中发<br>我的信箱lowlanhehe@163.com
 
要求在XP下用的。<br>不是改系统时钟用PORTTALK那种,应该是用HOOK截取GETTICKCOUNT。。。。等等<br>不散分,800分集中发<br>我的信箱lowlanhehe@163.com
 
这个是我找的一段代码:<br>“齿轮”关键代码完全注释<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 一、初始化部分(从&quot;齿轮&quot;调用CreateFileMappingA函数开始分析)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B0E &nbsp;PUSH &nbsp; &nbsp; &nbsp;00<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B10 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00010000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B15 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B17 &nbsp;PUSH &nbsp; &nbsp; &nbsp;04<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B19 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B1B &nbsp;PUSH &nbsp; &nbsp; &nbsp;FF<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B1D &nbsp;CALL &nbsp; &nbsp; &nbsp;[KERNEL32!CreateFileMappingA]<br> &nbsp; ;调用CreateFileMappingA<br> &nbsp; ; 调用形式如右:CreateFileMappingA(FF,0,4,0,10000,0)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B23 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B26 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+00000368],EAX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B2C &nbsp;MOV &nbsp; &nbsp; &nbsp; DWORD PTR [EBP-14],80000000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B33 &nbsp;JMP &nbsp; &nbsp; &nbsp; 00401B41<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B35 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B38 &nbsp;ADD &nbsp; &nbsp; &nbsp; EDX,00010000<br> &nbsp;;申请基址加0x10000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B3E &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EDX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B41 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B44 &nbsp;PUSH &nbsp; &nbsp; &nbsp;EAX &nbsp; &nbsp; &nbsp;;映射文件基址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B45 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00 &nbsp; &nbsp; &nbsp; ;映射的字节数<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B47 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00 &nbsp; &nbsp; &nbsp; ;文件偏移低32位<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B49 &nbsp;PUSH &nbsp; &nbsp; &nbsp;00 &nbsp; &nbsp; &nbsp; ;文件偏移高32位<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B4B &nbsp;PUSH &nbsp; &nbsp; &nbsp;02 &nbsp; &nbsp; &nbsp; ;访问模式<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B4D &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B50 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[ECX+00000368]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B56 &nbsp;PUSH &nbsp; &nbsp; &nbsp;EDX<br> &nbsp;;CreateFileMappingA返回的映射文件句柄<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B57 &nbsp;CALL &nbsp; &nbsp; &nbsp;[KERNEL32!MapViewOfFileEx]<br> &nbsp;; 调用形式如右:MapViewOfFileEx(EDX,2,0,0,0,EAX)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B5D &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-30]<br> &nbsp;;[EBP-30]为即将映射到2G之上<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B60 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000036C],EAX<br> &nbsp;; 的代码的数据域的起始地址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B66 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B69 &nbsp;CMP &nbsp; &nbsp; &nbsp; DWORD PTR [EDX+0000036C],00<br> &nbsp;;检查MapViewOfFileEx<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B70 &nbsp;JZ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;00401B74<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;返回值,若为0则继续调<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B72 &nbsp;JMP &nbsp; &nbsp; &nbsp; 00401B76 &nbsp; ;调用MapViewOfFileEx<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B74 &nbsp;JMP &nbsp; &nbsp; &nbsp; 00401B35 &nbsp; ;直至成功为止<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B76 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B79 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EAX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B7F &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-08],ECX<br> &nbsp;;映射文件起始地址存入[EBP-08]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B82 &nbsp;CALL &nbsp; &nbsp; &nbsp;[WINMM!timeGetTime]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0167:00401B88 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EAX<br> &nbsp;;将初次调用timeGetTime<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BA0 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-08]<br> &nbsp;;的返回值保存到[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BA3 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp;;以及映射文件基址+FF30处<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BA6 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000FF30],EDX<br> ...省略的代码类似的保存调用初次GetTickCount,QueryPerformanceCounter的返回值<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BED &nbsp;MOV &nbsp; &nbsp; &nbsp; DWORD PTR [EBP-14],00000000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BF4 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BF7 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401BFD &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C00 &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [ECX+EAX+0000F000],9A<br> &nbsp;;9a为远调用的指令码<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C08 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C0B &nbsp;ADD &nbsp; &nbsp; &nbsp; EDX,01<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C0E &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EDX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C11 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C14 &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,04<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C17 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EAX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C1A &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C1D &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[ECX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C23 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C26 &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [EAX+EDX+0000F000],14<br> &nbsp;;14为调用门描述符的索引<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C2E &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C31 &nbsp;ADD &nbsp; &nbsp; &nbsp; ECX,01<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C34 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],ECX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C37 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C3A &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C40 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C43 &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [ECX+EAX+0000F000],00<br> &nbsp;;CALL指令其他部分<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C4B &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C4E &nbsp;ADD &nbsp; &nbsp; &nbsp; EDX,01<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C51 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EDX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C54 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C57 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EAX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C5D &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C60 &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [EDX+ECX+0000F000],C2<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C68 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C6B &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,01<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C6E &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EAX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C71 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C74 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[ECX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C7A &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C7D &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [EAX+EDX+0000F000],00<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C85 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C88 &nbsp;ADD &nbsp; &nbsp; &nbsp; ECX,01<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C8B &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],ECX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C8E &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C91 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+0000036C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C97 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-14]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401C9A &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [ECX+EAX+0000F000],00<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CA2 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-14]<br> &nbsp;;以上代码为在映射代码偏移F000处写入指令CALL 0014:0000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CA5 &nbsp;ADD &nbsp; &nbsp; &nbsp; EDX,01<br> &nbsp;;指令 A91400C20000共6个字节<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CA8 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-14],EDX ;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CAB &nbsp;MOV &nbsp; &nbsp; &nbsp; ESI,0040213B<br> &nbsp;;要复制的代码的起始地址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CB0 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDI,[EBP-08]<br> &nbsp;;要复制代码的目标地址(映射区域中)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CB3 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,00402688<br> &nbsp;;402688为要复制的代码的末地址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CB8 &nbsp;SUB &nbsp; &nbsp; &nbsp; ECX,ESI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CBA &nbsp;REPZ MOVSB &nbsp;;将代码全部复制到映射区域<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CBC &nbsp;SGDT &nbsp; &nbsp; &nbsp;FWORD PTR [EBP-1C] &nbsp;;这句开始就很关键了<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CC0 &nbsp;LEA &nbsp; &nbsp; &nbsp; EAX,[EBP-001C]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CC6 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EAX+02] &nbsp; &nbsp; &nbsp; &nbsp;;取GDT线性基址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CC9 &nbsp;XOR &nbsp; &nbsp; &nbsp; EBX,EBX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CCB &nbsp;SLDT &nbsp; &nbsp; &nbsp;BX &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;取LDT在GDT中的偏移 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CCE &nbsp;AND &nbsp; &nbsp; &nbsp; BX,-08 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CD2 &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,EBX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CD4 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EAX+02] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CD7 &nbsp;SHL &nbsp; &nbsp; &nbsp; ECX,08 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CDA &nbsp;MOV &nbsp; &nbsp; &nbsp; CL,[EAX+07] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CDD &nbsp;ROR &nbsp; &nbsp; &nbsp; ECX,08 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;以上计算出LDT线性基址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CE0 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-0C],ECX &nbsp; &nbsp; &nbsp; ;保存 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CE3 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-30] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CE6 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-0C] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CE9 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+00000370],ECX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CEF &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CF2 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+0000036C] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CF8 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-0C] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401CFB &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+0000FE00],ECX<br> &nbsp; ;将LDT线性基址保存至映射代码中 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D01 &nbsp;MOV &nbsp; &nbsp; &nbsp; AX,CS<br> &nbsp; ;得到当前代码段描述符号 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D04 &nbsp;AND &nbsp; &nbsp; &nbsp; AX,FFF8 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D08 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EBP-10],AX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D0C &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-10] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D0F &nbsp;AND &nbsp; &nbsp; &nbsp; EDX,0000FFFF<br> &nbsp;;EDX为代码段描述符在LDT中的偏移量<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D15 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D18 &nbsp;MOV &nbsp; &nbsp;ECX,[EAX+00000370] ;ECX此时为LDT线性基址 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D1E &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-30]<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D21 &nbsp;MOV &nbsp; &nbsp; EAX,[EAX+00000370] &nbsp;<br>;EAX此时为LDT线性基址 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br><br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D27 &nbsp;MOV &nbsp; &nbsp; &nbsp; ESI,[EDX+ECX] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D2A &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+08],ESI <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D2D &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EDX+ECX+04]<br> &nbsp;;以上将当前代码段描述符复制到 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D31 &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+0C],ECX &nbsp; &nbsp;;LDT第1项 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D34 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D37 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+00000370] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D3D &nbsp;MOV &nbsp; &nbsp; &nbsp; CL,[EAX+0D] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D40 &nbsp;AND &nbsp; &nbsp; &nbsp; CL,9F <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D43 &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[EBP-30] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D46 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EDX+00000370] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D4C &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+0D],CL<br> &nbsp;;以上修改LDT第1项的DPL为0,则当由调用门转到该段代码时即获得RING0权限 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D4F &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-0C] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D52 &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,10 &nbsp; &nbsp; &nbsp; ;获得LDT中索引为2的调用门地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D55 &nbsp;MOV &nbsp; &nbsp; &nbsp; EBX,0040213B <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D5A &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX],EBX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D5C &nbsp;MOV &nbsp; &nbsp; &nbsp; [EAX+04],EBX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D5F &nbsp;MOV &nbsp; &nbsp; &nbsp; WORD PTR [EAX+02],000C <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D65 &nbsp;MOV &nbsp; &nbsp; &nbsp; WORD PTR [EAX+04],EC00 &nbsp;;调用门修改完毕 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D6B &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-08] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D6E &nbsp;MOV &nbsp; &nbsp; &nbsp; EDX,[WINMM!timeGetTime] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401D74 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000FEE0]<br><br>;EDX;保存timeGetTime入口地址<br> &nbsp; &nbsp; &nbsp;...省略部分依次保存GetTickCount,GetMessageTime,timeSetEvent,SetTimer,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;timeGetSystemTime,QueryPerformanceCounter入口地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DD2 &nbsp;MOV &nbsp; &nbsp; &nbsp; ECX,[EBP-08] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DD5 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[WINMM!timeGetTime] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DDA &nbsp;MOV &nbsp; &nbsp; &nbsp; EBX,[EAX] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DDC &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000FE40],EBX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DE2 &nbsp;MOV &nbsp; &nbsp; &nbsp; EBX,[EAX+04] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401DE5 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000FE44],EBX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;保存timeGetTime函数前8个字节指令<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...省略部分依次保存GetTickCount,GetMessageTime,timeSetEvent,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;timeGetSystemTime , QueryPerformanceCounter前8个字节指令 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E6D &nbsp;MOV &nbsp; &nbsp; &nbsp; BYTE PTR [ECX+0000FE90],E9 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E74 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,00402165 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E79 &nbsp;SUB &nbsp; &nbsp; &nbsp; EAX,0040213B<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;EAX为截获代码在映射代码中的偏移 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E7E &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,ECX &nbsp; &nbsp;;计算出截获代码的线性入口地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E80 &nbsp;SUB &nbsp; &nbsp; &nbsp; EAX,[WINMM!timeGetTime] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E86 &nbsp;SUB &nbsp; &nbsp; &nbsp; EAX,05 &nbsp; &nbsp; ;JMP指令总长5个字节 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401E89 &nbsp;MOV &nbsp; &nbsp; &nbsp; [ECX+0000FE91],EAX<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;计算生成从timeGetTime跳到截获代码的JMP指令并保存<br> <br> &nbsp; &nbsp; &nbsp; ...省略部分依次计算并生成GetTickCount,GetMessageTime,timeSetEvent,<br> &nbsp; &nbsp; &nbsp; &nbsp;timeGetSystemTime , QueryPerformanceCounter跳到截获代码的JMP指令<br> &nbsp; &nbsp; &nbsp; &nbsp;并保存 <br> &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F58 &nbsp;CLI &nbsp; &nbsp;;关闭中断,谨防修改代码时发生意外 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F59 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,004021F3 &nbsp; &nbsp; &nbsp; &nbsp; ; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F5E &nbsp;SUB &nbsp; &nbsp; &nbsp; EAX,0040213B;计算子程序在映射代码中的偏移 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F63 &nbsp;ADD &nbsp; &nbsp; &nbsp; EAX,[EBP-08] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;EAX=8xxx 00B8 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F66 &nbsp;PUSH &nbsp; &nbsp; &nbsp;EAX &nbsp; &nbsp;;传入参数EAX为修改timeGetTime代码的<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;子程序入口地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F67 &nbsp;MOV &nbsp; &nbsp; &nbsp; EAX,[EBP-08] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;调用8xxx 0000 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401F6A &nbsp;CALL &nbsp; &nbsp; &nbsp;EAX &nbsp; &nbsp; &nbsp; ;返回时timeGetTime首指令被更改<br> <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...省略部分依次修改GetTickCount,GetMessageTime,timeSetEvent,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;timeGetSystemTime , QueryPerformanceCounter函数的首指令 <br> &nbsp;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:00401FF &nbsp; SETI &nbsp; &nbsp; &nbsp;;设置中断,初始化代码结束<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 二、截获时间函数部分(以timeGetTime为例子,代码以跟踪顺序列出)<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; timeGetTime<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;JMP 832A 002A<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;这是timeGetTime被修改后的首指令 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 002A &nbsp; &nbsp; &nbsp; &nbsp; CLI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;此时[esp]=40BF2C,即游戏程序中调用timeGetTime函数的下一条指令<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;...(6个)各寄存器分别入栈 且MOV EBP,ESP <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0033 &nbsp; &nbsp; &nbsp; &nbsp; CALL &nbsp; 832A 0038<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;将当前EIP入栈(即下一条指令的地址) <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0038 &nbsp; &nbsp; &nbsp; &nbsp; POP &nbsp; &nbsp;EDI &nbsp; &nbsp; &nbsp; ;取出当前指令地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XOR &nbsp; &nbsp;DI &nbsp; , DI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MOV &nbsp; ESI , EDI<br> &nbsp; &nbsp; &nbsp; &nbsp; ;将64K内存首地址赋给ESI<br> &nbsp; &nbsp; &nbsp; &nbsp; ;此时ESI=EDI=832A 0000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ADD &nbsp; &nbsp;ESI , 0040 2102 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUB &nbsp; &nbsp;ESI , 0040 213B ;求出映射代码首地址 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PUSH &nbsp;ESI <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 004B &nbsp; &nbsp; &nbsp; &nbsp;CALL &nbsp;EDI &nbsp; &nbsp; &nbsp; &nbsp;;ESI为传进的参数<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ;返回时已经将timeGetTime代码还原 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 004D &nbsp; &nbsp; &nbsp; CALL &nbsp;832A 0052 &nbsp; &nbsp;; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0052 &nbsp; &nbsp; &nbsp; &nbsp;POP &nbsp; EDI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;XOR &nbsp; DI ,DI &nbsp; &nbsp; &nbsp; &nbsp;;故技重施 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CALL &nbsp;[EDI + 0000FEED];调用原timeGetTime函数<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SUB &nbsp; EAX,[EDI + 0000 FF30]<br> &nbsp; &nbsp; &nbsp; &nbsp;;减去第一次调用timeGetTime的结果<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MUL &nbsp; &nbsp;DWORD PTR [EDI+0000 FE30]<br> &nbsp; &nbsp; &nbsp; &nbsp;;乘以用户所指定的倍数<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV &nbsp; &nbsp;EBX ,00100000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DIV &nbsp; &nbsp;EBX<br> &nbsp; &nbsp; &nbsp; &nbsp;;除以常数100000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ADD &nbsp; &nbsp;EAX ,[EDI+ 0000FE20] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV &nbsp; EAX,004021F3 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SUB &nbsp; &nbsp;EAX,0040213B <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ADD &nbsp; &nbsp;EAX,EDI<br> &nbsp; &nbsp; &nbsp; &nbsp;;以上指令为修改timeGetTime函数返回值 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;PUSH &nbsp;EAX<br> &nbsp; &nbsp; &nbsp; &nbsp;;EAX为传进的参数 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CALL &nbsp; EDI<br> &nbsp; &nbsp; &nbsp; &nbsp;;返回时又将timeGetTime首指令换成JMP<br> &nbsp; &nbsp; &nbsp; &nbsp;...恢复各寄存器的值,EAX中为修改后的返回值 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RET ;此时[ESP]=40BF2C,执行RET将返回到游戏中去<br> &nbsp; &nbsp; &nbsp; &nbsp;; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CALL 832A 0005 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0005 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; POP &nbsp;EDI <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XOR &nbsp;DI ,DI &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;;老套了撒^_^<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MOV ESI ,[EDI+0000 FE00]<br> &nbsp; &nbsp; &nbsp; &nbsp;;此地址保存着LDT的线性基址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,[ESP+04] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [ESI +10],AX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SHR &nbsp;EAX,10 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [ESI+16],AX<br> &nbsp; &nbsp; &nbsp; &nbsp;;以上代码将LDT中索引为2的调用门描述符的偏移改为传入的参数<br> &nbsp; &nbsp; &nbsp; &nbsp; ... <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,0000 0F00 <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CALL EAX<br> &nbsp; &nbsp; &nbsp; &nbsp;;调用子程序修改timeGetTime代码<br> &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A 0027 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; RET 4<br> &nbsp; &nbsp; &nbsp; &nbsp;;弹出参数,返回<br> &nbsp; &nbsp; &nbsp; &nbsp;; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0167:832A F000 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CALL 0014:00000000<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RET 0<br> &nbsp; &nbsp; &nbsp; &nbsp;; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 000C:832A 0097 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CALL 832A 009C <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 000C:832A 009C &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; POP EDI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,[EDI+0000 FE40] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EBX,[EDI+0000 FEE0] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [EBX],EAX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,[EDI+0000 FE44] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [EBX+04],EAX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RETF<br> &nbsp; &nbsp; &nbsp; &nbsp;注:EDI+0000 FE40起前8个字节为原timeGetTime函数的指令<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;EDI+0000 FEE0保存着timeGetTime函数的入口地址<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;以上即恢复timeGetTime前8个字节的代码<br> &nbsp; &nbsp; &nbsp; &nbsp;; <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 000C:832A 00B8 &nbsp; &nbsp; &nbsp; &nbsp; CALL 832A 00BD <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 000C:832A 00BD &nbsp; &nbsp; &nbsp; &nbsp; POP EDI<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;XOR DI ,DI<br> &nbsp; &nbsp; &nbsp; &nbsp; ... <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,[EDI+0000 FE90] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EBX,[EDI+0000 FEE0] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [EBX],EAX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV EAX,[EDI+0000FE94] <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;MOV [EBX+04],EAX <br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;RETF<br><br> &nbsp; &nbsp; &nbsp; &nbsp;注:EDI+0000 FE90 起前8个字节保存着JMP 832A 002A 指令<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;是由“齿轮”初始化部分代码计算出来的,以上代码将JMP 832A 002A<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;写入timeGetTime函数<br>--<br>这段代码是汇编的!
 
变速齿轮是通过拦截TimeGetTimeAPI函数,修改该函数的返回值实现的。<br>还要修改TimeGetTime的返回值。<br><br>下面是C++的代码(自己转成DELPHI的吧)<br>变速齿轮源代码:<br>// File name : SetClock.cpp<br>// Function1 : SetClock9x(int)<br>// Function2 : SetClockNT(int)<br>// Chu Rui 2001.3.1<br><br>#include &quot;stdafx.h&quot;<br>#include &quot;ntport.h&quot;<br><br>#define FREE_INT_NO 5<br><br>void Ring0()<br>{ //在Windows9x下进入ring0后进行的操作<br>__asm<br>{<br>cli<br>mov al,34h<br>out 43h,al //写入8253控制寄存器,设置写0号定时器<br>mov ax,bx <br>out 40h,al //写定时值低位<br>mov al,ah<br>out 40h,al //写定时值高位<br>sti<br>iretd;<br>}<br>}<br><br>void SetClockNT(int freq)<br>{ //NT下的操作<br>//这里使用了NT Port库<br>Outport(0x43,0x34); //写入8253控制寄存器,设置写0号定时器<br>Outport(0x40,freq&amp;0xff); //写定时值低位<br>Outport(0x40,(freq&gt;&gt;8)&amp;0xff); //写定时值高位<br>}<br><br>void SetClock9x(int freq)<br>{<br>union Function_Pointer<br>{<br>void (*pointer)();<br>char bytes[sizeof(void *)];<br>}OldIntAddress,NewIntAddress;<br><br>int IDTAddress; //IDT表基地址<br>int IDTItemAddress; //要修改的中断门所在地址<br>char *Pointer; //要修改的中断门所在地址,指针形式<br><br>__asm<br>{<br>push eax<br>sidt [esp-2]<br>pop eax<br>mov IDTAddress,eax //得到IDT表基地址<br>}<br><br>IDTItemAddress=FREE_INT_NO*8+IDTAddress;<br>Pointer=(char *)IDTItemAddress;<br>NewIntAddress.pointer=Ring0;<br><br>OldIntAddress.bytes[0]=Pointer[0];<br>OldIntAddress.bytes[1]=Pointer[1];<br>OldIntAddress.bytes[2]=Pointer[6];<br>OldIntAddress.bytes[3]=Pointer[7]; //保存旧的中断门<br><br>Pointer[0]=NewIntAddress.bytes[0];<br>Pointer[1]=NewIntAddress.bytes[1];<br>Pointer[6]=NewIntAddress.bytes[2];<br>Pointer[7]=NewIntAddress.bytes[3]; //设置新的中断门<br><br>__asm<br>{<br>mov ebx,freq<br>int FREE_INT_NO //产生中断,进入ring0<br>}<br><br>Pointer[0]=OldIntAddress.bytes[0];<br>Pointer[1]=OldIntAddress.bytes[1];<br>Pointer[6]=OldIntAddress.bytes[2];<br>Pointer[7]=OldIntAddress.bytes[3]; //恢复旧的中断门<br>}
 
to 无泪:<br>呵呵,前面说了,不要直写8253的代码,你这个整个改了系统时钟吧<br>而且我也不要C代码啊,有改的时间我就自己写了<br><br>不过,还是谢谢你
 
兄弟 这是我从大富翁笔记上找的 delphi版的 希望对你有用:<br>2003-5-15 10:38:09 &nbsp; &nbsp;我一直没有搞懂制作加速外挂是怎么一回事,直到前不久又翻出来了2001年下半期的《程序员合订本》中《“变速齿轮”研究手记》重新回味了一遍,才有了一点点开悟,随后用Delphi重写了一遍,下面我就把我的心得说给大家听听,并且在此感谢《“变速齿轮”研究手记》作者褚瑞大虲给了提示。废话我就不多说了,那就开始神奇的加速型外挂体验之旅吧!<br>原本我一直以为加速外挂是针对某个游戏而写的,后来发现我这种概念是不对的,所谓加速外挂其实是修改时钟频率达到加速的目的。<br>以前DOS时代玩过编程的人就会马上想到,这很简单嘛不就是直接修改一下8253寄存器嘛,这在以前DOS时代可能可以行得通,但是windows则不然。windows是一个32位的操作系统,并不是你想改哪就改哪的(微软的东东就是如此霸气,说不给你改就不给你改^_^),但要改也不是不可能,我们可以通过两种方法来实现:第一是写一个硬件驱动来完成,第二是用Ring0来实现(这种方法是CIH的作者陈盈豪首用的,它的原理是修改一下IDT表-&gt;创建一个中断门-&gt;进入Ring0-&gt;调用中断修改向量,但是没有办法只能用ASM汇编来实现这一切*_*,做为高级语言使用者惨啦!),用第一种方法用点麻烦,所以我们在这里就用第二种方法实现吧~~~<br>在实现之前我们来理一下思路吧:<br>1、我们首先要写一个过程在这个过程里嵌入汇编语言来实现修改IDE表、创建中断门,修改向量等工作<br>2、调用这个过程来实现加速功能<br>好了,现在思路有了,我们就边看代码边讲解吧:<br>首先我们建立一个过程,这个过程就是本程序的核心部份:<br>procedure SetRing(value:word); stdcall; &nbsp;<br>const ZDH = $03; &nbsp; &nbsp; &nbsp; &nbsp;// 设一个中断号<br>var<br> IDT : array [0..5] of byte; // 保存IDT表<br> OG : dword; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//存放旧向量<br>begin<br> asm<br> &nbsp; push ebx<br> &nbsp; sidt IDT &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//读入中断描述符表<br> &nbsp; mov ebx, dword ptr [IDT+2] //IDT表基地址<br> &nbsp; add ebx, 8*ZDH &nbsp;//计算中断在中断描述符表中的位置<br> &nbsp; cli &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//关中断<br> &nbsp; mov dx, word ptr [ebx+6] <br> &nbsp; shl edx, 16d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br> &nbsp; mov dx, word ptr [ebx] &nbsp; &nbsp;<br> &nbsp; mov [OG], edx &nbsp; &nbsp; &nbsp;<br> &nbsp; mov eax, offset @@Ring0 &nbsp;//指向Ring0级代码段<br> &nbsp; mov word ptr [ebx], ax &nbsp; &nbsp; &nbsp; &nbsp;//低16位,保存在1,2位<br> &nbsp; shr eax, 16d<br> &nbsp; mov word ptr [ebx+6], ax &nbsp; &nbsp; &nbsp;//高16位,保存在6,7位<br> &nbsp; int ZDH &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//中断<br> &nbsp; mov ebx, dword ptr [IDT+2] &nbsp; &nbsp;//重新定位<br> &nbsp; add ebx, 8*ZDH<br> &nbsp; mov edx, [OG]<br> &nbsp; mov word ptr [ebx], dx<br> &nbsp; shr edx, 16d<br> &nbsp; mov word ptr [ebx+6], dx &nbsp; &nbsp; &nbsp;//恢复被改了的向量<br> &nbsp; pop ebx<br> &nbsp; jmp @@exitasm //到exitasm处<br> &nbsp; @@Ring0: &nbsp; &nbsp;//Ring0,这个也是最最最核心的东东<br> &nbsp; &nbsp; mov al,$34 &nbsp; &nbsp;//写入8253控制寄存器<br> &nbsp; &nbsp; out $43,al<br> &nbsp; &nbsp; mov ax,value //写入定时值<br> &nbsp; &nbsp; out $40,al &nbsp; &nbsp;//写定时值低位<br> &nbsp; &nbsp; mov al,ah<br> &nbsp; &nbsp; out $40,al &nbsp; &nbsp;//写定时值高位<br> &nbsp; &nbsp; iretd &nbsp; &nbsp; &nbsp; &nbsp;//返回<br> @@exitasm:<br> end;<br>end;<br>最核心的东西已经写完了,大部份读者是知其然不知其所以然吧,呵呵,不过不知其所以然也然。下面我们就试着用一下这个过程来做一个类似于“变速齿轮”的一个东东吧!<br>先加一个窗口,在窗口上放上一个trackbar控件把其Max设为20,Min设为1,把Position设为10,在这个控件的Change事件里写上:<br><br>SetRing(strtoint('$'+inttostr(1742+(10-trackbar1.Position)*160)));<br><br>因为windows默认的值为$1742,所以我们把1742做为基数,又因为值越小越快,反之越慢的原理,所以写了这样一个公式,好了,这就是“变速齿轮”的一个Delphi+ASM版了(只适用于win9X),呵呵,试一下吧,这对你帮助会很大的,呵呵。<br>在win2000里,我们不可能实现在直接对端口进行操作,Ring0也失了效,有的人就会想到,我们可以写驱动程序来完成呀,但在这里我告诉你,windows2000的驱动不是一个VxD就能实现的,像我这样的低手是写不出windows所用的驱动WDM的,没办法,我只有借助外力实现了,ProtTalk就是一个很好的设备驱动,他很方便的来实现对低层端口的操作,从而实现加速外挂。<br>1、我们首先要下一个PortTalk驱动,他的官方网站是http://www.beyondlogic.org<br>2、我们要把里面的prottalk.sys拷贝出来。<br>3、建立一个Protalk.sys的接口(我想省略了,大家可以上http://www.freewebs.com/liuyue/porttalk.pas下个pas文件自己看吧)<br>4、实现加速外挂。<br>本来就篇就是补充篇原理我也不想讲太多了,下面就讲一下这程序的实现方法吧,如果说用ProtTalk来操作端口就容易多了,比win98下用ring权限操作方便。<br>1、新建一个工程,把刚刚下的接口文件和Protalk.sys一起拷到工程文件保存的文件夹下。<br>2、我们在我们新建的工程加入我们的接口文件<br> uses<br> &nbsp; windows,ProtTalk……<br>3、我们建立一个过程<br>procedure SetRing(value:word); <br>begin<br> if not OpenPortTalk then exit;<br> outportb($43,$34);<br> outportb($40,lo(Value));<br> outprotb($40,hi(value));<br> ClosePortTalk;<br>end;<br><br>4、先加一个窗口,在窗口上放上一个trackbar控件把其Max设为20,Min设为1,把Position设为10,在这个控件的Change事件里写上:<br><br>SetRing(strtoint('$'+inttostr(1742+(10-trackbar1.Position)*160)));
 
to:beyondup<br>这篇我也看过,但是..首先,porttalk直写对某些芯片组好象不能支持,其次这个是把整个系统时钟调快,和我的要求不符啊
 
我没有搞过这种玩意,但看前面的无泪所说:<br>变速齿轮是通过拦截TimeGetTimeAPI函数,修改该函数的返回值实现的。<br>还要修改TimeGetTime的返回值。<br>那你可以使用API Hook试试看吧。
 
但是,我想找的源代码啊,估计王荣不会给我,洪流也不会给我,只好。。。等。。
 
后退
顶部