[wdmaudiodev] Re: Interfacing Audio Driver From USER MODE

  • From: Matt Gonzalez <matt@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Sun, 1 Feb 2009 15:23:22 -0800

You need to check which interface by checking the file name in each of the create, ioctl, and close handlers. If it's yours, then you need to handle it there. If not, you need to use PcDispatchIrp.


This is all in the wdmaudiodev archive; try searching for CreateHandler or IRP_MJ_CREATE.

On Jan 31, 2009, at 6:18 PM, Vipin Kumar <vipin@xxxxxxxxxxxxxx> wrote:

Hi,
   Thanks Matt,

i am using a MSVAD Simple as a base,( so portcls wavecyclic is the type).

Moreover, as i have told earlier, i have already done
   DriverObject->MajorFunction [IRP_MJ_DEVICE_CONTROL] =
IoCtlHandler;

for IRP_ MJ_CREATE, i don't know what to do with it, means just returning success, will let me get the handle, or something special has to be done or just pass it below( i am doing this right now, but createfile returns file not found).

Let me know what has to be done for both MJ_CREATE_CLOSE

Thanks .

Regards,
Vipin

On Sat, Jan 31, 2009 at 10:30 AM, Matthew Gonzalez <matt@xxxxxxxxxxxxx> wrote:
//www.freelists.org/post/wdmaudiodev/Which-type-of-driver,5



Vipin Kumar wrote:

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/


****************** 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: