Send a IOCTL to a specific driver

I need to send a IOCTL to a specific driver. I’m trying to use the ZwOpenFile() + ZwDeviceIoControlFile(), but I’m having trouble in the driver name (I’m using the “??\ServiceName”).

If this is your driver use the symbolic link name the driver created.
If it is not your driver get the OSR utility DeviceTree
http://www.osronline.com/article.cfm?article=97 and find the name.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@gmail.com” wrote in message
news:xxxxx@ntdev:

> I need to send a IOCTL to a specific driver. I’m trying to use the ZwOpenFile() + ZwDeviceIoControlFile(), but I’m having trouble in the driver name (I’m using the “??\ServiceName”).

Please anyone have any tips for me?

s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Wed, Mar 16, 2011 at 3:42 PM, Thiago Fabre wrote:

> The driver is mine, but I can’t found a name that open the driver. I’m
> sending attached a photo of devicetree
>
>
> s,
> Thiago Fabre
> UNESP / Bauru
> (14) 91096114
>
>
>
> On Wed, Mar 16, 2011 at 12:05 PM, Don Burn wrote:
>
>> If this is your driver use the symbolic link name the driver created. If
>> it is not your driver get the OSR utility DeviceTree
>> http://www.osronline.com/article.cfm?article=97 and find the name.
>>
>>
>> Don Burn (MVP, Windows DKD)
>> Windows Filesystem and Driver Consulting
>> Website: http://www.windrvr.com
>> Blog: http://msmvps.com/blogs/WinDrvr
>>
>>
>>
>>
>> “xxxxx@gmail.com” wrote in message
>> news:xxxxx@ntdev:
>>
>>
>> I need to send a IOCTL to a specific driver. I’m trying to use the
>>> ZwOpenFile() + ZwDeviceIoControlFile(), but I’m having trouble in the driver
>>> name (I’m using the “??\ServiceName”).
>>>
>>
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>

And precisely what have you tried? “\\.\servicename”? Did you escape the "" in your first attempt such that it looked like “\??\servicename” in your source?

Is this your drivers? If so have you considered a interface between the two drivers, and attaching one driver to another? That way you can ignore the ZwXxxx calls and simply call your interface function.

Gary G. Little

----- Original Message -----
From: “Thiago Fabre”
To: “Windows System Software Devs Interest List”
Sent: Thursday, March 17, 2011 6:14:04 AM
Subject: Re: [ntdev] Send a IOCTL to a specific driver

Please anyone have any tips for me ?

s, Thiago Fabre
UNESP / Bauru
(14) 91096114

On Wed, Mar 16, 2011 at 3:42 PM, Thiago Fabre < xxxxx@gmail.com > wrote:

The driver is mine, but I can’t found a name that open the driver. I 'm sending attached a photo of devicetree

s, Thiago Fabre
UNESP / Bauru
(14) 91096114

On Wed, Mar 16, 2011 at 12:05 PM, Don Burn < xxxxx@acm.org > wrote:

If this is your driver use the symbolic link name the driver created. If it is not your driver get the OSR utility DeviceTree http://www.osronline.com/article.cfm?article=97 and find the name.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

" xxxxx@gmail.com " < xxxxx@gmail.com > wrote in message news:xxxxx@ntdev:

I need to send a IOCTL to a specific driver. I’m trying to use the ZwOpenFile() + ZwDeviceIoControlFile(), but I’m having trouble in the driver name (I’m using the “??\ServiceName”).


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The driver is mine, but I can’t found a name (in the devicetree) that open the driver. Where do I find this symbolic link?

Yes, I tried to use \??\servicename, but it did not work. I did not understand how I can make this interface, and this communication must be during system boot.

ps: My drivers are a upper disk filter and a SCSIAdapter (virtual disk)

Uh … it’s your driver and you DON’T know the driver name? If you created a symbolic name it should be in front of you in your own source. Did you create a symbolic name? Unless you got really silly in naming your driver, that is IF you named it, it’s usually the name of the SYS file.

Gary G. Little

----- Original Message -----
From: “thiago fabre”
To: “Windows System Software Devs Interest List”
Sent: Thursday, March 17, 2011 6:20:54 AM
Subject: RE:[ntdev] Send a IOCTL to a specific driver

The driver is mine, but I can’t found a name (in the devicetree) that open the driver. Where do I find this symbolic link?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I know the driver name, but I do not understand why I can not open using “\??\serviceName”. I tested with other drivers that I have here, and it works.

Do you create a symbolic name for the driver using WdfDeviceCreateSymbolicLink? How about IoCreateSymbolicLink?

Gary G. Little

----- Original Message -----
From: “thiago fabre”
To: “Windows System Software Devs Interest List”
Sent: Thursday, March 17, 2011 6:48:25 AM
Subject: RE:[ntdev] Send a IOCTL to a specific driver

I know the driver name, but I do not understand why I can not open using “\??\serviceName”. I tested with other drivers that I have here, and it works.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

No, I’ll try this.

Thanks
s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Thu, Mar 17, 2011 at 9:03 AM, Gary G. Little wrote:

> Do you create a symbolic name for the driver using
> WdfDeviceCreateSymbolicLink? How about IoCreateSymbolicLink?
>
>
> Gary G. Little
>
> ----- Original Message -----
> From: “thiago fabre”
> To: “Windows System Software Devs Interest List”
> Sent: Thursday, March 17, 2011 6:48:25 AM
> Subject: RE:[ntdev] Send a IOCTL to a specific driver
>
> I know the driver name, but I do not understand why I can not open using
> “\??\serviceName”. I tested with other drivers that I have here, and it
> works.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

With the symbolic link, I can open with ZwOpenFile, but when I send the
IOCTL, ZwDeviceIoControlFile returns ERROR.

The definition of IOCTL is correct?

*#define IOCTL_VDBUS_LOCALCACHE *
* CTL_CODE(FILE_DEVICE_UNKNOWN, 0x208 , METHOD_BUFFERED, FILE_READ_DATA |
FILE_WRITE_DATA)*
*
*
s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Thu, Mar 17, 2011 at 9:21 AM, Thiago Fabre wrote:

> No, I’ll try this.
>
> Thanks
>
> s,
> Thiago Fabre
> UNESP / Bauru
> (14) 91096114
>
>
> On Thu, Mar 17, 2011 at 9:03 AM, Gary G. Little wrote:
>
>> Do you create a symbolic name for the driver using
>> WdfDeviceCreateSymbolicLink? How about IoCreateSymbolicLink?
>>
>>
>> Gary G. Little
>>
>> ----- Original Message -----
>> From: “thiago fabre”
>> To: “Windows System Software Devs Interest List”
>> Sent: Thursday, March 17, 2011 6:48:25 AM
>> Subject: RE:[ntdev] Send a IOCTL to a specific driver
>>
>> I know the driver name, but I do not understand why I can not open using
>> “\??\serviceName”. I tested with other drivers that I have here, and it
>> works.
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>> —
>> NTDEV is sponsored by OSR
>>
>> For our schedule of WDF, WDM, debugging and other seminars visit:
>> http://www.osr.com/seminars
>>
>> To unsubscribe, visit the List Server section of OSR Online at
>> http://www.osronline.com/page.cfm?name=ListServer
>>
>
>

What specific ntstatus value? Are you sending to the filter or the miniport?

d

dent from a phine with no keynoard


From: Thiago Fabre
Sent: Thursday, March 17, 2011 6:00 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Send a IOCTL to a specific driver

With the symbolic link, I can open with ZwOpenFile, but when I send the IOCTL, ZwDeviceIoControlFile returns ERROR.

The definition of IOCTL is correct?

#define IOCTL_VDBUS_LOCALCACHE \
CTL_CODE(FILE_DEVICE_UNKNOWN, 0x208 , METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)

s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Thu, Mar 17, 2011 at 9:21 AM, Thiago Fabre > wrote:
No, I’ll try this.

Thanks

s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Thu, Mar 17, 2011 at 9:03 AM, Gary G. Little > wrote:
Do you create a symbolic name for the driver using WdfDeviceCreateSymbolicLink? How about IoCreateSymbolicLink?

Gary G. Little

----- Original Message -----
From: “thiago fabre” >
To: “Windows System Software Devs Interest List” >
Sent: Thursday, March 17, 2011 6:48:25 AM
Subject: RE:[ntdev] Send a IOCTL to a specific driver

I know the driver name, but I do not understand why I can not open using “\??\serviceName”. I tested with other drivers that I have here, and it works.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I’m sending to the miniport (SCSIApadter)

s,
Thiago Fabre
UNESP / Bauru
(14) 91096114

On Thu, Mar 17, 2011 at 11:41 AM, Doron Holan wrote:

> What specific ntstatus value? Are you sending to the filter or the
> miniport?
>
> d
>
> dent from a phine with no keynoard
> ------------------------------
> From: Thiago Fabre
> Sent: Thursday, March 17, 2011 6:00 AM
>
> To: Windows System Software Devs Interest List
> Subject: Re: [ntdev] Send a IOCTL to a specific driver
>
> With the symbolic link, I can open with ZwOpenFile, but when I send the
> IOCTL, ZwDeviceIoControlFile returns ERROR.
>
> The definition of IOCTL is correct?
>
> *#define IOCTL_VDBUS_LOCALCACHE *
> CTL_CODE(FILE_DEVICE_UNKNOWN, 0x208 , METHOD_BUFFERED, FILE_READ_DATA |
> FILE_WRITE_DATA)

> *
> *
> s,
> Thiago Fabre
> UNESP / Bauru
> (14) 91096114
>
>
> On Thu, Mar 17, 2011 at 9:21 AM, Thiago Fabre wrote:
>
>> No, I’ll try this.
>>
>> Thanks
>>
>> s,
>> Thiago Fabre
>> UNESP / Bauru
>> (14) 91096114
>>
>>
>> On Thu, Mar 17, 2011 at 9:03 AM, Gary G. Little wrote:
>>
>>> Do you create a symbolic name for the driver using
>>> WdfDeviceCreateSymbolicLink? How about IoCreateSymbolicLink?
>>>
>>>
>>> Gary G. Little
>>>
>>> ----- Original Message -----
>>> From: “thiago fabre”
>>> To: “Windows System Software Devs Interest List”
>>> Sent: Thursday, March 17, 2011 6:48:25 AM
>>> Subject: RE:[ntdev] Send a IOCTL to a specific driver
>>>
>>> I know the driver name, but I do not understand why I can not open
>>> using “\??\serviceName”. I tested with other drivers that I have here, and
>>> it works.
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>> —
>>> NTDEV is sponsored by OSR
>>>
>>> For our schedule of WDF, WDM, debugging and other seminars visit:
>>> http://www.osr.com/seminars
>>>
>>> To unsubscribe, visit the List Server section of OSR Online at
>>> http://www.osronline.com/page.cfm?name=ListServer
>>>
>>
>>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Because of some reason I don’t know, I can’t send the IOCTL to the miniport using ZwDeviceIoControlFile. So I sent down using IoBuildDeviceIoControlRequest, and it worked perfectly

Many thanks…