confusion over using rtl functions

hi friends,
i am having a little confusion over using Rtl
String functions.
uptil now the way i used Rtl conversion functions
was like this:
I wud declare a array of wide chars and then a
variable of UNICODE_STRING.I wud then make the address
of the UnicodeString.Buffer = chars>.This way i would allocate memory for the Buffer
field of the UNICODE_STRING.
but now i need to dynamically allocate the memory
for the UNICODE_STRING.
the trouble is,
which kind of memory i shud allocate NONPAGED or
PAGED? I will be using the function ExAllocatePool.

Please clear my confusion.
– Thank you
– Harshal

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

You may be making things harder on yourself than you need to. If you are
only converting from ANSI_STRING to UNICODE_STRING, you don’t need to do
your own allocation at all. You can use RtlAnsiStringToUnicodeString() and
tell it to allocate memory for you. Just remember to call
RtlFreeUnicodeString() when you don’t need it anymore.

However, if you are making a space in which to do some string manipulation,
such as concatenation or replacement, then you do, indeed, need to allocate
your space using ExAllocatePool(), although you should really be calling
ExAllocatePoolWithTag() instead. If you are saving the UNICODE_STRING to
use later at any IRQL above DISPATCH_LEVEL, you *must* use NonPagedPool. If
you are passing the buffer to any function that assumes a null-terminated
string, then you need to allocate the additional space for the UNICODE_NULL.

Phil

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Rock
Sent: Friday, September 07, 2001 8:14 AM
To: NT Developers Interest List
Subject: [ntdev] confusion over using rtl functions

hi friends,
i am having a little confusion over using Rtl
String functions.
uptil now the way i used Rtl conversion functions
was like this:
I wud declare a array of wide chars and then a
variable of UNICODE_STRING.I wud then make the address
of the UnicodeString.Buffer = chars>.This way i would allocate memory for the Buffer
field of the UNICODE_STRING.
but now i need to dynamically allocate the memory
for the UNICODE_STRING.
the trouble is,
which kind of memory i shud allocate NONPAGED or
PAGED? I will be using the function ExAllocatePool.

Please clear my confusion.
– Thank you
– Harshal

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: xxxxx@europa.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> which kind of memory i shud allocate NONPAGED or

PAGED? I will be using the function ExAllocatePool.

It depends on - in what context do you plan to use this string. Usually,
strings are not used on >= DISPATCH_LEVEL - thus, PagedPool is OK.

Max


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com