[SHELL32][SHLWAPI] Forward shell32.ShellMessageBoxW directly to shlwapi.ShellMessageBoxWrapW. (#3179)

This makes ShellMessageBoxW use the correct implementation where the
text buffer size is dynamic, instead of having a too small hardcoded
size.

Fixes CORE-17271.
See also PR #3172 by Kyle Katarn, supplemented with some ideas from
Mark Jansen.

However we cannot straightforwardly implement ShellMessageBoxA around
ShellMessageBoxW, by converting some parameters from ANSI to UNICODE,
because there may be some variadic ANSI strings, associated with '%s'
printf-like formatters inside the format string, that would also need
to be converted; however there is no way for us to find these and perform
the conversion ourselves.
Therefore, we re-implement ShellMessageBoxA by doing a copy-paste ANSI
adaptation of the shlwapi.ShellMessageBoxWrapW function.

Note that, on Vista+ onwards, shlwapi implements both ShellMessageBoxA/W,
and shell32 directly forwards these exports to shlwapi, thus avoiding
these workarounds.

[PSDK] Explicily use WINAPIV for the variadic ShellMessageBoxA/W functions.

[INCLUDE/REACTOS] Add ShellMessageBoxWrapW in shlwapi_undoc.h .
This commit is contained in:
Hermès Bélusca-Maïto 2020-09-13 18:21:29 +02:00
parent 5077e400d5
commit 14599b0a37
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
6 changed files with 132 additions and 4 deletions

View file

@ -120,6 +120,16 @@ INT WINAPI SHUnicodeToAnsi(LPCWSTR lpSrcStr, LPSTR lpDstStr, INT iLen);
PVOID WINAPI SHLockSharedEx(HANDLE hData, DWORD dwProcessId, BOOL bWriteAccess);
int
WINAPIV
ShellMessageBoxWrapW(
_In_opt_ HINSTANCE hAppInst,
_In_opt_ HWND hWnd,
_In_ LPCWSTR lpcText,
_In_opt_ LPCWSTR lpcTitle,
_In_ UINT fuStyle,
...);
#ifdef __cplusplus
} /* extern "C" */
#endif /* defined(__cplusplus) */