Hi,
I am trying to open my virtual bus drivers FDO from user land.
I have seen the toaster example where they have achieved communicating to
the FDO from user space. At the moment I am trying to write a simple program
that just executes create file, writes some data then reads data.
The problem I am hitting is working out what file name to use to open the
FDO. Can someone point me in the right direction?
Alex
If it has registered a device interface then the setupapi can be used to
enumerate those interfaces in luser-mode and find the appropriate names.
Otherwise your fdo has to create its own luser visible symbolic link for its
device object, using whatever naming convention you desire that manages to
avoid conflicts with everything else everyone else has done, and then you
open that name or those names in that namespace.
Mark Roddy
On Mon, Sep 13, 2010 at 11:22 AM, Alex Brown wrote:
> Hi,
>
> I am trying to open my virtual bus drivers FDO from user land.
>
> I have seen the toaster example where they have achieved communicating to
> the FDO from user space. At the moment I am trying to write a simple program
> that just executes create file, writes some data then reads data.
>
> The problem I am hitting is working out what file name to use to open the
> FDO. Can someone point me in the right direction?
>
> Alex
> — 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
If you have the toaster example with you look at
“\toaster\exe\toast\toast.c”.
On Mon, Sep 13, 2010 at 9:09 PM, Mark Roddy wrote:
> If it has registered a device interface then the setupapi can be used to
> enumerate those interfaces in luser-mode and find the appropriate names.
>
> Otherwise your fdo has to create its own luser visible symbolic link for
> its device object, using whatever naming convention you desire that manages
> to avoid conflicts with everything else everyone else has done, and then you
> open that name or those names in that namespace.
>
> Mark Roddy
>
>
> On Mon, Sep 13, 2010 at 11:22 AM, Alex Brown wrote:
>
>> Hi,
>>
>> I am trying to open my virtual bus drivers FDO from user land.
>>
>> I have seen the toaster example where they have achieved communicating to
>> the FDO from user space. At the moment I am trying to write a simple program
>> that just executes create file, writes some data then reads data.
>>
>> The problem I am hitting is working out what file name to use to open the
>> FDO. Can someone point me in the right direction?
>>
>> Alex
>> — 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
>
> Otherwise your fdo has to create its own luser visible symbolic link for its device object,
Not necessarily -as long as UM code uses ZwCreateFile() everything will be OK. However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP has to create a symbolic link to \DosDevices object directory, because Win32 layer will pre-pend ?? to the name specified by a caller, effectively limiting the name search to Dosdevices directory only…
Anton Bassov
Anton wrote:
However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP has
to create a symbolic link to \DosDevices object directory
But in the toaster example OP referring to the their is no symbolic link
created in the driver, but in the user mode app the DevicePath will be
obtained using the DeviceInterface registered in the driver, and this
Devicepath is used in CreateFile().
On Tue, Sep 14, 2010 at 10:16 AM, wrote:
> > Otherwise your fdo has to create its own luser visible symbolic link for
> its device object,
>
>
> Not necessarily -as long as UM code uses ZwCreateFile() everything will be
> OK. However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP
> has to create a symbolic link to \DosDevices object directory, because
> Win32 layer will pre-pend ?? to the name specified by a caller, effectively
> limiting the name search to Dosdevices directory only…
>
>
> Anton Bassov
>
> —
> 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
>
To be clear here on both points
-
A device interface *is* a symbolic link. It is just that you don’t control the name/format of the link
-
Yes, it is possible to call Zw/NtCreateFile, but it is not supported. Any msdn documentation on these functions are there due to the consent decree and these functions can change from release to release. The documented/supported way is to call CreateFile
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Dennis Scott
Sent: Monday, September 13, 2010 9:57 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Opening FDO from userpsace
Anton wrote:
However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP has to create a symbolic link to \DosDevices<file:> object directory
But in the toaster example OP referring to the their is no symbolic link created in the driver, but in the user mode app the DevicePath will be obtained using the DeviceInterface registered in the driver, and this Devicepath is used in CreateFile().
On Tue, Sep 14, 2010 at 10:16 AM, > wrote:
> Otherwise your fdo has to create its own luser visible symbolic link for its device object,
Not necessarily -as long as UM code uses ZwCreateFile() everything will be OK. However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP has to create a symbolic link to \DosDevices<file:> object directory, because Win32 layer will pre-pend ?? to the name specified by a caller, effectively limiting the name search to Dosdevices directory only…
Anton Bassov
—
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</file:></file:>
There is documentation on how to use CreateFile with interfaces; alas, it is
hard to find because it is under the badly-named SetupDi calls (which people
think have to do with setup and therefore could not apply to situations not
involving installers). A bit of searching in the MSDN will reveal how to
open a device interface without using [Zw/Nt]CreateFile. I’ve used this in
the past, so I know it exists. SetupDiGetDeviceInterfaceDetail gives the
file name to use for CreateFile. Also start with
http://msdn.microsoft.com/en-us/library/ff551069(v=VS.85).aspx and grovel
around a bit.
joe
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Tuesday, September 14, 2010 1:05 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Opening FDO from userpsace
To be clear here on both points
- A device interface *is* a symbolic link. It is just that you don’t
control the name/format of the link
- Yes, it is possible to call Zw/NtCreateFile, but it is not
supported. Any msdn documentation on these functions are there due to the
consent decree and these functions can change from release to release. The
documented/supported way is to call CreateFile
d
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Dennis Scott
Sent: Monday, September 13, 2010 9:57 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Opening FDO from userpsace
Anton wrote:
However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP has
to create a symbolic link to \DosDevices <file:> object
directory
But in the toaster example OP referring to the their is no symbolic link
created in the driver, but in the user mode app the DevicePath will be
obtained using the DeviceInterface registered in the driver, and this
Devicepath is used in CreateFile().
On Tue, Sep 14, 2010 at 10:16 AM, wrote:
> Otherwise your fdo has to create its own luser visible symbolic link for
its device object,
Not necessarily -as long as UM code uses ZwCreateFile() everything will be
OK. However, if it uses Win32 API(i.e. CreateFile()), then, indeed, the OP
has to create a symbolic link to \DosDevices <file:> object
directory, because Win32 layer will pre-pend ?? to the name specified by a
caller, effectively limiting the name search to Dosdevices directory
only…
Anton Bassov
—
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
–
This message has been scanned for viruses and
dangerous content by http:</http:> MailScanner, and is
believed to be clean.</file:></file:>