[wdmaudiodev] Interfacing Audio Driver From USER MODE

  • From: Vipin Kumar <vipin@xxxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Fri, 30 Jan 2009 15:43:46 +0530

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

Other related posts: