I wanted something similar to print an IP Address in dotted notation.
If I used a macro the WPP used to choke saying not enough parameters.
How do I print a IP address which is in network byte order?. Right now I
have to do this every time I want to print an IP.
-Srin.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Henry
Gabryjelski
Sent: Wednesday, February 04, 2004 9:29 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] ETW?
So many questions, so little time. Here’s a few quick answers.
- From tools\WppConfig\rev1\defaultwpp.ini:
DEFINE_FLAVOR(STATUS, UINT, ItemNTSTATUS, “s”);
This means you can convert to the ETW-only form “%!STATUS!”
where you previously dumped the hex code, and you’ll get a
pretty-printed string. (I don’t understand the problem with %08x?)
-
It’s not much work to write, makes driver writing easier,
and is fully in the templates ETW uses. This is just icing
if they do it. The hard part will be testing all the
configurations.
-
Good feedback. I’ll let the doc writers know this is what
you really wanted to see when trying to enable debugging.
.
-----Original Message-----
From: Rob Green [mailto:xxxxx@cdp.com]
Sent: Tuesday, February 03, 2004 11:43 AM
Subject: RE: ETW?
See inline
Thanks,
Rob
> 2) I believe the format string %08x would work if you were passing a
> non-pointer. ETW is more exacting about matching types,
which I found
> to be a nice side benefit. It also will complain if you don’t have
> enough arguments for the given format string, which caught me a few
> times.
Yes I meant only when displaying pointers.
Another problem with this regard is displaying NTSTATUS
codes… I am currently using %08x which will work for 32
bit, but not 64 bit. Is there a handy % for it?
I also have found bugs where there was not enough args, which
is handy (and contributed to at least one bsod when running
debug on a customer machine).
>
> (what is “%-*.*s” supposed to do?)
>
It is used to display a length specified string (such as a
Unicode string that isn’t formatted as Unicode (otherwise use
%wZ). For example IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME
has a field where they specify the length of the string and
then the buffer. It should only display what is there and it
is not null terminated. So instead of copying into a
separate buffer and initing a unicode string, I do this:
Debug(DEBUG_DEVCON,
(“SuggestedLinkName: %d, %d: ‘%-*.*ws’\n”,
Link->UseOnlyIfThereAreNoOtherLinks,
Link->NameLength,
Link->NameLength/2,
Link->NameLength/2,
Link->Name));
I currently have it commented out since converting to ETW.
You should be able to look up format specs in the VC help.
> 5) This is great feedback. I personally didn’t realize the
problem of
> *requiring* the WXP method of enabling tracing. I can imagine a
> method to work around this, I’ll see if I can convince the
trace guys
> that its worthwhile. As an added bonus, it won’t require new
kernel/os changes.
As I said, it didn’t really affect me as a new binary was
needed anyway.
I just needed to get the WXP way working for ia32 first, then
I got the
W2k working, then 64bit, and specify in the SOURCES which one I want
built for each platform. I wouldn’t spend much time on this though as
why support the w2k way on a brand new platform?
> 6) logman.exe, which uses different syntax than tracelog,
is shipped
> in XP and higher. It’s also available for download, IIRC.
I haven’t
> dealt with auto-enabling traces in the app/driver, but I’ll
pass along
> that more docs are required for this.
>
The hardest part was figuring out how to fill in the event trace
properties structure. All the docs had info on how to enable existing
OS tracing (such as net, disk, kernel, etc…) and not how to enable
your own event provider.
Looking at the docs for logman I don’t see how it is much
different from
tracelog. What I mean is that both of them are complicated
and seem to
provide the same functionality. For my purposes, I just say “Enable
debug”
and then have the customer replicate the problem, then say “Disable
debug”
and then have them email me the .ETL file.
I also don’t see how to enable logging for the next boot. I
don’t need
logging in my DriverEntry but do in my AddDevice and StartDevice
routines.
> 6b) I also do the same thing regarding having a compile-time switch
> for use DebugPrint. It’s more work in SOURCES and you need to wrap
> the init/unint/.TMH inclusion, but overall I’ve found it to be
workable.
>
Yes, I had to do all of that, but I found I like this
solution the best.
It is something I am comfortable with for every day debugging, and not
so much of pain for debugging customer issues.
> I’ll pass you comments to the tracing team, see if they’re able to
> make it better.
Also, all my files are .cpp which requires wrapping the .tmh
file around
and extern c like so
#ifdef RUN_WPP
extern “C” {
#include “devcon.tmh”
}
#endif
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256