Is DispachCreate required for acceptingIOCTL's from user mode?

Hi all,

The basic question for USB device driver. Do I need DispactCreate in USB device driver to be able to take IOCTL’s from user app?

In, my situation I need USB device driver to be able to receive custom OCTL’s from user app and the send vendor specific Setup packets to USB device. Since this is Setup packets only to endpoint0 - this not a real data trafic (read/write) to device - only control actions. So I dont need the open pipes at all.

But my problem is that CreateFile() in user mode fails and I can’t get handle of device, subsequently can not send IOCTL’s. Ther Device enumerates ok, even symbloic link is retrievd. But CreateFile returns invalid handle - I think due to missing DispactCreate.

Does anybody knows how to send IOCTL’s in such situation?

Regards

Martin

Yes you need a handler for IRP_MJ_CREATE and IRP_MJ_CLOSE, without them the
user cannot get access to your device object.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Hi all,
>
> The basic question for USB device driver. Do I need DispactCreate in USB
> device driver to be able to take IOCTL’s from user app?
>
> In, my situation I need USB device driver to be able to receive custom
> OCTL’s from user app and the send vendor specific Setup packets to USB
> device. Since this is Setup packets only to endpoint0 - this not a real
> data trafic (read/write) to device - only control actions. So I dont need
> the open pipes at all.
>
> But my problem is that CreateFile() in user mode fails and I can’t get
> handle of device, subsequently can not send IOCTL’s. Ther Device
> enumerates ok, even symbloic link is retrievd. But CreateFile returns
> invalid handle - I think due to missing DispactCreate.
>
> Does anybody knows how to send IOCTL’s in such situation?
>
>
> Regards
>
> Martin
>
>
>

Ohh ok. Any tips what shoul I put in to DispachCreate handler? I need minimum.

Thanks a lot!

Martin

Try:

NTSTATUS CreateClose( __in PDEVICE_OBJECT DeviceObject, __in PIRP Irp )

{

Irp->IoStatus.Status = STATUS_SUCCESS;

Irp->IoStatus.Information = 0;

IoCompleteRequest( Irp, IO_NO_INCREMENT );

return STATUS_SUCCESS;

}

the above should be all you need. Note: I called the routine CreateClose
since the same code will suffice for both.


Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

wrote in message news:xxxxx@ntdev…
> Ohh ok. Any tips what shoul I put in to DispachCreate handler? I need
> minimum.
>
> Thanks a lot!
>
> Martin
>

Complete the irp with status success and return status success. The ddk
samples have boilerplate code for this.

----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Saturday, October 13, 2007 5:27 PM
Subject: RE:[ntdev] Is DispachCreate required for acceptingIOCTL’s from user
mode?

> Ohh ok. Any tips what shoul I put in to DispachCreate handler? I need
> minimum.
>
> Thanks a lot!
>
> Martin
>
> —
> 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 basic question for USB device driver. Do I need DispactCreate in USB

device driver to be able to take IOCTL’s from user app?

Yes.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com