This has been discussed repeatedly on this list. Please search the archives; you need to handle IRP_MJ_CREATE and IRP_MJ_CLOSE.
Vipin Kumar wrote:
Hi, since i am writing an virtual microphone driver, i definitely want it to take data from usermode,( ofcourse via IOCTL). i have written few drivers but never a WDM audio one However when i call createfile, it fails. This is code in the DriverEntry DriverObject->MajorFunction [IRP_MJ_DEVICE_CONTROL] = IoCtlHandler; in ADD device Status = IoRegisterDeviceInterface( PhysicalDeviceObject, &AD_COMM_GUID , NULL , &InstanceString); DbgPrint(" Registered Device Status %d Name Length %d \n" , Status,InstanceString.Length); if(NT_SUCCESS( ntStatus)){ Status = IoSetDeviceInterfaceState(&InstanceString,TRUE); // make it ready for communication DbgPrint(" Ready for Communication Status %d \n" , Status); } All the status are STATUS_SUCCESS. I use SetupDiEnumDeviceInterfaces, SetupDiGetDeviceInterfaceDetail to get my instance i even get it in the Registry in Control\DeviceClasses . My IOCTL handler gives me few IOCTLS while recording. but when i call createfile on it fails Device_Handle = CreateFileW(Device_Name, GENERIC_READ, 0,NULL, OPEN_EXISTING,0,NULL); if(Device_Handle == INVALID_HANDLE_VALUE){ printf("Error Occured while Opening Device GetLastError Code %d\n",GetLastError()); Error_Code = 1; } i get err code 2 , means file not found, However, i can see the symbolic link using winobj in the Global Directory. So what's WRONG !!!! Sorry for the BIG POST.. But can somebody tell what's wrong with my approach.I am just not able to figure it out.Hope somebody from MS will clearify what's required to get it working. It would be better gives a code snippet. Waiting for your help. Thanks. Regards, Vipin
****************** WDMAUDIODEV addresses: Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx Subscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe Unsubscribe: mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe Moderator: mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx URL to WDMAUDIODEV page: http://www.wdmaudiodev.com/