驱动——遍历

实验环境:win7 x86

pDriverObject->DriverSection实际是指向_LDR_DATA_TABLE_ENTRY结构的指针。

ntdll!_LDR_DATA_TABLE_ENTRY
   +0x000 InLoadOrderLinks : _LIST_ENTRY
   +0x008 InMemoryOrderLinks : _LIST_ENTRY
   +0x010 InInitializationOrderLinks : _LIST_ENTRY
   +0x018 DllBase          : Ptr32 Void //
   +0x01c EntryPoint       : Ptr32 Void //
   +0x020 SizeOfImage      : Uint4B
   +0x024 FullDllName      : _UNICODE_STRING //
   +0x02c BaseDllName      : _UNICODE_STRING //
   +0x034 Flags            : Uint4B
   +0x038 LoadCount        : Uint2B
   +0x03a TlsIndex         : Uint2B
   +0x03c HashLinks        : _LIST_ENTRY
   +0x03c SectionPointer   : Ptr32 Void
   +0x040 CheckSum         : Uint4B
   +0x044 TimeDateStamp    : Uint4B
   +0x044 LoadedImports    : Ptr32 Void
   +0x048 EntryPointActivationContext : Ptr32 _ACTIVATION_CONTEXT
   +0x04c PatchInformation : Ptr32 Void
   +0x050 ForwarderLinks   : _LIST_ENTRY
   +0x058 ServiceTagLinks  : _LIST_ENTRY
   +0x060 StaticLinks      : _LIST_ENTRY
   +0x068 ContextInformation : Ptr32 Void
   +0x06c OriginalBase     : Uint4B
   +0x070 LoadTime         : _LARGE_INTEGER

内核代码 :

#include <ntifs.h>

VOID HideProcess(PDRIVER_OBJECT pDriverObject)
{
	PUNICODE_STRING pName = NULL;
	PLIST_ENTRY pDriverList = (PLIST_ENTRY)pDriverObject->DriverSection;
	PLIST_ENTRY pNextList = pDriverList->Flink;
	do 
	{
		pName = (PUNICODE_STRING)((ULONG)pNextList + 0x2c);
		DbgPrint("%wZ", pName); 
		pName = (PUNICODE_STRING)((ULONG)pNextList + 0x24);
		DbgPrint("%wZ", pName);
		pNextList = pNextList->Flink;
	} while (pNextList != pDriverList->Flink);
}

VOID UnloadDriver(PDRIVER_OBJECT pDriverObject)
{
	DbgPrint("unload success!\n");
}

NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject, PUNICODE_STRING pRegPath)
{
	pDriverObject->DriverUnload = UnloadDriver;
	HideProcess(pDriverObject);
	DbgPrint("load success!\n");
	return STATUS_SUCCESS;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值