DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260

It is a UNICODE string, so you’re printing the first character.
One solution is to convert the string temporarily to ANSI.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.

Use “%ws”. It’s a UNICODE_STRING, which means it’s WCHARs.

Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Use (“%wZ”, RegistryPath). %wZ is for PUNICODE_STRING variable.

(“%ws”, RegistryPath->Buffer) will also work in most cases but can be
dangerous because %ws if for zero terminated wide character string and
Buffer may not be zero terminated always.

Best regards,

Michal Vodicka
Veridicom
(RKK - Skytale)
[WWW: http://www.veridicom.com , http://www.skytale.com]


From:
xxxxx@exgate.tek.com[SMTP:xxxxx@exgate.tek.com]
Reply To: NT Developers Interest List
Sent: Friday, September 08, 2000 02:21
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
am
not sure if this is the true value of RegistryPath. Can anybody explain
that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260


You are currently subscribed to ntdev as: xxxxx@rkk.cz
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Here’s another variation that accounts for missing NULL termination:

DbgPrint( “RegistryPath: \042%*.*ws\042\n”,
RegistryPath->Length/sizeof( wchar_t ),
RegistryPath->Length/sizeof( wchar_t ),
RegistryPath->Buffer
);

Thomas F. Divine

PCAUSA - Toolkits & Resources For Network Software Developers
NDIS Protocol - TDI Client - Windows 95 Redirector
http:

----- Original Message -----
From: Vodicka, Michal
To: NT Developers Interest List
Sent: Thursday, September 07, 2000 9:21 PM
Subject: [ntdev] RE: DriverEntry

> Use (“%wZ”, RegistryPath). %wZ is for PUNICODE_STRING variable.
>
> (“%ws”, RegistryPath->Buffer) will also work in most cases but can be
> dangerous because %ws if for zero terminated wide character string and
> Buffer may not be zero terminated always.
>
> Best regards,
>
> Michal Vodicka
> Veridicom
> (RKK - Skytale)
> [WWW: http://www.veridicom.com , http://www.skytale.com]
>
>
>
> > ----------
> > From:
> > xxxxx@exgate.tek.com[SMTP:xxxxx@exgate.tek.com]
> > Reply To: NT Developers Interest List
> > Sent: Friday, September 08, 2000 02:21
> > To: NT Developers Interest List
> > Subject: [ntdev] DriverEntry
> >
> > Hi, I am a little confused about 2 parameters in DriverEntry routine.
Does
> > somebody know what exactly these parameters refer to? For example, which
> > file or directory does RegistryPath point to? I try to print it out
using
> > KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
> > am
> > not sure if this is the true value of RegistryPath. Can anybody explain
> > that
> > for me? Thanks.
> >
> > Z.S.Wang
> > ==================================
> > Zhongsheng Wang
> > P. O. Box 500, M/S 50-480
> > Beaverton, OR 97077
> > Email: xxxxx@tek.com
> > Phone: (503) 627-5260
> > ==================================
> ></http:>

I don’t see ‘w’ in the format specification docs, though ‘l’ seems to
do what you imply. However, UNICODE_STRINGs are not (necessarily)
NULL-terminated, so you need to pay attention to the Length field to
be safe.


Dave Cox
Hewlett-Packard Co.
HPSO/SSMO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Barila, Phil [mailto:xxxxx@intel.com]
Sent: Thursday, September 07, 2000 5:51 PM
To: NT Developers Interest List
Subject: [ntdev] RE: DriverEntry

Use “%ws”. It’s a UNICODE_STRING, which means it’s WCHARs.

Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Another solution for printing UNICODE_STRINGs in general is

KdPrint((“%.*S\n”, string->Length/sizeof(WCHAR), string->Buffer));


Dave Cox
Hewlett-Packard Co.
HPSO/SSMO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Paul Bunn [mailto:xxxxx@ultrabac.com]
Sent: Thursday, September 07, 2000 5:40 PM
To: NT Developers Interest List
Subject: [ntdev] RE: DriverEntry

It is a UNICODE string, so you’re printing the first character.
One solution is to convert the string temporarily to ANSI.

Regards,

Paul Bunn, UltraBac.com, 425-644-6000
Microsoft MVP - WindowsNT/2000
http://www.ultrabac.com

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Well, depending on where you look, there are several different specifiers.
%S is also a WCHAR specifier.

Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: COX,DAVID (HP-Roseville,ex1) [mailto:david_cox2@hp.com]
Sent: Thursday, September 07, 2000 6:14 PM
To: NT Developers Interest List
Subject: [ntdev] RE: DriverEntry

I don’t see ‘w’ in the format specification docs, though ‘l’ seems to
do what you imply. However, UNICODE_STRINGs are not (necessarily)
NULL-terminated, so you need to pay attention to the Length field to
be safe.


Dave Cox
Hewlett-Packard Co.
HPSO/SSMO (Santa Barbara)
https://ecardfile.com/id/Dave+Cox

-----Original Message-----
From: Barila, Phil [mailto:xxxxx@intel.com]
Sent: Thursday, September 07, 2000 5:51 PM
To: NT Developers Interest List
Subject: [ntdev] RE: DriverEntry

Use “%ws”. It’s a UNICODE_STRING, which means it’s WCHARs.

Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I am
not sure if this is the true value of RegistryPath. Can anybody explain that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: david_cox2@hp.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

There are four types of string:

  1. NULL-terminated string (ANSI, OEM)
    type PCHAR
  2. NULL-terminated UNICODE string
    type PWCHAR
  3. Counted string (ANSI, OEM)
    type STRING
  4. Counted UNICODE string
    type UNICODE_STRING

For DbgPrint (or macro KdPrint) - which is like printf - the following
formats should be used (expected type of argument):

  1. %s (PCHAR)
  2. %ws (PWCHAR)
  3. %Z (PSTRING)
  4. %wZ (PUNICODE_STRING)

In fact %Z and %wZ are not documented in the official documentation,
but you can find them in CRT source file for _output().
Microsoft uses them for eg. in NTOSKRNL for both debug prints and
buffer prints ([v]s[n]printf) when some of the argument is counted
string.

Paul

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Barila, Phil
Sent: Friday, September 08, 2000 1:51 AM
To: NT Developers Interest List
Subject: [ntdev] RE: DriverEntry

Use “%ws”. It’s a UNICODE_STRING, which means it’s WCHARs.

Phil
* Philip D. Barila | (503) 264-8386
* Intel Corp. | Not speaking for Intel

-----Original Message-----
From: xxxxx@exgate.tek.com
[mailto:xxxxx@exgate.tek.com]
Sent: Thursday, September 07, 2000 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] DriverEntry

Hi, I am a little confused about 2 parameters in DriverEntry routine.
Does
somebody know what exactly these parameters refer to? For example, which
file or directory does RegistryPath point to? I try to print it out
using
KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
am
not sure if this is the true value of RegistryPath. Can anybody explain
that
for me? Thanks.

Z.S.Wang

Zhongsheng Wang
P. O. Box 500, M/S 50-480
Beaverton, OR 97077
Email: xxxxx@tek.com
Phone: (503) 627-5260


You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)


You are currently subscribed to ntdev as: xxxxx@compelson.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

KdPrint((“String: %wZ”, &RegistryPath);

----- Original Message -----
From:
To: NT Developers Interest List
Sent: Thursday, September 07, 2000 5:21 PM
Subject: [ntdev] DriverEntry

> Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
> somebody know what exactly these parameters refer to? For example, which
> file or directory does RegistryPath point to? I try to print it out using
> KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
am
> not sure if this is the true value of RegistryPath. Can anybody explain
that
> for me? Thanks.
>
> Z.S.Wang
> ==================================
> Zhongsheng Wang
> P. O. Box 500, M/S 50-480
> Beaverton, OR 97077
> Email: xxxxx@tek.com
> Phone: (503) 627-5260
> ==================================
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)

%wZ handles UNICODE strings

----- Original Message -----
From: Paul Bunn
To: NT Developers Interest List
Sent: Thursday, September 07, 2000 5:39 PM
Subject: [ntdev] RE: DriverEntry

> It is a UNICODE string, so you’re printing the first character.
> One solution is to convert the string temporarily to ANSI.
>
> Regards,
>
> Paul Bunn, UltraBac.com, 425-644-6000
> Microsoft MVP - WindowsNT/2000
> http://www.ultrabac.com
>
>
> -----Original Message-----
> From: xxxxx@exgate.tek.com
> [mailto:xxxxx@exgate.tek.com]
> Sent: Thursday, September 07, 2000 5:21 PM
> To: NT Developers Interest List
> Subject: [ntdev] DriverEntry
>
>
> Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
> somebody know what exactly these parameters refer to? For example, which
> file or directory does RegistryPath point to? I try to print it out using
> KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
am
> not sure if this is the true value of RegistryPath. Can anybody explain
that
> for me? Thanks.
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)

This is only if the stirng in NULL terminated; which it is not most of the
time. Use %wZ and pass a pointer to the unicode string structure.

jamey

----- Original Message -----
From: Barila, Phil
To: NT Developers Interest List
Sent: Thursday, September 07, 2000 5:50 PM
Subject: [ntdev] RE: DriverEntry

> Use “%ws”. It’s a UNICODE_STRING, which means it’s WCHARs.
>
> Phil
> * Philip D. Barila | (503) 264-8386
> * Intel Corp. | Not speaking for Intel
>
>
> -----Original Message-----
> From: xxxxx@exgate.tek.com
> [mailto:xxxxx@exgate.tek.com]
> Sent: Thursday, September 07, 2000 5:21 PM
> To: NT Developers Interest List
> Subject: [ntdev] DriverEntry
>
>
> Hi, I am a little confused about 2 parameters in DriverEntry routine. Does
> somebody know what exactly these parameters refer to? For example, which
> file or directory does RegistryPath point to? I try to print it out using
> KdPrint((“%s”,RegistryPath->Buffer). I just get a slash symbol "". So I
am
> not sure if this is the true value of RegistryPath. Can anybody explain
that
> for me? Thanks.
>
> Z.S.Wang
> ==================================
> Zhongsheng Wang
> P. O. Box 500, M/S 50-480
> Beaverton, OR 97077
> Email: xxxxx@tek.com
> Phone: (503) 627-5260
> ==================================
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@intel.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to $subst(‘Email.Unsub’)