Can anybody suggest that is it ok to initialize a string in driver entry and then refer it any callback routines?
Why i am asking this is becoz Driver Entry is usualy marked with pragma INIT which mean that it can be discarded. Does this mean that all the strings initialized in DriverEntry will become invalid in case it is discarded.
In case the strings initialized in DriverEntry can become invalid what is the right way to initialize a string to keep it valid during the lifetime of a driver?
thanks
Sandeep
The string will be in a data section, DriverEntry is in a code section so
there is no problem. If these are counted constant strings such as done by
RtlInitString or RtlInitUnicodeString consider instead using
RTL_CONSTANT_STRING to initialize the value, of a global string. It always
gets to me that Microsoft flags strlen as bad, but these RtlInit…
functions are just a strlen with some wrapper code.
–
Don Burn (MVP, Windows DDK)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
wrote in message news:xxxxx@ntfsd…
> Can anybody suggest that is it ok to initialize a string in driver entry
> and then refer it any callback routines?
> Why i am asking this is becoz Driver Entry is usualy marked with pragma
> INIT which mean that it can be discarded. Does this mean that all the
> strings initialized in DriverEntry will become invalid in case it is
> discarded.
>
> In case the strings initialized in DriverEntry can become invalid what is
> the right way to initialize a string to keep it valid during the lifetime
> of a driver?
>
> thanks
> Sandeep
>
>
> Information from ESET NOD32 Antivirus, version of virus
> signature database 4100 (20090525)
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
Information from ESET NOD32 Antivirus, version of virus signature database 4100 (20090525)
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com