I need to convert a UNICODE_STRING structure to a simple NULL TERMINATED STRING.
typedef
struct _UNICODE_STRING
{
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
}
UNICODE_STRING, *PUNICODE_STRING;
I can't find a clean sollution on MSDN about it. Anyone been there? I am not using .net so I need a native API sollution.
Thanks a lot!
From stackoverflow
-
Take a look at the answers, and even the question, here:
-
You should use WideCharToMultiByte. As an estimate for the output buffer size, you can use the Length field - but do consider the case of true multi-byte strings, in which case it will fail with ERROR_INSUFFICIENT_BUFFER, and you need to start over with a larger buffer. Or, you call it with an output buffer size of 0 first always, so it tells you the necessary size of the buffer.
0 comments:
Post a Comment