资源简介
过tp保护,使用vc6.0编译,wdk:7600:16385
代码片段和文件信息
extern “C“
{
//#include
#include
};
#include “IoDeviceCtrl.h“
#define MYDRIVERlinkNAME L“\\??\\Lk7C86477EB4994ac593CDE89E7402A91F“
#define MYDVICENAME L“\\Device\\Ld7C86477EB4994ac593CDE89E7402A91F“
void UnLoadDriver(PDRIVER_object DriverObj);
extern “C“ NTSTATUS DriverEntry(IN OUT PDRIVER_object Driverobject
IN PUNICODE_STRING RegistryPath)
{
MYHUNXIAOCOUDE(3);
PDEVICE_object p_Deviceobject = NULL;
NTSTATUS n_Status = STATUS_UNSUCCESSFUL;
Driverobject->MajorFunction[IRP_MJ_CREATE] = DispatchCreate;
Driverobject->MajorFunction[IRP_MJ_DEVICE_CONTROL]=IoCtlDev;
Driverobject->DriverUnload = UnLoadDriver;
UNICODE_STRING wsz_DeviceName;
RtlInitUnicodeString(&wsz_DeviceNameMYDVICENAME);
n_Status = IoCreateDevice(Driverobject0&wsz_DeviceNameFILE_DEVICE_UNKNOWN
0FALSE&p_Deviceobject);
if(!NT_SUCCESS(n_Status))
{
return n_Status;
}
p_Deviceobject->Flags |= DO_BUFFERED_IO;
MYHUNXIAOCOUDE(2);
UNICODE_STRING wsz_DriverlinkName;
RtlInitUnicodeString(&wsz_DriverlinkNameMYDRIVERlinkNAME);
n_Status = IoCreateSymboliclink(&wsz_DriverlinkName&wsz_DeviceName);
if(!NT_SUCCESS(n_Status))
{
IoDeleteDevice(p_Deviceobject);
return n_Status;
}
return n_Status;
}
void UnLoadDriver(PDRIVER_object DriverObj)
{
UNICODE_STRING wsz_DriverlinkName;
RtlInitUnicodeString(&wsz_DriverlinkNameMYDRIVERlinkNAME);
IoDeleteSymboliclink(&wsz_DriverlinkName);
IoDeleteDevice(DriverObj->Deviceobject);
KdPrint((“驱动已卸载!“));
}
- 上一篇:http协议实现c++
- 下一篇:vc++6.0配置OpenCV
评论
共有 条评论