[KERNEL32]
authorThomas Faber <thomas.faber@reactos.org>
Fri, 3 Aug 2012 06:38:44 +0000 (06:38 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Fri, 3 Aug 2012 06:38:44 +0000 (06:38 +0000)
- Sync FormatMessage implementation to Wine 1.5.4. Fixes crash in kernel32_winetest:format_msg.
See issue #7217 for more details.

svn path=/trunk/; revision=57031

reactos/dll/win32/kernel32/winnls/string/format_msg.c
reactos/media/doc/README.WINE

index a79dd5c..99a8b15 100644 (file)
@@ -70,7 +70,6 @@ struct format_args
  * Yes, ANSI strings in win32 resources. Go figure.
  */
 
-static const WCHAR PCNTFMTWSTR[] = { '%','%','%','s',0 };
 static const WCHAR FMTWSTR[] = { '%','s',0 };
 
 /**********************************************************************
@@ -138,15 +137,18 @@ static LPCWSTR format_insert( BOOL unicode_caller, int insert, LPCWSTR format,
     if (*format != '!')  /* simple string */
     {
         arg = get_arg( insert, flags, args );
-        if (unicode_caller)
+        if (unicode_caller || !arg)
         {
-            WCHAR *str = (WCHAR *)arg;
+            static const WCHAR nullW[] = {'(','n','u','l','l',')',0};
+            const WCHAR *str = (const WCHAR *)arg;
+
+            if (!str) str = nullW;
             *result = HeapAlloc( GetProcessHeap(), 0, (strlenW(str) + 1) * sizeof(WCHAR) );
             strcpyW( *result, str );
         }
         else
         {
-            char *str = (char *)arg;
+            const char *str = (const char *)arg;
             DWORD length = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
             *result = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) );
             MultiByteToWideChar( CP_ACP, 0, str, -1, *result, length );
index 7476271..d0cb0b7 100644 (file)
@@ -233,10 +233,19 @@ gdi32 -
   reactos/dll/win32/gdi32/objects/linedda.c     # Synced at 20090410
 
 kernel32 -
-  reactos/dll/win32/kernel32/misc/errormsg.c    # Out of sync
-  reactos/dll/win32/kernel32/misc/profile.c     # Out of sync
-  reactos/dll/win32/kernel32/misc/lcformat.c    # Synced to Wine-1_3
-  reactos/dll/win32/kernel32/misc/lzexpand.c    # Synced to Wine-1_1_23
+  reactos/dll/win32/kernel32/wine/actctx.c               # Partly synced
+  reactos/dll/win32/kernel32/wine/comm.c                 # Synced in r52754
+  reactos/dll/win32/kernel32/wine/lzexpand.c             # Synced in r52754
+  reactos/dll/win32/kernel32/wine/profile.c              # Synced in r52754
+  reactos/dll/win32/kernel32/wine/res.c                  # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/casemap.c     # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/chartype.c    # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/collation.c   # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/format_msg.c  # Synced to Wine-1.5.4
+  reactos/dll/win32/kernel32/winnls/string/lang.c        # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/lcformat.c    # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/nls.c         # Synced in r52754
+  reactos/dll/win32/kernel32/winnls/string/sortkey.c     # Synced in r52754
 
 msvcrt -
   reactos/lib/sdk/crt/except/cpp.c              # Synced at 20080528