How do I detect Win2k or NT and how do I convert from Unicode to Ansi / Ansi to Unicode ? :confused:
Posted on 2001-03-01 08:29:00 by KetilO
To detect NT/2k, use GetVersionEx. To convert to and from unicode/ansi use: MultiByteToWideChar and WideCharToMultiByte. You could also, of course, do it manually by expanding byte characters into words and vice versa if you are only dealing with ascii characters (ascii characters map directly to 0-255 unicode). When working with unicode strings, be sure to remember that a null terminated wide character array is not actually a UNICODE_STRING in the strict sense. A UNICODE_STRING is a datatype that holds the string with the size, maximum size, and pointer to the wide character array. Tootaloo, Jeremy
Posted on 2001-03-01 08:41:00 by jcollake
I've never run across the UNICODE_STRING structure before. But yep, it's in the newer editions of MSDN. Leave it to microsoft to use the same term for two different things. A unicode string and a wide character string are the same things, basically words replace bytes, and for ascii (code page zero), they map together 1 to 1. A UNICODE_STRING is as described, seems like an expansion of the BSTR concept. But, if the API function you are using asks for a wzs or a wide char or wchar_t string, it wants a lower case unicode string (not the structured kind).
Posted on 2001-03-01 17:18:00 by Ernie
Some functions that seemed to be undocumented were actually documented in the DDKs. (Pietrek mentions this in some of his writings.) I believe that UNICODE_STRING has been a part of NT driver software since NT's beginnings.
Posted on 2001-03-02 17:54:00 by tank
Thank you for your help. My app now also runs on Win2k.
Posted on 2001-03-05 05:05:00 by KetilO