.386P
LOCALS
JUMPS
.MODEL FLAT, STDCALL ; with STDCALL we must reverse the sequence of pushes
; before a APIn call.
UNICODE = 0 ; Needed for w32.inc
INCLUDE W32.inc ; Windows definitions, messages, errors, structures,
; API functions declarations. Some additions of mine.
; Thanks to Barry Kauler and Sven Schreiber.
lp EQU OFFSET
extrn SetUnhandledExceptionFilter : PROC
.DATA
skod db 0
lpOldGate dd 0
IDT db 6 dup (0)
;---- Error Messages
szExceptionCaused db "Exception Caused - could not switch to ring 0",0
szError db "Error",0
ExceptionUsed EQU 5
.CODE
start:
call SetUnhandledExceptionFilter, lp ExceptCallBack ; Catch exceptions
; (security if ring transform
; doesn't work)
sidt fword ptr IDT ; fetch IDT register
mov ebx, dword ptr [IDT+2] ; ebx -> IDT
add ebx, 8*ExceptionUsed ; Ebx -> IDT entry of ExceptionUsed
cli ; Clear interupts
mov dx, word ptr [ebx+6] ; Save the current gate highword
shl edx, 16d
mov dx, word ptr [ebx] ; lowword
mov [lpOldGate], edx
mov eax, offset Ring0Code ; "install hook" - that is newgate
mov word ptr [ebx], ax ; lowword
shr eax, 16d
mov word ptr [ebx+6], ax ; highword
int ExceptionUsed ; cause exception
mov ebx, dword ptr [IDT+2] ; restore gate
add ebx, 8*ExceptionUsed
mov edx, [lpOldGate]
mov word ptr [ebx], dx
shr edx, 16d
mov word ptr [ebx+6], dx
CALL ExitProcess, -1 ; exit
Ring0Code PROC
mov eax, cr0 ; Ring0 code here..
iretd
Ring0Code ENDP
ExceptCallBack PROC
call MessageBoxA, 0, lp szError, lp szExceptionCaused, 0
call ExitProcess, -1
ret
ExceptCallBack ENDP
ends
end start
上面的代码是网上下载的,我看了一遍,有几个问题,想请教一下这里的大虾们
1.LOCALS
JUMPS
这两个是干什么用的?
2.UNICODE = 0 ; Needed for
INCLUDE W32.inc
这个是干什么用的,还有w32.inc我怎么找都找不到,请问那位有这个文件,能给我么?
3.我编译了一下,好象是通不过的.请问是那里错了
我不能上传附件,给个附件下载地址,请大虾们解惑.
c79K9s2c8@1M7q4)9K6b7g2)9J5c8W2)9J5c8Y4N6%4N6#2)9J5k6h3#2A6N6s2g2Q4x3X3g2U0L8W2)9K6b7e0p5H3x3o6q4Q4x3V1k6@1M7$3N6K6k6h3q4J5j5$3S2Q4x3V1k6@1M7$3N6V1j5i4c8S2i4K6u0r3N6s2y4Y4k6r3q4@1j5g2)9J5c8X3c8S2N6r3q4J5k6i4y4G2N6i4u0U0k6g2)9J5c8X3y4G2L8i4m8#2N6r3g2J5i4K6u0r3M7$3!0#2M7X3y4W2j5$3!0V1k6g2)9J5c8X3q4K6L8g2)9J5c8X3q4K6L8h3y4G2k6r3g2K6i4K6u0r3M7X3W2F1k6K6m8Q4x3X3g2*7K9i4l9`.
[培训]科锐逆向工程师培训第53期2025年7月8日开班!