[wdmaudiodev] Re: Problem getting MSVAD driver handle

  • From: Robert Bielik <robert.bielik@xxxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Thu, 15 Jul 2010 16:02:08 +0200

Jan M skrev:
pwszBuffer now points to my driver HWID.

 From here, how do I get a handle I can use with DeviceIoControl() ?

Use CreateFile:

HANLDE hHandle = CreateFile(
           pwszBuffer,
           GENERIC_READ | GENERIC_WRITE,
           0,
           NULL,
           OPEN_EXISTING,
           FILE_ATTRIBUTE_NORMAL,
           NULL);

With this handle, DeviceIoControl will be synchronous (and you pass NULL for 
its OVERLAPPED ptr). If you
add FILE_FLAG_OVERLAPPED to param 6, you'll need to hand over an OVERLAPPED ptr 
to DeviceIoControl when
sending requests, and DeviceIoControl will be asynchronous.


... there is already a
well-defined mechanism for sending custom requests to KS drivers.

What is the well-defined mechanism for sending custom requests to KS drivers?

I reckon it would be DeviceIoControl, but you use your own custom structs to 
pass data to/from the driver (haven't done
it myself yet though...)

Regards,
/Rob
******************

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: