- simplified BasepAnsiStringToHeapUnicodeString
- fixed linking (global variable Basep8BitStringToUnicodeString was missing)
- fixed typo in the debug print in SetThreadUILanguage
Modified: trunk/reactos/lib/kernel32/misc/utils.c
Modified: trunk/reactos/lib/kernel32/thread/thread.c

Modified: trunk/reactos/lib/kernel32/misc/utils.c
--- trunk/reactos/lib/kernel32/misc/utils.c	2005-07-29 23:01:16 UTC (rev 16885)
+++ trunk/reactos/lib/kernel32/misc/utils.c	2005-07-29 23:03:12 UTC (rev 16886)
@@ -13,6 +13,10 @@
 #define NDEBUG
 #include "../include/debug.h"
 
+/* GLOBALS ******************************************************************/
+
+PRTL_CONVERT_STRING Basep8BitStringToUnicodeString;
+
 /* FUNCTIONS ****************************************************************/
 
 /*
@@ -73,8 +77,8 @@
     return StaticString;
 }
 
-NTSTATUS
-STDCALL
+NTSTATUS
+STDCALL
 Basep8BitStringToHeapUnicodeString(OUT PUNICODE_STRING UnicodeString,
                                    IN LPCSTR String)
 {
@@ -104,7 +108,7 @@
 VOID
 STDCALL
 BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString,
-                                   IN LPWSTR* UnicodeString)
+                                   OUT LPWSTR* UnicodeString)
 {
     ANSI_STRING AnsiTemp;
     UNICODE_STRING UnicodeTemp;
@@ -114,17 +118,16 @@
     /* First create the ANSI_STRING */
     RtlInitAnsiString(&AnsiTemp, AnsiString);
     
-    /* Now get the size needed */
-    UnicodeTemp.MaximumLength = RtlAnsiStringToUnicodeSize(&AnsiTemp);
-    
-    /* Allocate space from the Heap for the string */
-    *UnicodeString = RtlAllocateHeap(GetProcessHeap(),
-                                    0,
-                                    UnicodeTemp.MaximumLength);
-                                    
-    /* Save the buffer and convert */
-    UnicodeTemp.Buffer = *UnicodeString;
-    RtlAnsiStringToUnicodeString(&UnicodeTemp, &AnsiTemp, FALSE);
+    if (NT_SUCCESS(RtlAnsiStringToUnicodeString(&UnicodeTemp,
+                                                &AnsiTemp,
+                                                TRUE)))
+    {
+        *UnicodeString = UnicodeTemp.Buffer;
+    }
+    else
+    {
+        *UnicodeString = NULL;
+    }
 }
 
 /*

Modified: trunk/reactos/lib/kernel32/thread/thread.c
--- trunk/reactos/lib/kernel32/thread/thread.c	2005-07-29 23:01:16 UTC (rev 16885)
+++ trunk/reactos/lib/kernel32/thread/thread.c	2005-07-29 23:03:12 UTC (rev 16886)
@@ -739,7 +739,7 @@
 LANGID STDCALL
 SetThreadUILanguage(WORD wReserved)
 {
-  DPRINT1("SetThreadUILanguage(0x%2x) unimplemented!\n", wReserved);
+  DPRINT1("SetThreadUILanguage(0x%4x) unimplemented!\n", wReserved);
   return 0;
 }