converting PCHAR to PWCHAR

This undocumented one is a little less “annoying”. Why is it
undocumented?

Beverly

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, April 27, 2006 7:03 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] converting PCHAR to PWCHAR

Didn’t think so. I can’t recommend to folks to use a function that
undocumented where the documented function is just as easy to use.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lyndon J. Clarke
Sent: Thursday, April 27, 2006 3:14 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] converting PCHAR to PWCHAR

5365 nope

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Is RtlCreateUnicodeStringFromAsciiz doc’ed in the WDK? It certainly is
not doc’ed in the currently released DDK.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alex Ionescu
[397670]
Sent: Thursday, April 27, 2006 10:54 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] converting PCHAR to PWCHAR

Peter Wieland wrote:
> Or, if you want to take the “annoying” route:
>
>
> PCHAR stringPointer = “USA”;
> ANSI_STRING ansiString;
> UNICODE_STRING unicodeString;
> NTSTATUS status;
>
> RtlInitAnsiString(&ansiString, stringPointer); status =
> RtlAnsiStringToUnicodeString(&unicodeString,
> &ansiString, TRUE);
>
> if (NT_SUCCESS(status))
> {
>
> RtlFreeUnicodeString(&unicodeString);
> }
>
>
> Wait - how is that annoying? It seems pretty simple to me.
>
> -p
>
Here’s a little improvement:

PCHAR StringPointer = “USA”;
UNICODE_STRING UnicodeString;
NTSTATUS Status;

Status = RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
StringPointer);
if (NT_SUCCESS(Status))
{

RtlFreeUnicodeString(&UnicodeString);
}


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

I have no idea.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Brown, Beverly
Sent: Thursday, April 27, 2006 7:35 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] converting PCHAR to PWCHAR

This undocumented one is a little less “annoying”. Why is it
undocumented?

Beverly

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Thursday, April 27, 2006 7:03 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] converting PCHAR to PWCHAR

Didn’t think so. I can’t recommend to folks to use a function that
undocumented where the documented function is just as easy to use.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lyndon J. Clarke
Sent: Thursday, April 27, 2006 3:14 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] converting PCHAR to PWCHAR

5365 nope

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Is RtlCreateUnicodeStringFromAsciiz doc’ed in the WDK? It certainly is
not doc’ed in the currently released DDK.

d

– I can spell, I just can’t type.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Alex Ionescu
[397670]
Sent: Thursday, April 27, 2006 10:54 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] converting PCHAR to PWCHAR

Peter Wieland wrote:
> Or, if you want to take the “annoying” route:
>
>
> PCHAR stringPointer = “USA”;
> ANSI_STRING ansiString;
> UNICODE_STRING unicodeString;
> NTSTATUS status;
>
> RtlInitAnsiString(&ansiString, stringPointer); status =
> RtlAnsiStringToUnicodeString(&unicodeString,
> &ansiString, TRUE);
>
> if (NT_SUCCESS(status))
> {
>
> RtlFreeUnicodeString(&unicodeString);
> }
>
>
> Wait - how is that annoying? It seems pretty simple to me.
>
> -p
>
Here’s a little improvement:

PCHAR StringPointer = “USA”;
UNICODE_STRING UnicodeString;
NTSTATUS Status;

Status = RtlCreateUnicodeStringFromAsciiz(&UnicodeString,
StringPointer);
if (NT_SUCCESS(Status))
{

RtlFreeUnicodeString(&UnicodeString);
}


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

alex,

thanks for the great tip…

RtlCreateUnicodeStringFromAsciiz

wow…documented or not, it is really less annoying :slight_smile: