shlwapi: Duplicate shell32.ShellMessageBoxW implementation in shlwapi.ShellMessageBoxWrapW

Dmitry Timoshkov dmitry at codeweavers.com
Tue Sep 4 02:54:35 CDT 2007


Hello,

as Alexandre pointed out we can't really forward shlwapi.ShellMessageBoxWrapW
to shell32.ShellMessageBoxW, we need to duplicate its implementation.

Changelog:
    shlwapi: Duplicate shell32.ShellMessageBoxW implementation in
    shlwapi.ShellMessageBoxWrapW.

---
 dlls/shell32/shell32.spec |    4 +-
 dlls/shell32/shellord.c   |    6 +++++
 dlls/shlwapi/ordinal.c    |   53 ++++++++++++++++++++++++++++++--------------
 dlls/shlwapi/shlwapi.spec |    2 +-
 4 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec
index 5d47e3d..9beb6d3 100644
--- a/dlls/shell32/shell32.spec
+++ b/dlls/shell32/shell32.spec
@@ -170,8 +170,8 @@
  179 stdcall -noname SHGetNewLinkInfoA(str str ptr long long)
  180 stdcall -noname SHGetNewLinkInfoW(wstr wstr ptr long long)
  181 stdcall -noname RegisterShellHook(long long)
- 182 varargs -noname ShellMessageBoxW(long long long str long)
- 183 varargs -noname ShellMessageBoxA(long long long str long)
+ 182 varargs -noname ShellMessageBoxW(long long wstr wstr long)
+ 183 varargs -noname ShellMessageBoxA(long long str str long)
  184 stdcall -noname ArrangeWindows(long long long long long)
  185 stub SHHandleDiskFull
  186 stdcall -noname ILGetDisplayNameEx(ptr ptr ptr long)
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 4da6417..98e8e57 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -338,6 +338,12 @@ BOOL WINAPI RegisterShellHook(
  * ShellMessageBoxW				[SHELL32.182]
  *
  * See ShellMessageBoxA.
+ *
+ * NOTE:
+ * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
+ * because we can't forward to it in the .spec file since it's exported by
+ * ordinal. If you change the implementation here please update the code in
+ * shlwapi as well.
  */
 int WINAPIV ShellMessageBoxW(
 	HINSTANCE hInstance,
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c
index 6ebabfa..8e950d8 100644
--- a/dlls/shlwapi/ordinal.c
+++ b/dlls/shlwapi/ordinal.c
@@ -4297,26 +4297,45 @@ DWORD WINAPI GetUIVersion(void)
 /***********************************************************************
  *              ShellMessageBoxWrapW [SHLWAPI.388]
  *
- * loads a string resource for a module, displays the string in a 
- * message box and writes it into the logfile
+ * See shell32.ShellMessageBoxW
  *
- * PARAMS
- *  mod      [I] the module containing the string resource
- *  unknown1 [I] FIXME
- *  uId      [I] the id of the string resource
- *  title    [I] the title of the message box
- *  unknown2 [I] FIXME
- *  filename [I] name of the logfile
- *
- * RETURNS
- *  FIXME
+ * NOTE:
+ * shlwapi.ShellMessageBoxWrapW is a duplicate of shell32.ShellMessageBoxW
+ * because we can't forward to it in the .spec file since it's exported by
+ * ordinal. If you change the implementation here please update the code in
+ * shell32 as well.
  */
-BOOL WINAPI ShellMessageBoxWrapW(HMODULE mod, DWORD unknown1, UINT uId,
-                                 LPCWSTR title, DWORD unknown2, LPCWSTR filename)
+INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
+                                 LPCWSTR lpCaption, UINT uType, ...)
 {
-    FIXME("%p %x %d %s %x %s\n",
-          mod, unknown1, uId, debugstr_w(title), unknown2, debugstr_w(filename));
-    return TRUE;
+    WCHAR szText[100], szTitle[100];
+    LPCWSTR pszText = szText, pszTitle = szTitle;
+    LPWSTR pszTemp;
+    va_list args;
+    int ret;
+
+    va_start(args, uType);
+
+    TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
+
+    if (IS_INTRESOURCE(lpCaption))
+        LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
+    else
+        pszTitle = lpCaption;
+
+    if (IS_INTRESOURCE(lpText))
+        LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0]));
+    else
+        pszText = lpText;
+
+    FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
+                   pszText, 0, 0, (LPWSTR)&pszTemp, 0, &args);
+
+    va_end(args);
+
+    ret = MessageBoxW(hWnd, pszTemp, pszTitle, uType);
+    LocalFree((HLOCAL)pszTemp);
+    return ret;
 }
 
 HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *unk, REFIID service, REFIID clsid,
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index bca51ee..3a920d0 100644
--- a/dlls/shlwapi/shlwapi.spec
+++ b/dlls/shlwapi/shlwapi.spec
@@ -385,7 +385,7 @@
 385 stub -noname SHLoadRawAccelerators
 386 stub -noname SHQueryRawAccelerator
 387 stub -noname SHQueryRawAcceleratorMsg
-388 stdcall -noname ShellMessageBoxWrapW(ptr long long wstr long wstr)
+388 varargs -noname ShellMessageBoxWrapW(long long wstr wstr long)
 389 stdcall -noname GetSaveFileNameWrapW(ptr)
 390 stdcall -noname WNetRestoreConnectionWrapW(long wstr)
 391 stdcall -noname WNetGetLastErrorWrapW(ptr ptr long ptr long)
-- 
1.5.2.5






More information about the wine-patches mailing list