- UID
- 5043
- 积分
- 1347
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-13
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 LoveArx 于 2013-5-15 15:51 编辑
 - void getIDESerial(CString &s)
[sell=10]
 - //#include <windows.h>
- #include "stdafx.h"
- #include <stdio.h>
- WORD pw[256];
- static DWORD idt, int_idt;
- static DWORD Base;
- static WORD Entry;
- #pragma warning (disable:4035)
- static int inp(WORD rdx)
- {
- _asm xor eax, eax
- _asm mov dx, rdx
- _asm in al, dx
- }
- static WORD inpw(WORD rdx)
- {
- _asm xor eax, eax
- _asm mov dx, rdx
- _asm in ax, dx
- }
- static void outp(WORD rdx, int ral)
- {
- _asm mov dx, rdx
- _asm mov eax, ral
- _asm out dx, al
- }
- static int WaitIde()
- {
- int al;
- while ((al=inp(0x1F7))>=0x80) ;
- return al;
- }
- static void ReadIDE()
- {
- int al;
- int i;
- WaitIde();
- outp(0x1F6,0xA0);
- al = WaitIde();
- if ((al&0x50)!=0x50) return;
- outp(0x1F6,0xA0);
- outp(0x1F7,0xEC);
- al = WaitIde();
- if ((al&0x58)!=0x58) return;
- for (i=0;i<256;i++) {
- pw = inpw(0x1F0);
- }
- }
- static void __declspec( naked ) NowInRing0()
- {
- _asm {
- push ebp
- mov ebp,esp
- call ReadIDE
- cli
- mov ebx, int_idt
- mov ax, Entry
- mov word ptr [ebx-4], ax
- mov eax, Base
- shr eax, 16
- mov [ebx+2], ax
- sti
- leave
- iretd
- }
- }
- void GetIDEInfo()
- {
- DWORD dwExcept;
- dwExcept = (DWORD)NowInRing0;
- _asm {
- mov eax, fs:[0]
- push eax
- sidt [esp-02h]
- pop ebx
- mov idt, ebx
- add ebx, 0x1C
- mov int_idt, ebx
- mov eax, [ebx]
- mov [Base], eax
- mov ax, [ebx-4]
- mov [Entry], ax
- cli
- mov esi, dwExcept
- push esi
- mov [ebx-4], si
- shr esi, 16
- mov [ebx+2], si
- pop esi
- sti
- int 3
- }
- }
- void getIDESerial(CString &s)
- {
- register i,j;
- GetIDEInfo();
- for (i=0,j=0;i<10;i++)
- {
- s+=(pw[10+i]>>8);
- s+=(pw[10+i]&0xFF);
- }
- return ;
- }
[/sell] |
评分
-
查看全部评分
|