-
-
[求助]驱动编程为什么这个代码不正确,不生成sys。
-
发表于:
2016-4-11 21:24
3924
-
[求助]驱动编程为什么这个代码不正确,不生成sys。
驱动编程为什么这个代码不正确,不生成sys。请求修改
#include "ntifs.h"//必须最前面,必须在ntddk前面
#include "ntddk.h"
NTSTATUS ReadWriteProcess()
{
NTSTATUS Status;
HANDLE hProcess;
CLIENT_ID ClientId;
OBJECT_ATTRIBUTES ObjAttr;
PVOID AllocateAddress;
size_t RegionSize;
ClientId.UniqueProcess =0;
ClientId.UniqueThread=0;
memset(&ObjAttr,0,sizeof(OBJECT_ATTRIBUTES));
Status=ZwOpenProcess(&hProcess,PROCESS_ALL_ACCESS,&ObjAttr,&ClientId);
if (!NT_SUCCESS(Status))
{
KdPrint(("error code:%X",Status));
return Status;
}
RegionSize=0xff;
Status=ZwAllocateVirtualMemory(hProcess,&AllocateAddress,0,(PSIZE_T)&RegionSize,MEM_COMMIT,PAGE_EXECUTE_READWRITE);
KdPrint(("open sucessed!"));
ZwClose(hProcess);
return Status;
}
VOID MyUnload(PDRIVER_OBJECT pDriverObject)
{
}
NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject,PUNICODE_STRING Reg_Path)
{
ReadWriteProcess();
pDriverObject->DriverUnload=MyUnload;
return STATUS_SUCCESS;
}
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课