[wdmaudiodev] Re: How can I open my virtual audio driver and send IOCTL to it?

  • From: "jerry_wang" <jerry_wang@xxxxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 10 Jun 2004 10:50:03 +0800

hi hollychen

your WDM driver must handle the IRP_MJ_CREATE,and returen STATUS_SUCCESS.

r u chinese?
你必须处理IRP_MJ_CREATE,并成功完成。

jerry

----- Original Message -----
From: "hollychen" <hollychen@xxxxxxxxxxx>
To: <wdmaudiodev@xxxxxxxxxxxxx>
Sent: Thursday, June 10, 2004 8:48 AM
Subject: [wdmaudiodev] Re: How can I open my virtual audio driver and send
IOCTL to it?


> Hi Matt,
> The CreateFile( filename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
> did not work.
>
> I added the ioctl handler, but did not add create handler and close
handler.
> Would you please tell me why I need to add this two handler and how to
implement them?
>
> Thanks a lot.
>
>
>
> -----Original Message-----
> From: wdmaudiodev-bounce@xxxxxxxxxxxxx
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Matt Gonzalez
> Sent: Thursday, June 10, 2004 2:02 AM
> To: wdmaudiodev@xxxxxxxxxxxxx
> Subject: [wdmaudiodev] Re: How can I open my virtual audio driver and send
IOCTL to it?
>
>
> Did you also add a create handler, close handler, and ioctl handler to
> your major function table in DriverEntry?
>
> Matt
>
>
> Mathieu Routhier wrote:
>
> >It looks like you're doing it the right way.  Try calling CreateFile
> >with the following parameters instead:
> >
> >CreateFile(
> >filename
> >GENERIC_READ | GENERIC_WRITE,
> >FILE_SHARE_READ | FILE_SHARE_WRITE,
> >NULL,
> >OPEN_EXISTING,
> >FILE_ATTRIBUTE_NORMAL,
> >NULL);
> >
> >Mat
> >
> >-----Original Message-----
> >From: wdmaudiodev-bounce@xxxxxxxxxxxxx
> >[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of hollychen
> >(êø™Ô’=Ñаl)
> >Sent: Wednesday, June 09, 2004 12:35 PM
> >To: wdmaudiodev
> >Subject: [wdmaudiodev] How can I open my virtual audio driver and send
> >IOCTL to it?
> >
> >I'm a newbie in WDM. I wanna send IOCTL to my virtual audio driver, but
> >I failed to open my driver in user-mode application.
> >
> >In audio driver side, I registers an interface,
> >
> >AddDevice
> >(
> >IN  PDRIVER_OBJECT          DriverObject,
> >IN  PDEVICE_OBJECT          PhysicalDeviceObject
> >)
> >{
> >   ...
> >    ntStatus =
> >        PcAddAdapterDevice
> >        (
> >            DriverObject,
> >            PhysicalDeviceObject,
> >            PCPFNSTARTDEVICE(StartDevice),
> >            MAX_MINIPORTS,
> >            0
> >        );
> >    ...
> >    ntStatus = IoRegisterDeviceInterface(PhysicalDeviceObject,
> >&GUID_DEVINTERFACE_BT_AUDIO, NULL, &ifname);
> >    ...
> >   ntStatus = IoSetDeviceInterfaceState(&ifname, TRUE);
> >}
> >
> >
> >///////////////////////////////////////////////////////////////////////
> >/
> >////////////////////////////////////////////////
> >////////////////////////////////////////////////////////////////////////
> >////////////////////////////////////////////////
> >
> >In application side,
> >
> >HDEVINFO info = SetupDiGetClassDevs(&GUID_DEVINTERFACE_BT_AUDIO,
> >  NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
> > ...
> >if (SetupDiEnumDeviceInterfaces(info, NULL, &GUID_DEVINTERFACE_BT_AUDIO,
> >0, &ifdata))
> >{
> >  ...
> >  SetupDiGetDeviceInterfaceDetail(info, &ifdata, NULL, 0, &needed,
> >NULL);
> >
> >  PSP_INTERFACE_DEVICE_DETAIL_DATA detail =
> >(PSP_INTERFACE_DEVICE_DETAIL_DATA) malloc(needed);
> >  SP_DEVINFO_DATA did = {sizeof(SP_DEVINFO_DATA)};
> >  detail->cbSize = sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA);
> >
> >  if (!SetupDiGetDeviceInterfaceDetail(info, &ifdata, detail, needed,
> >NULL, &did))
> >  {  ...  }
> >  ...
> >  strcpy(fileName, detail->DevicePath);
> >  ...
> > }
> >
> > SetupDiDestroyDeviceInfoList(info);
> >
> >  ////////////////////////////////////////////////////
> >
> > HANDLE hdevice = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0,
> >NULL, OPEN_EXISTING, 0, NULL);
> >
> >The CreateFile() always return 2 (ERROR_FILE_NOT_FOUND).
> >
> >What's the problem with my code?
> >Any suggestions/hints will be much appreciated!
> >
> >Holly
> >
> >
> >******************
> >
> >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.de/
> >
> >
> >
>
> ******************
>
> 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.de/
> ******************
>
> 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.de/
>

******************

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

Other related posts: