Hello,
I think I know your problem. I have faced this problem
before.
Basically the DDK documentation of DestinationString
parameter in RtlUnicodeStringToAnsiString is
confusing.
The DDK documentation says
"DestinationString
Points to a caller-allocated buffer for the ANSI
string or is NULL if AllocateDestinationString is set
to TRUE. If the translation cannot be done because a
character in the Unicode string does not map to an
ANSI character in the current system locale, an error
is returned. "
From the documentation it looks like if
AllocateDestinationString is TRUE, you can pass NULL
for this parameter. However you need to pass valid
PANSI_STRING parameter to this with Buffer member set
to NULL.
So, in your case,
If you set AllocateDestinationString to TRUE, make
sure that you do memset(&FileNameAnsi, 0,
sizeof(FileNameAnsi)) before that.
If you set AllocateDestinationString to FALSE, make
sure that you allocate sufficient size buffer to hold
ansi string content and intialize FileNameAnsi
accordingly
Hope this helps.
-Prasad
-----Original Message-----
From: cts mad [mailto:xxxxx@yahoo.com]
Sent: Thursday, June 07, 2001 4:36 AM
To: NT Developers Interest List
Subject: [ntdev] RtlUnicodeStringToAnsiString
hi all,
does RtlUnicodeStringToAnsiString work …
i have tried it several times and with both the
TRUE
and the FALSE arguments ( for destination string
allocation ) but it not only fails but gives me a
page
fault … due to this the machine immediately
reboots.
the code is like this
ANSI_STRING FileNameAnsi;
UNICODE_STRING FileNameUnicode;
RtlUnicodeStringToAnsiString( &FileNameAnsi ,
&FileNameUnicode , TRUE ) ; // this didnt work
and
RtlUnicodeStringToAnsiString( &FileNameAnsi ,
&FileNameUnicode , FALSE ) ; // this didnt work too
please gimme some ideas on this…
– Thank you so much
– Harshal
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail -
only $35
a year! http://personal.mail.yahoo.com/
You are currently subscribed to ntdev as:
xxxxx@broadstor.com
To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
You are currently subscribed to ntdev as:
xxxxx@yahoo.com
To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
=====
Prasad S. Dabak
Chief Software Architect
Ensim India Private Limited
http://www.ensim.com
Co-author of the book “Undocumented Windows NT”
ISBN 0764545698
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.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