#2
zaixuexi2011-06-02 10:02
|
编译是过了,但是只要一加载就直接蓝了!DbgPrint("the DriverEntry !!");这句也没执行到~~也没什么低中断级的函数调用,是在不知道哪里处理处了问题了~~
NTSTATUS DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING unstr)
{
NTSTATUS status=STATUS_UNSUCCESSFUL;
PUNICODE_STRING SymbolicLinkName=NULL;
PUNICODE_STRING D_Name=NULL;
PDEVICE_OBJECT DeviceObject=NULL;
ULONG i;
DbgPrint("the DriverEntry !!");
RtlInitUnicodeString(D_Name,L"\\Device\\K_antive");
RtlInitUnicodeString(SymbolicLinkName,L"\\DosDevices\\A_safe");
DbgPrint("the device is prepare creat !!");
for(i=0;i<IRP_MJ_MAXIMUM_FUNCTION;++i)
{
DriverObject->MajorFunction[i]=mydispatch;
}
DriverObject->DriverUnload=Antive_unload;
status=IoCreateDevice(DriverObject,0,D_Name,
FILE_DEVICE_UNKNOWN,
0,
FALSE,
&DeviceObject);
if(status!=STATUS_SUCCESS)
{
DbgPrint("the device is creat fail!!");
return status;
}
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;//DeviceObject+1ch Flags
status=IoCreateSymbolicLink(SymbolicLinkName,D_Name);
if(status!=STATUS_SUCCESS)
{
DbgPrint("the symbolic link is creat fail !!");
IoDeleteDevice(DeviceObject);
return status;
}
return status;
}