資源簡介
兄弟變速器源程序.zip

代碼片段和文件信息
//?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?al34h
out?43hal //寫入8253控制寄存器,設置寫0號定時器
mov?axbx
out?40hal //寫定時值低位
mov?alah
out?40hal //寫定時值高位
sti
iretd;
}
}
void?SetClockNT(int?freq)
{ //NT下的操作
//這里使用了NT?Port庫
Outport(0x430x34); //寫入8253控制寄存器,設置寫0號定時器
Outport(0x40freq&0xff); //寫定時值低位
Outport(0x40(freq>>8)&0xff); //寫定時值高位
}
void?SetClock9x(int?freq)
{
union?Function_Pointer
{
void?(*pointer)();
char?bytes[sizeof(void?*)];
}OldIntAddressNewIntAddress;
int?IDTAddress; //IDT表基地址
int?IDTItemAddress; //要修改的中斷門所在地址
char?*Pointer; //要修改的中斷門所在地址,指針形式
__asm
{
push?eax
sidt?[esp-2]
pop?eax
mov?IDTAddresseax //得到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?ebxfreq
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]; //恢復舊的中斷門
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2005-03-26?03:39??兄弟變速器源程序\
?????目錄???????????0??2004-11-14?14:45??兄弟變速器源程序\www.cnzz.cn\
?????目錄???????????0??2003-10-27?17:58??兄弟變速器源程序\www.cnzz.cn\example\
?????文件???????28672??2001-03-12?14:13??兄弟變速器源程序\www.cnzz.cn\example\speedext.dll
?????文件????????1161??2001-03-12?14:33??兄弟變速器源程序\www.cnzz.cn\example\mainfr
?????文件??????????42??2001-03-12?14:38??兄弟變速器源程序\www.cnzz.cn\example\example.vbw
?????文件????????3904??1998-06-03?12:59??兄弟變速器源程序\www.cnzz.cn\example\zntport.sys
?????文件?????????653??2001-03-12?14:38??兄弟變速器源程序\www.cnzz.cn\example\example.vbp
?????文件???????61440??2001-03-03?14:46??兄弟變速器源程序\www.cnzz.cn\example\ntport.dll
?????文件????????1727??2001-03-03?21:56??兄弟變速器源程序\www.cnzz.cn\SetClock.cpp
?????文件?????????223??2004-10-04?20:06??兄弟變速器源程序\www.cnzz.cn\readme.htm
?????文件???????50118??2004-11-30?03:27??兄弟變速器源程序\使用說明.CHM
評論
共有 條評論