oleview: Fix a string resource so its format placeholders can be reordered.

Francois Gouget fgouget at free.fr
Sat Nov 19 08:11:54 CST 2011


---
 programs/oleview/oleview.rc |    2 +-
 programs/oleview/typelib.c  |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/programs/oleview/oleview.rc b/programs/oleview/oleview.rc
index d5d7507..5619a21 100644
--- a/programs/oleview/oleview.rc
+++ b/programs/oleview/oleview.rc
@@ -145,7 +145,7 @@ STRINGTABLE
     IDS_FALSE,             "False"
     IDS_BYTES,             "bytes"
 
-    IDS_ERROR_LOADTYPELIB, "LoadTypeLib( %s ) failed ($%x)"
+    IDS_ERROR_LOADTYPELIB, "LoadTypeLib( %1 ) failed ($%2!x!)"
     IDS_INHERITINTERFACES, "Inherited Interfaces"
 }
 
diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c
index b28dd90..21e9d96 100644
--- a/programs/oleview/typelib.c
+++ b/programs/oleview/typelib.c
@@ -1198,10 +1198,14 @@ static int PopulateTree(void)
     {
         WCHAR wszMessage[MAX_LOAD_STRING];
         WCHAR wszError[MAX_LOAD_STRING];
+        DWORD_PTR args[2];
 
         LoadStringW(globals.hMainInst, IDS_ERROR_LOADTYPELIB,
                 wszError, sizeof(wszError)/sizeof(wszError[0]));
-        wsprintfW(wszMessage, wszError, typelib.wszFileName, hRes);
+        args[0] = (DWORD_PTR)typelib.wszFileName;
+        args[1] = hRes;
+        FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
+                       wszError, 0, 0, wszMessage, sizeof(wszMessage)/sizeof(*wszMessage), (__ms_va_list*)args);
         MessageBoxW(globals.hMainWnd, wszMessage, NULL, MB_OK|MB_ICONEXCLAMATION);
         return 1;
     }
-- 
1.7.7.1




More information about the wine-patches mailing list