以下代码是 EasySys生成
//
// Create dispatch points for device control, create, close.
//
DriverObject->MajorFunction[IRP_MJ_CREATE] = Rw_DispatchCreate;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = Rw_DispatchClose;
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = Rw_DispatchDeviceControl;
DriverObject->DriverUnload = Rw_Unload;
在驱动入口 已经指向了 Rw_DispatchDeviceControl;
当我用API DeviceIoControl 发送一个Irp请求后,他应该走 Rw_DispatchDeviceControl这个
函数吧.我在函数第一行有一句打印,结果加载驱动后,点击发送Irp请求,结果这句并没有打印出来.
我想问一下是什么原因?
Delphi做的exe端
DeviceIoControl(m_hCommDevice, IOCTL_RW__HELLO, pointer(procid), 0, @outData, 1024, dwReturn, nil);
m_hCommDevice := CreateFile('\\.\RWSYS', GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, nil,
OPEN_EXISTING, 0, 0);
VC声明
#define RW__WIN32_DEVICE_NAME_A "\\\\??\\RWSYS"
#define RW__WIN32_DEVICE_NAME_W L"\\\\??\\RWSYS"
#define RW__DEVICE_NAME_A "\\Device\\RWSYS"
#define RW__DEVICE_NAME_W L"\\Device\\RWSYS"
#define RW__DOS_DEVICE_NAME_A "\\DosDevices\\RWSYS"
#define RW__DOS_DEVICE_NAME_W L"\\DosDevices\\RWSYS"
不知道问题出在哪里.
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!