⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zwquerysysteminformation.cpp

📁 驱动枚举进程,控制线程AFFINITY,通过修改EPROCESS,ETHREAD ,KTHREAD 等结构,修改AFFINITY
💻 CPP
字号:
 
//
//VOID UnloadDriver(IN PDRIVER_OBJECT DriverObject);   
//
//
//NTSTATUS DriverEntry (IN PDRIVER_OBJECT DriverObject,IN PUNICODE_STRING RegistryPath)   
//{   
//
//
//
//	NTSTATUS status;   
//	PDEVICE_OBJECT   deviceObject;   
//
//	RtlInitUnicodeString( &DeviceNameString,    L"\\Device\\HideProcess" );   
//	RtlInitUnicodeString( &LinkDeviceNameString,L"\\DosDevices\\HideProcess" );   
//
//	KdPrint(("DriverEntry Enter............................\n"));   
//
//	status = IoCreateDevice(   
//		DriverObject,   
//		0,                         
//		&DeviceNameString,   
//		FILE_DEVICE_DISK_FILE_SYSTEM,   
//		FILE_DEVICE_SECURE_OPEN,   
//		FALSE,   
//		& deviceObject );   
//
//	if (!NT_SUCCESS( status ))    
//	{   
//
//		KdPrint(( "DriverEntry: Error creating control device object, status=%08x\n", status ));   
//		return status;   
//	}   
//
//	status = IoCreateSymbolicLink(   
//		(PUNICODE_STRING) &LinkDeviceNameString,   
//		(PUNICODE_STRING) &DeviceNameString   
//		);   
//
//	if (!NT_SUCCESS(status))   
//	{   
//		IoDeleteDevice(deviceObject);   
//		return status;   
//	}   
//
//	DriverObject->DriverUnload=UnloadDriver;   
//
//
//
//	//////////////////////Hook ZwQuerySystemInformation/////////////////////////////////////////////////    
//
//	_asm{    
//		cli;   
//		mov eax,cr0    
//			mov OldCr0,eax    
//			and eax,0fffeffffh    //cr0位16:WP 写保护(CR0 的第16 位)。置1 则禁止管理级程序写用户级的只读页,置0 则允许管理级程序写用户级的只读页。这个标志是用来在创建(forking)一个新进程时协助实现写时复制(COW——copy on write)
//			                      //的,在UNIX 操作系统中就是如此。
//			mov cr0,eax    
//	}   
//	_asm{   
//
//		mov     ecx, dword ptr [ZwQuerySystemInformation];   
//		mov     edx, [ecx+1];   
//		mov     eax, dword ptr [KeServiceDescriptorTable];   
//		mov     esi, [eax];   
//		mov     edx, [esi+edx*4];   
//		mov     dword ptr [OldZwQuerySystemInformation], edx   
//		mov     ecx, [ecx+1]   
//		mov     eax, [eax]   
//		mov     dword ptr [eax+ecx*4], offset MyZwQuerySystemInformation;   
//
//	}   
//	_asm   
//	{   
//		mov eax,OldCr0    
//			mov cr0,eax   
//			sti;   
//	}   
//
//	KdPrint(("Hook ZwQuerySystemInformation'status is Succeessfully "));   
//
//
//	return status ;   
//
//}   
//
//
//
//
//
//VOID UnloadDriver(IN PDRIVER_OBJECT DriverObject)   
//{   
//	UNICODE_STRING uniWin32NameString;   
//	UNICODE_STRING LinkNameString;   
//	PDEVICE_OBJECT deviceObject;   
//
//	//////////////////////UnHook ZwQuerySystemInformation/////////////////////////////////////////////////    
//
//	_asm{    
//		cli;   
//		mov eax,cr0    
//			mov OldCr0,eax    
//			and eax,0fffeffffh    
//			mov cr0,eax    
//	}   
//
//	_asm{   
//
//		mov     ecx, dword ptr [ZwQuerySystemInformation];   
//		mov     edx, [ecx+1];   
//		mov     eax, dword ptr [KeServiceDescriptorTable];   
//		mov     esi, [eax];   
//		mov     ebx, dword ptr [OldZwQuerySystemInformation];   
//		mov     [esi+edx*4],ebx;   
//	}   
//
//	_asm   
//	{   
//		mov eax,OldCr0    
//			mov cr0,eax   
//			sti;   
//	}   
//
//	KdPrint(("UnHookZwQuerySystemInformation'status is Succeessfully................... "));   
//	deviceObject= DriverObject->DeviceObject;   
//	IoDeleteSymbolicLink(&LinkDeviceNameString);   
//	ASSERT(!deviceObject->AttachedDevice);   
//	if ( deviceObject != NULL )   
//	{   
//		IoDeleteDevice( deviceObject );   
//	}   
//
//}   
//




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -