http://www.csdn.net/Expert/TopicView1.asp?id=665173
这是源代码:
freq为速度,但不知设为多少好?还有就是怎么为减速和恢复到原来的速度?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]; //恢复旧的中断门
}

解决方案 »

  1.   

    代码编译不过,好象少什么头文件,FREE_INT_NO结构没有定义啊
    E:\ssDlg.cpp(193) : error C2065: 'FREE_INT_NO' : undeclared identifier
    E:\ssDlg.cpp(195) : error C2065: 'Ring0' : undeclared identifier
    E:\ssDlg.cpp(195) : error C2440: '=' : cannot convert from 'int' to 'void (__cdecl *)(void)'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    E:\ssDlg.cpp(211) : error C2415: improper operand type
      

  2.   

    忘了这个
    #define FREE_INT_NO 5
    有人实验成功了吗?
      

  3.   

    源码freq=5000
    大于5000就是减速反之则加速。
      

  4.   

    加速是成功了,但我的程序运行后不能进行其他操作,一动就死机,
    比如SetClock9x(100),时钟飞快,之后再打开记事本就蓝屏了,
    不得不重启,有哪位高手知道是什么问题吗?
      

  5.   

    加速是成功了,但我的程序运行后不能进行其他操作,一动就死机,
    比如SetClock9x(100),时钟飞快,之后再打开记事本就蓝屏了,
    不得不重启,有哪位高手知道是什么问题吗?
      

  6.   

    兄弟变速器的代码中修改了时钟中断发生频率,
    这是通过设置8253控制器实现的,属于硬件操作,
    但是单纯的修改硬件参数不能够实现变速,相反,如果把时钟中断频率改的太快,
    操作系统就会对鼠标双击操作无动于衷。
    其实兄弟变速器代码的重点并不在修改硬件参数,而是使用了API钩子技术。
    应该把分析的重点放在如何实现API钩子,我没有见过兄弟变速器的源代码,如果你有,可以给我发一份,大家共同研究。
    我的MAIL:[email protected]
      

  7.   

    前些天我还给兄弟写了MAIL,不知道什么时候能有回!!!