In a WDM miniport audio driver, I am trying to handle custom IOCTL by
registering a customer interface (using IoRegisterDeviceInterface),
enumerating it via SetupDiXXX functions in user mode and using
CreateFile to open it.

Registration and enumeration all goes well (I verified this via
WinDbg, registry and WinObj).

However, CreateFile() fails with error code 2 (ERROR_FILE_NOT_FOUND).

When examining the custom CreateHandler that intercepts the
IRP_MJ_CREATE call, I was surprised to find out that pIoStackLocation-
>FileObject->FileName.Buffer is NULL.

Why? What would make it NULL?

I thought that it should contain PSP_INTERFACE_DEVICE_DETAIL_DATA's
DevicePath that was passed to CreateFile as the first parameter and
contained fully valid (and verified) symbolic link name:

"\\?\root#media#0000#{GUID-generated-by-GuidGen}"

Any clue to how to even start debugging something like this?

Thanks,
Don

Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Doron

Doron
Mon Apr 16 00:44:44 CDT 2007

the path you mention below is the symbolic link to your device. since the
i/o manager understands how to parse this string, it strips it from the
FileName. The I/O manager will leave any parts of the string that it does
not understand. To get a buffer in FileName to differentiate
functions/functionality, specify a reference string in your call to
IoRegisterDeviceInterfce.

read http://blogs.msdn.com/doronh/archive/2006/08/18/706717.aspx for more
info

d


--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


<0dbell@gmail.com> wrote in message
news:1176700234.863329.286620@n76g2000hsh.googlegroups.com...
> In a WDM miniport audio driver, I am trying to handle custom IOCTL by
> registering a customer interface (using IoRegisterDeviceInterface),
> enumerating it via SetupDiXXX functions in user mode and using
> CreateFile to open it.
>
> Registration and enumeration all goes well (I verified this via
> WinDbg, registry and WinObj).
>
> However, CreateFile() fails with error code 2 (ERROR_FILE_NOT_FOUND).
>
> When examining the custom CreateHandler that intercepts the
> IRP_MJ_CREATE call, I was surprised to find out that pIoStackLocation-
>>FileObject->FileName.Buffer is NULL.
>
> Why? What would make it NULL?
>
> I thought that it should contain PSP_INTERFACE_DEVICE_DETAIL_DATA's
> DevicePath that was passed to CreateFile as the first parameter and
> contained fully valid (and verified) symbolic link name:
>
> "\\?\root#media#0000#{GUID-generated-by-GuidGen}"
>
> Any clue to how to even start debugging something like this?
>
> Thanks,
> Don
>



Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by 0dbell

0dbell
Mon Apr 16 08:55:41 CDT 2007

On Apr 16, 12:44 am, "Doron Holan [MS]" <dor...@nospam.microsoft.com>
wrote:
> the path you mention below is the symbolic link to your device. since the
> i/o manager understands how to parse this string, it strips it from the
> FileName. The I/O manager will leave any parts of the string that it does
> not understand. To get a buffer in FileName to differentiate
> functions/functionality, specify a reference string in your call to
> IoRegisterDeviceInterfce.
>
> readhttp://blogs.msdn.com/doronh/archive/2006/08/18/706717.aspxfor more
> info
>

Doron, you are king! This was exactly my problem - and you helped me
solve it. I wish I knew earlier about the existence of your blog.
Thank you so much!!!

BTW, the prepended backslash was no surprise to me, but what I still
don't understand is the various rules according to which the case
(i.e. lower/upper) of these identifiers is handled. In my particular
case I was puzzled to see that pIoStackLocation->FileObject-
>FileName.Buffer contains a lower case version of the reference string
that I passed to IoRegisterDeviceInterface(). Who converted it? and
why?

Thanks,
Don


Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Maxim

Maxim
Mon Apr 16 11:08:01 CDT 2007

> When examining the custom CreateHandler that intercepts the
> IRP_MJ_CREATE call, I was surprised to find out that pIoStackLocation-
> >FileObject->FileName.Buffer is NULL.

This is OK. FileName will be non-NULL only if you have a device interface
reference string (it will be this string).

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


Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Alexander

Alexander
Mon Apr 16 11:10:12 CDT 2007


<0dbell@gmail.com> wrote in message
news:1176731741.311537.284980@q75g2000hsh.googlegroups.com...
> On Apr 16, 12:44 am, "Doron Holan [MS]" <dor...@nospam.microsoft.com>
>
> BTW, the prepended backslash was no surprise to me, but what I still
> don't understand is the various rules according to which the case
> (i.e. lower/upper) of these identifiers is handled. In my particular
> case I was puzzled to see that pIoStackLocation->FileObject-
>>FileName.Buffer contains a lower case version of the reference string
> that I passed to IoRegisterDeviceInterface(). Who converted it? and
> why?
>
> Thanks,
> Don
>

There are some programmers (at MS and other places) who think they need to
mangle ("prettify") file names as they go through their wonderful code, for
some uncomprehensible reasons. One example of such software is SourceSafe.
Another example is Visual C 7+ MFC class wizard. "Prettifying" usually
consists of lowercasing it. I think those programmers just need to get a
life.



Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Doron

Doron
Tue Apr 17 00:52:30 CDT 2007

this has nothing to do with pretty.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:%23h%23wPQEgHHA.668@TK2MSFTNGP05.phx.gbl...
>
> <0dbell@gmail.com> wrote in message
> news:1176731741.311537.284980@q75g2000hsh.googlegroups.com...
>> On Apr 16, 12:44 am, "Doron Holan [MS]" <dor...@nospam.microsoft.com>
>>
>> BTW, the prepended backslash was no surprise to me, but what I still
>> don't understand is the various rules according to which the case
>> (i.e. lower/upper) of these identifiers is handled. In my particular
>> case I was puzzled to see that pIoStackLocation->FileObject-
>>>FileName.Buffer contains a lower case version of the reference string
>> that I passed to IoRegisterDeviceInterface(). Who converted it? and
>> why?
>>
>> Thanks,
>> Don
>>
>
> There are some programmers (at MS and other places) who think they need to
> mangle ("prettify") file names as they go through their wonderful code,
> for some uncomprehensible reasons. One example of such software is
> SourceSafe. Another example is Visual C 7+ MFC class wizard. "Prettifying"
> usually consists of lowercasing it. I think those programmers just need to
> get a life.
>
>



Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Doron

Doron
Tue Apr 17 00:53:00 CDT 2007

The file name is case insensitive. Perhaps setupapi is putting the name
into lower case.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


<0dbell@gmail.com> wrote in message
news:1176731741.311537.284980@q75g2000hsh.googlegroups.com...
> On Apr 16, 12:44 am, "Doron Holan [MS]" <dor...@nospam.microsoft.com>
> wrote:
>> the path you mention below is the symbolic link to your device. since
>> the
>> i/o manager understands how to parse this string, it strips it from the
>> FileName. The I/O manager will leave any parts of the string that it
>> does
>> not understand. To get a buffer in FileName to differentiate
>> functions/functionality, specify a reference string in your call to
>> IoRegisterDeviceInterfce.
>>
>> readhttp://blogs.msdn.com/doronh/archive/2006/08/18/706717.aspxfor more
>> info
>>
>
> Doron, you are king! This was exactly my problem - and you helped me
> solve it. I wish I knew earlier about the existence of your blog.
> Thank you so much!!!
>
> BTW, the prepended backslash was no surprise to me, but what I still
> don't understand is the various rules according to which the case
> (i.e. lower/upper) of these identifiers is handled. In my particular
> case I was puzzled to see that pIoStackLocation->FileObject-
>>FileName.Buffer contains a lower case version of the reference string
> that I passed to IoRegisterDeviceInterface(). Who converted it? and
> why?
>
> Thanks,
> Don
>



Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Alexander

Alexander
Tue Apr 17 15:50:32 CDT 2007

This is how some in MS understand "pretty" (from SDK):

PathMakePretty Function

Converts a path to all lowercase characters to give the path a consistent
appearance.


"Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
news:%23ukqXSLgHHA.4064@TK2MSFTNGP03.phx.gbl...
> this has nothing to do with pretty.
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>


Re: What would NULLIFY pIoStackLocation->FileObject->FileName.Buffer ??? by Doron

Doron
Wed Apr 18 00:36:42 CDT 2007

well, that is UM. this has nothign to do with it

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"Alexander Grigoriev" <alegr@earthlink.net> wrote in message
news:OJFQQITgHHA.4368@TK2MSFTNGP03.phx.gbl...
> This is how some in MS understand "pretty" (from SDK):
>
> PathMakePretty Function
>
> Converts a path to all lowercase characters to give the path a consistent
> appearance.
>
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:%23ukqXSLgHHA.4064@TK2MSFTNGP03.phx.gbl...
>> this has nothing to do with pretty.
>>
>> d
>>
>> --
>> Please do not send e-mail directly to this alias. this alias is for
>> newsgroup purposes only.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>