[wdmaudiodev] Re: Interfacing Audio Driver From USER MODE

  • From: Vipin Kumar <vipin@xxxxxxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Sat, 31 Jan 2009 02:36:03 -0800

Hi,
    Thanks for your reply, Matt.

   i searched the archives but couldn't find any such stuff.Can't you point
me, please?

So, i am basically  guessing again
Just returning Status_success and completing the irp( and no passing it
down)  will make createfile call successful.

Please let me know some more details  about what to do in both IRP_MJ_CREATE
and IRP_MJ_CLOSE to get it working.

Thanks

Regards,Vipin


On Fri, Jan 30, 2009 at 9:49 AM, Matt Gonzalez <matt@xxxxxxxxxxxxx> wrote:

> 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/
>
>

Other related posts: