From: RamenWarrior on
I am trying to rewrite some code that relies on IoWriteErrorLogEntry using
the newer function StorportLogSystemEvent. Most of the parameters seem to
line up nicely but I am wondering about the string manipulations.

How can I access the RTL unicode functions from my storport driver? When I
include wdm.h I encounter a slew of redefinition errors so obviously there is
a conflict. I hope I won't need to create and test my own versions of these
functions.

Is there any sample code available that uses StorportLogSystemEvent? I did
see the slides from WinHEC but they were a little sparse.
From: Don Burn on
For a standard storport the Unicode string functions are not available,
but for a log entry they are rarely needed. If you need to pass a
constant UNICODE_STRING emulate the RTL_CONSTANT_STRING string macro from
the WDK. Mostly people use the message compiler to put together the
equivalent of the format string of a printf and then have the individual
args as needed.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr




> -----Original Message-----
> From: RamenWarrior [mailto:RamenWarrior(a)nospam.nospam]
> Posted At: Wednesday, March 17, 2010 1:20 PM
> Posted To: microsoft.public.development.device.drivers
> Conversation: How to work with StorportLogSystemEvent
> Subject: How to work with StorportLogSystemEvent
>
> I am trying to rewrite some code that relies on IoWriteErrorLogEntry
> using the
> newer function StorportLogSystemEvent. Most of the parameters seem to
> line up
> nicely but I am wondering about the string manipulations.
>
> How can I access the RTL unicode functions from my storport driver? When
> I
> include wdm.h I encounter a slew of redefinition errors so obviously
> there is
> a conflict. I hope I won't need to create and test my own versions of
> these
> functions.
>
> Is there any sample code available that uses StorportLogSystemEvent? I
> did see
> the slides from WinHEC but they were a little sparse.
>
>
> __________ Information from ESET Smart Security, version of virus
> signature
> database 4952 (20100317) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>

From: RamenWarrior on
I thought the data type PWSTR implied that all string were in Unicode format.
Are you saying I can ignore that assumption and use standard strings?


"Don Burn" wrote:

> For a standard storport the Unicode string functions are not available,
> but for a log entry they are rarely needed. If you need to pass a
> constant UNICODE_STRING emulate the RTL_CONSTANT_STRING string macro from
> the WDK. Mostly people use the message compiler to put together the
> equivalent of the format string of a printf and then have the individual
> args as needed.
>
>
> Don Burn (MVP, Windows DKD)
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>

From: Don Burn on
From the documentation:

StringList

The list of null-terminated Unicode strings to be appended to the log
entry for use in string substitution. These strings are substituted for
the place holders ā€œ%2ā€ through ā€œ%nā€ in the log message text when the log
entry is being displayed. This list consists of an array of pointers to
the null-terminated Unicode strings. StringCount contains the count of
string pointers in this array, so no list termination entry is needed. If
no strings are to be written, StringCount should be set to 0, and this
field is ignored.

Yes PWSTR is wide character null terminated strings.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr





> -----Original Message-----
> From: RamenWarrior [mailto:RamenWarrior(a)nospam.nospam]
> Posted At: Wednesday, March 17, 2010 4:49 PM
> Posted To: microsoft.public.development.device.drivers
> Conversation: How to work with StorportLogSystemEvent
> Subject: RE: How to work with StorportLogSystemEvent
>
> I thought the data type PWSTR implied that all string were in Unicode
> format.
> Are you saying I can ignore that assumption and use standard strings?
>
>
> "Don Burn" wrote:
>
> > For a standard storport the Unicode string functions are not
> > available, but for a log entry they are rarely needed. If you need to
> > pass a constant UNICODE_STRING emulate the RTL_CONSTANT_STRING string
> > macro from the WDK. Mostly people use the message compiler to put
> > together the equivalent of the format string of a printf and then have
> > the individual args as needed.
> >
> >
> > Don Burn (MVP, Windows DKD)
> > Windows Filesystem and Driver Consulting
> > Website: http://www.windrvr.com
> > Blog: http://msmvps.com/blogs/WinDrvr
> >
>
>
> __________ Information from ESET Smart Security, version of virus
> signature
> database 4953 (20100317) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>

From: RamenWarrior on
I have a few more questions related to using the message compiler. I started
reading about creating a manifest and was led here:
http://msdn.microsoft.com/en-us/library/aa468726.aspx (Adding Event Tracing
to Kernel-Mode drivers).

While this document was helpful it was clearly intended for general device
drivers and not the storport special case. I assume that I won't need to use
EtwXXXX functions to manipulate the manifest. However as someone who has
never used the message compiler I wish there was more documentation specific
to storport driver writing.

"RamenWarrior" wrote:

> I thought the data type PWSTR implied that all string were in Unicode format.
> Are you saying I can ignore that assumption and use standard strings?
>
>
> "Don Burn" wrote:
>
> > For a standard storport the Unicode string functions are not available,
> > but for a log entry they are rarely needed. If you need to pass a
> > constant UNICODE_STRING emulate the RTL_CONSTANT_STRING string macro from
> > the WDK. Mostly people use the message compiler to put together the
> > equivalent of the format string of a printf and then have the individual
> > args as needed.
> >
> >
> > Don Burn (MVP, Windows DKD)
> > Windows Filesystem and Driver Consulting
> > Website: http://www.windrvr.com
> > Blog: http://msmvps.com/blogs/WinDrvr
> >
>