"Francois Gouget" fgouget@free.fr wrote:
Wine cannot use Unicode strings literals. When you write L"YES" this is a 32bit Unicode string, not a 16bit unicode string. This means that when you pass it to lstrcmpiW, which expects 16bit Unicode strings like all the APIs in Wine, what it sees is this: "Y\0E\0S\0\0\0". And this is obviously different from "YES".
I guess it pays to check the warnings form time to time!
Sure. Why not to change L'\0' to a simple 0 in your patch then?
@@ -447,10 +451,10 @@ switch (type) { case REG_SZ: data[9] = L'\0'; /* set end of string */ ^^^^^^^^^^^^^^^
-- Dmitry.
On Thu, 1 Nov 2001, Dmitry Timoshkov wrote:
"Francois Gouget" fgouget@free.fr wrote:
Wine cannot use Unicode strings literals. When you write L"YES" this is a 32bit Unicode string, not a 16bit unicode string. This means that when you pass it to lstrcmpiW, which expects 16bit Unicode strings like all the APIs in Wine, what it sees is this: "Y\0E\0S\0\0\0". And this is obviously different from "YES".
I guess it pays to check the warnings form time to time!
Sure. Why not to change L'\0' to a simple 0 in your patch then?
@@ -447,10 +451,10 @@ switch (type) { case REG_SZ: data[9] = L'\0'; /* set end of string */ ^^^^^^^^^^^^^^^
Because this is not so bad: L'\0' will give us a 32bit unicode character which is equivalent to an (unsigned)0. The C compiler will then automatically cast it into an (unsigned short), i.e. the WCHAR we wanted. No harm done. And no warning either.
Besides a 0 or a '\0' is no more correct, it is still not a 16bit unicode character. It just goes through a slightly different (and shorter) series of automatic conversions.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Linux: the choice of a GNU generation