阅读:1210回复:2
Drivernetwork开发中间层驱动,想和应用程序通信
用driverstudio里面的Drivernetwork开发中间层驱动,想和应用程序通信,但用NdisMRegisterDevice安装是会从起,应该怎么办?
|
|
沙发#
发布于:2005-06-16 10:59
用下面的函数注册不用重启的吧
NDIS_STATUS CreateIRPDevice() {//注册设备 NDIS_STATUS Status; //定义进程方法数组 static PDRIVER_DISPATCH MajorFunction[IRP_MJ_MAXIMUM_FUNCTION+1]; NdisZeroMemory(MajorFunction,sizeof(MajorFunction)); MajorFunction[IRP_MJ_CREATE]= MajorFunction[IRP_MJ_CLOSE]= MajorFunction[IRP_MJ_CLEANUP]= MajorFunction[IRP_MJ_READ]= MajorFunction[IRP_MJ_WRITE]= MajorFunction[IRP_MJ_DEVICE_CONTROL]=IoDispatch; //定义设备名称 UNICODE_STRING ntDeviceName; UNICODE_STRING win32DeviceName; RtlInitUnicodeString(&ntDeviceName, IRPFilter_WDM_DEVICE_NAME_W); RtlInitUnicodeString(&win32DeviceName, IRPFilter_WDM_SYMBOLIC_LINK_W); //注册设备 Status = NdisMRegisterDevice( *KNdisMiniDriver::DriverInstance(), &ntDeviceName, &win32DeviceName, MajorFunction, &m_pDeviceObject, &m_DeviceHandle); if (Status==NDIS_STATUS_SUCCESS){//注册成功 m_pDeviceObject->Flags |=DO_BUFFERED_IO; DbgPrint(\"注册设备成功!\\n\"); } else//注册失败 DbgPrint(\"注册设备失败!\\n\"); return Status; } |
|
板凳#
发布于:2005-06-16 19:07
谢谢!我试看.放在初始化例程里面注册没错吧?NdisMRegisterDevice里面第一个参数*KNdisMiniDriver:driverInstance(),参数不是应该是NdisWrapperHandle
Specifies the handle returned by NdisMInitializeWrapper. 吗??为什么可以用*KNdisMiniDriver:driverInstance(),?? |
|