I’ve found a VERY strange behavior of the PcRegisterSubdevice function.
Instead of copying a Name string argument, it just saves its address.
If the Name string is dynamically generated as a stack variable,
PcRegisterSubdevice returns successfully but after returning from
DriverEntry portcls.sys generates a PF in interface name comparison while
processing IRP_MJ_CREATE.
MS documentation says nothing about such behavior. I found no information
about this in the net. Maybe there are some other system functions like
PcRegisterSubdevice? Does somebody know them?
–
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
No, thankfully I don’t. I got bitten by that one as well, and of course
solved it by using globals. I think this was reported in the WDMAUDIODEV
archive (go to www.freelists.org to subscribe). That group is devoted to
WDM audio.
Philip Lukidis
-----Original Message-----
From: Eugene Muzychenko [mailto:xxxxx@muzychenko.net]
Sent: Friday, May 06, 2005 11:03 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] PcRegisterSubdevice requires a “fixed” string in Name
I’ve found a VERY strange behavior of the PcRegisterSubdevice function.
Instead of copying a Name string argument, it just saves its address.
If the Name string is dynamically generated as a stack variable,
PcRegisterSubdevice returns successfully but after returning from
DriverEntry portcls.sys generates a PF in interface name comparison while
processing IRP_MJ_CREATE.
MS documentation says nothing about such behavior. I found no information
about this in the net. Maybe there are some other system functions like
PcRegisterSubdevice? Does somebody know them?
–
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@guillemot.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
While I can see that it’s annoying that the documentation doesn’t say that
this is the expected behaviour, I can’t see, now that you’ve figured out
how it behaves, that you can’t fix it trivially by either using a global
(static) string variable, or allocating space in a suitable pool (paged or
non-paged).
There are certainly a bunch of functions in windows kernel mode calls that
“use” the address of the data passed in, and storing that for future
reference. it should of course be documented so that the developer using
these functions can use them correctly, and not use space allocated on the
stack for those parameters.
–
Mats
xxxxx@lists.osr.com wrote on 05/06/2005 04:02:52 PM:
I’ve found a VERY strange behavior of the PcRegisterSubdevice function.
Instead of copying a Name string argument, it just saves its address.
If the Name string is dynamically generated as a stack variable,
PcRegisterSubdevice returns successfully but after returning from
DriverEntry portcls.sys generates a PF in interface name comparison while
processing IRP_MJ_CREATE.
MS documentation says nothing about such behavior. I found no information
about this in the net. Maybe there are some other system functions like
PcRegisterSubdevice? Does somebody know them?
–
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
Questions? First check the Kernel Driver FAQ at http://www.
osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@3dlabs.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
ForwardSourceID:NT0001278E
On Fri, 6 May 2005 16:14:48 +0100, Mats PETERSSON
wrote:
> There are certainly a bunch of functions in windows kernel mode calls
> that “use” the address of the data passed in, and storing that for future
> reference.
I’m really surprised by that because I know no other function using a
STRING such way.
–
Using Opera’s revolutionary e-mail client: http://www.opera.com/mail/
Eugene / Philip,
At the DDC, they strongly encouraged us to use the “send feedback on this
page” link at the bottom of each DDK help file page to report problems in
the docs. It’s “hidden” under the copyright message, so it’s easy to miss.
If you let them know about this restriction, they can add it to the docs for
the next DDK release.
-Dan
----- Original Message -----
Subject: RE: PcRegisterSubdevice requires a “fixed” string in Name
From: Philip Lukidis
> Date: Fri, 6 May 2005 10:59:44 -0400
> X-Message-Number: 11
>
> No, thankfully I don’t. I got bitten by that one as well, and of course
> solved it by using globals. I think this was reported in the WDMAUDIODEV
> archive (go to www.freelists.org to subscribe). That group is devoted to
> WDM audio.
>
> Philip Lukidis
>
>
> -----Original Message-----
> From: Eugene Muzychenko [mailto:xxxxx@muzychenko.net]
> Sent: Friday, May 06, 2005 11:03 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] PcRegisterSubdevice requires a “fixed” string in Name
>
>
> I’ve found a VERY strange behavior of the PcRegisterSubdevice function.
>
> Instead of copying a Name string argument, it just saves its address.
>
> If the Name string is dynamically generated as a stack variable,
> PcRegisterSubdevice returns successfully but after returning from
> DriverEntry portcls.sys generates a PF in interface name comparison while
> processing IRP_MJ_CREATE.
>
> MS documentation says nothing about such behavior. I found no information
> about this in the net. Maybe there are some other system functions like
> PcRegisterSubdevice? Does somebody know them?