.386
.model flat, stdcall
option casemap:none
_PROCVAR typedef proto :DWORD,:DWORD,:DWORD,:DWORD
PROCVAR typedef ptr _PROCVAR
include w2k\ntstatus.inc
include w2k\ntddk.inc
include w2k\ntoskrnl.inc
include w2k\w2kundoc.inc
includelib C:\MASMPlus\Lib\w2k\ntoskrnl.lib
include Strings.mac
SYSTEMTHREADS struct
KernelTime db 8 dup(?)
UserTime db 8 dup(?)
CreateTime db 8 dup(?)
WaitTime ULONG ?
StartAddress PVOID ?
ClientIs
dd
?
Priority
dd
?
BasePriority
dd
?
ContextSwitchCount ULONG ?
ThreadState ULONG ?
WaitReason
dd
?
SYSTEMTHREADS ends
SYSTEMPROCESSES struct
NextEntryDelta ULONG ?
ThreadCount ULONG ?
Reserved1
dd
6 DUP(?)
CreateTime db 8 dup(?)
UserTime db 8 dup(?)
KernelTime db 8 dup(?)
ProcessName UNICODE_STRING <>
BasePriority
dd
?
ProcessId ULONG ?
InheritedFromProcessId ULONG ?
HandleCount ULONG ?
Reserved2 ULONG 2 DUP(?)
VmCounters
dd
?
IoCounters
dd
?
Threads SYSTEMTHREADS <>
SYSTEMPROCESSES ends
.data
realaddr PROCVAR 0
CR0Reg
dd
0
Messaga2 db
"Çý¶¯¼ÓÔØ"
, 0
xuliehao
dd
0
.const
CCOUNTED_UNICODE_STRING
"ZwQuerySystemInformation"
, g_ApiAddr, 4
.code
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::
NewZwQuerySystemInformation proc SystemInformationClass:ULONG,SystemInformation:PVOID,SystemInformationLength:ULONG,ReturnLength:PULONG
invoke NtQuerySystemInformation ,SystemInformationClass,SystemInformation,SystemInformationLength,ReturnLength
.
if
eax
.
if
SystemInformationClass==5
mov edi,DWORD ptr SystemInformation
assume edi:PTR SYSTEMPROCESSES
push eax
.
while
[edi].NextEntryDelta!=0
invoke DbgPrint,$CTA0(
"ID=%d ProcessName=%ws\n"
),[edi].ProcessId,[edi].ProcessName.Buffer
add edi,[edi].NextEntryDelta
.endw
pop eax
assume edi:nothing
.endif
.endif
ret
NewZwQuerySystemInformation endp
DriverEntry proc pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING
local
pDeviceObject:PVOID
pushad
invoke DbgPrint, addr Messaga2
invoke MmGetSystemRoutineAddress,addr g_ApiAddr
mov eax, [eax+1]
mov xuliehao,eax
mov edi, DWORD ptr KeServiceDescriptorTable
mov edi, [edi]
mov eax,xuliehao
mov eax, [edi+(eax*4)] ;-
mov realaddr, eax
cli
mov eax, CR0
mov CR0Reg, eax
and eax,0fffeffffh
mov cr0, eax
mov eax,xuliehao
mov [edi+(eax*4)], DWORD ptr offset NewZwQuerySystemInformation
mov eax, CR0Reg
mov CR0, eax
sti
mov eax, pDriverObject
assume eax:PTR DRIVER_OBJECT
mov [eax].DriverUnload, offset DriverUnload
assume eax:nothing
popad
mov eax, STATUS_SUCCESS
ret
DriverEntry endp
;:::::::::::::::::::::::::::::::::::::::::::::::::::::
DriverUnload proc pDriverObject:PDRIVER_OBJECT
pushad
mov edi, DWORD ptr KeServiceDescriptorTable
mov edi, [edi]
cli
mov eax, CR0
mov CR0Reg, eax
and eax,0fffeffffh
mov cr0, eax
mov eax,xuliehao
mov ecx, DWORD ptr realaddr
mov [edi+(eax*4)], ecx
mov eax, CR0Reg
mov CR0, eax
sti
popad
ret
DriverUnload endp
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end DriverEntry