变速齿轮的原理!!!

ss 2002-01-10 07:49:54
哪位高手知道变速齿轮的原理?
...全文
836 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
yalongsoft 2002-01-21
  • 打赏
  • 举报
回复
http://www.csdn.net/develop/read_article.asp?id=5262
ss 2002-01-16
  • 打赏
  • 举报
回复
 变速齿轮通过修改API函数GETTICKCOUNT和TIMEGETTIME骗过了游戏和程序的定时器导致游戏和程序速度看起来被改变。

下面以GETTICKCOUNT为例进行分析:原本的GETTICKCOUNT汇编:
kernel32!gettickcount mov gs,[bffcaea18]

mov eax,gs:[00000000]

sub edx,edx

mov gs,dx

ret

变速齿轮修改后的GETTICKCOUNT汇编:

kernel32!gettickcount

这里是关键-->jmp 840500d9(840500d9并不是绝对的)

add [eax],al

add [ecx+00000000],ah

sub edx,edx

mov gs,dx

ret

可以看出变速齿轮修改了gettickcount的代码,当游戏和程序使用gettickcount时就会自动跳转到840500d9处执行。

再看看840500d9处的代码汇编:

840500d9:CLI

push ebp

mov ebp,esp

push ebx

push ecx

push edx

push esi

push edi

call 840500e7

840500e7:pop edi

xor di,di

mov esi,edi

add esi,00402051

sub esi,00401f0b

push esi

call edi

call 84050101

84050101:pop edi

xor di,di

call [edi+0000fef0]

call 84050110

84050110:sub eax,[edi+0000ff30]

mul dword,ptr[edi+0000ff30]

mov ebx,00100000

div ebx

add eax,[edi+0000fe20]

push eax

mov eax,00402072

sub eax,00401f08

add eax,edi

push eax

call edi

pop eax

pop edi

pop esi

pop edx

pop ecx

pop ebx

pop ebp

sil

ret

以上正是变速齿轮变速的核心所在。(GETTICKCOUNT返回的是EAX的值你可以对EAX进行跟踪)

  下面说一下变速齿轮挂接API的方法:首先变速齿轮在MMF区(WIN9X/ME)申请一块内存,把上面的代码从程序中移到该内存。使用修改描述符的方法从应用程序级跳到核心级(具体可查看《电脑编程技巧与维护》2000年第6期34页)修改GETTICKCOUNT开头的代码使之指向申请的内存的首地址实现挂接。 以上就是我对变速齿轮分析,如果有什么意见或想查看详细的原代码请与我联系,我的邮箱:rwjgpget@sohu.com我会尽快给你答复。

ss 2002-01-16
  • 打赏
  • 举报
回复
谁有Delphi下的源码?多谢了
ss 2002-01-16
  • 打赏
  • 举报
回复
《程序员》那个是骗人的!难道大家没看出来!
acqy 2002-01-16
  • 打赏
  • 举报
回复
去程序员杂志的合订本看看
veaven 2002-01-15
  • 打赏
  • 举报
回复
高,实在是高!
harrypotter 2002-01-15
  • 打赏
  • 举报
回复
保存
ss 2002-01-15
  • 打赏
  • 举报
回复
程序员》那个是骗人的!难道大家没看出来!
ss 2002-01-15
  • 打赏
  • 举报
回复
有没有Delphi的!最好有源码!多谢了!
forprograme 2002-01-15
  • 打赏
  • 举报
回复
《程序员》上有
8341 2002-01-14
  • 打赏
  • 举报
回复
收藏
shen630 2002-01-14
  • 打赏
  • 举报
回复
学习
cwsuperman 2002-01-14
  • 打赏
  • 举报
回复
这样通过修改8253的话,岂不是连Mouse都用不了了,因为系统会认为太慢。有没有别的方法啊?
cwsuperman 2002-01-14
  • 打赏
  • 举报
回复
To unalone(阿龙)
Win9x下,用户可以进入Ring 0。Win NT/2000做了保护。
ss 2002-01-14
  • 打赏
  • 举报
回复
谁能把它改为delphi下的代码?感谢!
unalone 2002-01-14
  • 打赏
  • 举报
回复
在9X下IDT是可以随便修改的吗??????????????????
Yofoo 2002-01-14
  • 打赏
  • 举报
回复
系统时钟是不变
通过修改API函数GETTICKCOUNT和TIMEGETTIME骗过了游戏和程序的定时器导致游戏和程序速度看起来被改变。

http://wlbookwl.myrice.com/jck/1027bccl.htm 去看看吧
这是vrbrother的源代码,那里还有许多详细的解释。
// File name : SetClock.cpp
// Function1 : SetClock9x(int)
// Function2 : SetClockNT(int)
// Chu Rui 2001.3.1

#include "stdafx.h"
#include "ntport.h"

#define FREE_INT_NO 5

void Ring0()
{ //在Windows9x下进入ring0后进行的操作
__asm
{
cli
mov al,34h
out 43h,al //写入8253控制寄存器,设置写0号定时器
mov ax,bx
out 40h,al //写定时值低位
mov al,ah
out 40h,al //写定时值高位
sti
iretd;
}
}

void SetClockNT(int freq)
{ //NT下的操作
//这里使用了NT Port库
Outport(0x43,0x34); //写入8253控制寄存器,设置写0号定时器
Outport(0x40,freq&0xff); //写定时值低位
Outport(0x40,(freq>>8)&0xff); //写定时值高位
}

void SetClock9x(int freq)
{
union Function_Pointer
{
void (*pointer)();
char bytes[sizeof(void *)];
}OldIntAddress,NewIntAddress;

int IDTAddress; //IDT表基地址
int IDTItemAddress; //要修改的中断门所在地址
char *Pointer; //要修改的中断门所在地址,指针形式

__asm
{
push eax
sidt [esp-2]
pop eax
mov IDTAddress,eax //得到IDT表基地址
}

IDTItemAddress=FREE_INT_NO*8+IDTAddress;
Pointer=(char *)IDTItemAddress;
NewIntAddress.pointer=Ring0;

OldIntAddress.bytes[0]=Pointer[0];
OldIntAddress.bytes[1]=Pointer[1];
OldIntAddress.bytes[2]=Pointer[6];
OldIntAddress.bytes[3]=Pointer[7]; //保存旧的中断门

Pointer[0]=NewIntAddress.bytes[0];
Pointer[1]=NewIntAddress.bytes[1];
Pointer[6]=NewIntAddress.bytes[2];
Pointer[7]=NewIntAddress.bytes[3]; //设置新的中断门

__asm
{
mov ebx,freq
int FREE_INT_NO //产生中断,进入ring0
}

Pointer[0]=OldIntAddress.bytes[0];
Pointer[1]=OldIntAddress.bytes[1];
Pointer[6]=OldIntAddress.bytes[2];
Pointer[7]=OldIntAddress.bytes[3]; //恢复旧的中断门
}
ss 2002-01-11
  • 打赏
  • 举报
回复
哪里有原代码下载?
变速齿轮只改变游戏软件的速度,系统时钟好象不变啊?不信试试!
烟灰 2002-01-10
  • 打赏
  • 举报
回复
我们的电脑有一个内部时钟,驱动计算机一些时序, 一些游戏像红警等,都是利用用时钟来控制每个小兵的动作,如果修改这个时钟的频率,就起到加速的目的
tmjpd 2002-01-10
  • 打赏
  • 举报
回复
你不妨找<<程序员>>合订本看看,那上面有关于变速齿轮的详细研究,写得挺好的,不过想编变速齿轮的程序得会汇编才行,因为你必须更硬件打交道,具体实现,你可以看书.
加载更多回复(1)

5,531

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧