Am I wrong or is this a bug ?
Trying to do
DebugPrint(“%ws”, pwcharBuff)
gives me some “???[” output.
Thanks.
Am I wrong or is this a bug ?
Trying to do
DebugPrint(“%ws”, pwcharBuff)
gives me some “???[” output.
Thanks.
And how did you format pwcharBuff?
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@yahoo.com
Sent: Wednesday, September 26, 2007 11:41 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] DebugPrint with WCHAR
Am I wrong or is this a bug ?
Trying to do
DebugPrint(“%ws”, pwcharBuff)
gives me some “???[” output.
Thanks.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Actually, this is a continuation from my IoGetDeviceProperty() in a diskperf code.
So the actual DebugPrint is the DebugPrint in diskperf code.
my pwcharBuff is fine. Doing
wcscmp(pwcharBuff, L"Volume") returns 0
So I just want to check out in debugprint the value of my WCHAR variables. By default in diskperf code, these error occurs.
DebugPrint for diskperf is defined as:
#define DebugPrint(x) DiskPerfDebugPrint x
i.e.
VOID DiskPerfDebugPrint( ULONG DebugPrintLevel, PCCHAR DebugMessage, … )
therefore, calling convention is:
if you call DbgPrint(“%ws”, pwszString ) it will work without any problems.
wrote in message news:xxxxx@ntdev…
> Actually, this is a continuation from my IoGetDeviceProperty() in a
> diskperf code.
>
> So the actual DebugPrint is the DebugPrint in diskperf code.
>
> my pwcharBuff is fine. Doing
> wcscmp(pwcharBuff, L"Volume") returns 0
>
> So I just want to check out in debugprint the value of my WCHAR variables.
> By default in diskperf code, these error occurs.
>
>
>
Yep yep. I was just pointing out the original DbgPrint().
What my code really is
DebugPrint((2, “DevName= %ws”, pwcharBuffer));
K here’s a code sample.
PWCHAR wDeviceObjectNamebuffer = NULL;
ULONG ulbufferLength = 0;
PAGED_CODE();
status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyPhysicalDeviceObjectName,
0,
NULL,
&ulbufferLength
);
wDeviceObjectNamebuffer = ExAllocatePool (PagedPool, ulbufferLength);
if (NULL == wDeviceObjectNamebuffer) {
return STATUS_INSUFFICIENT_RESOURCES;
}
status = IoGetDeviceProperty(PhysicalDeviceObject,
DevicePropertyClassName,
ulbufferLength,
wDeviceObjectNamebuffer,
&ulbufferLength
);
DebugPrint((2, “DiskPerfAddDevice: Type %ws Driver %X Device %X\n”,
wDeviceObjectNamebuffer,
DriverObject,
PhysicalDeviceObject));
which shows in debugview as…
DiskPerfAddDevice: Type ??? Driver F7A8E48C Device F76F4193
xxxxx@yahoo.com wrote:
DebugPrint((2, “DiskPerfAddDevice: Type %ws Driver %X Device %X\n”,
wDeviceObjectNamebuffer,
DriverObject,
PhysicalDeviceObject));
which shows in debugview as…
DiskPerfAddDevice: Type ??? Driver F7A8E48C Device F76F4193
Does DbgPrint support the %ws specifier? I *know* it handles %S.
Although if it were a char/wchar confusion, you should only see one letter.
Have you tried printing the first word in hex to see if it really has
what you expect?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
I thought the format specifies was %ls to force WCHAR and %hs to force CHAR
interpretation?
David R. Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Wednesday, September 26, 2007 4:00 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DebugPrint with WCHAR
xxxxx@yahoo.com wrote:
DebugPrint((2, “DiskPerfAddDevice: Type %ws Driver %X Device %X\n”,
wDeviceObjectNamebuffer,
DriverObject,
PhysicalDeviceObject));
which shows in debugview as…
DiskPerfAddDevice: Type ??? Driver F7A8E48C Device F76F4193
Does DbgPrint support the %ws specifier? I *know* it handles %S.
Although if it were a char/wchar confusion, you should only see one letter.
Have you tried printing the first word in hex to see if it really has what
you expect?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
I don’t know about %ws or %ls, but, I agree with Tim - %S works, with the usual caveats about IRQL.
mm
Actually, at least in the past %ls or %ws or %S worked. There have been
comments in the sources for a long time that %ws was obsolete, so maybe
somebody decided to act.
–
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply
“David R. Cattley” wrote in message news:xxxxx@ntdev…
I thought the format specifies was %ls to force WCHAR and %hs to force CHAR
interpretation?
David R. Cattley
Consulting Engineer
Systems Software Development
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tim Roberts
Sent: Wednesday, September 26, 2007 4:00 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] DebugPrint with WCHAR
xxxxx@yahoo.com wrote:
> DebugPrint((2, “DiskPerfAddDevice: Type %ws Driver %X Device %X\n”,
> wDeviceObjectNamebuffer,
> DriverObject,
> PhysicalDeviceObject));
>
> ----------------
>
> which shows in debugview as…
>
> DiskPerfAddDevice: Type ??? Driver F7A8E48C Device F76F4193
>
Does DbgPrint support the %ws specifier? I know it handles %S.
Although if it were a char/wchar confusion, you should only see one letter.
Have you tried printing the first word in hex to see if it really has what
you expect?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
—
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
%ls, %ws, %S failed on me. This code is in AddDevice() portion.
Is there a better way to know what’s actually in my “wDeviceObjectNamebuffer”?
doing wcscmp() did return an actual result.
I’m on a pitfall here, still starting in ntdev but debugprint is failing me
Use the debugger. I don’t know of any command to dump UNICODE, although there probably is, but just db it and decode.
mm
The du command dumps wide strings.> Date: Wed, 26 Sep 2007 17:38:03 -0400> From: xxxxx@evitechnology.com> To: xxxxx@lists.osr.com> Subject: RE:[ntdev] DebugPrint with WCHAR> > Use the debugger. I don’t know of any command to dump UNICODE, although there probably is, but just db it and decode.> > mm > > —> NTDEV is sponsored by OSR> > For our schedule of WDF, WDM, debugging and other seminars visit: > http://www.osr.com/seminars\> > To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE
I use RtlStringCchPrintfA to generate my dbgPrint strings without any
problem. I never tried to use the Unicode function, though. Have you tried
to convert Unicode to Ascii and use the Ascii Rtl functions ? It only takes
three or four Rtl calls.
Alberto.
----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Wednesday, September 26, 2007 4:47 PM
Subject: RE:[ntdev] DebugPrint with WCHAR
> %ls, %ws, %S failed on me. This code is in AddDevice() portion.
>
> Is there a better way to know what’s actually in my
> “wDeviceObjectNamebuffer”?
>
> doing wcscmp() did return an actual result.
>
> I’m on a pitfall here, still starting in ntdev but debugprint is failing
> me
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer