[SHELL32] Fix boot to shell, addendum to commit 14599b0a.

shell32.ShellMessageBoxW redirects to shlwapi.ShellMessageBoxWrapW.
However the latter one (shlwapi) is exported by ordinal only.
Trying to use in shell32.spec file the following syntax:

  182 varargs ShellMessageBoxW() shlwapi.ShellMessageBoxWrapW

will therefore fail at runtime, because Windows/ReactOS will fail to
snap shlwapi.ShellMessageBoxWrapW.
Using instead an export by orginal:

  182 varargs ShellMessageBoxW() shlwapi.#388

actually fails as well, but at link time, by both MSVC' LINK and GNU's
dlltool.
This generates a .def file containing the line:

  ShellMessageBoxW=shlwapi.#388 @182

It is not clear why it fails, because according to:
https://docs.microsoft.com/en-us/cpp/build/reference/exports?view=vs-2019
and
https://devblogs.microsoft.com/oldnewthing/20121116-00/?p=6073
this should be possible.
However one encounters the same errors as those described at:
https://groups.google.com/forum/#!topic/microsoft.public.vc.language/AVnx-EnYdsY
and
https://www.xspdf.com/questions/22333.shtml
...

So instead we use another trick, that appears to be already in use in
the shell32.spec. Since the shlwapi functions are imported because we
link to it, this means that ShellMessageBoxWrapW() is already available
through this import. So we can specify it in the .spec file as is,
without a full name prefixed with "shlwapi." .
Therefore the associated shell32.ShellMessageBoxW function will instead
link to the small ShellMessageBoxWrapW() import stub that is generated
automatically.
This commit is contained in:
Hermès Bélusca-Maïto 2020-09-14 05:39:48 +02:00
parent a04831677e
commit a373198419
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -178,7 +178,7 @@
179 stdcall SHGetNewLinkInfoA(str str ptr long long)
180 stdcall SHGetNewLinkInfoW(wstr wstr ptr long long)
181 stdcall -noname RegisterShellHook(long long)
182 varargs ShellMessageBoxW(long long wstr wstr long) shlwapi.ShellMessageBoxWrapW
182 varargs ShellMessageBoxW(long long wstr wstr long) ShellMessageBoxWrapW ## This is the no-named 'shlwapi.ShellMessageBoxWrapW' (i.e. 'shlwapi.#388')
183 varargs ShellMessageBoxA(long long str str long)
184 stdcall -noname ArrangeWindows(long long long long long)
185 stdcall -noname SHHandleDiskFull(ptr long)