On Tue, 21 Apr 2020, Jacek Caban wrote:

Hi Steve,

On 21.04.2020 16:40, Steve Lhomme wrote:
windowsapp is meant to replace kernel32, user32, shell32, etc. These older
libraries should be used with it to avoid linking to entries that should not
be used in that context (apps working on all win10 devices)
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis

When linking with just windowsapp (and a C runtime) there's a call in
mingw32 to RtlAddFunctionTable(). In practice this call has no effect as the
.pdata of the section takes predecence.
https://pmeerw.net/blog/programming/RtlAddFunctionTable.html

This function call is not allowed an not needed in this context, so we just
forward the call to an internal dummy version.

Well, the intent of this function call is to synthesize something corresponding to .pdata, with one huge RUNTIME_FUNCTION for each executable section in the module, if the executable didn't have any .pdata of its own, as a global catch-all.

I wouldn't say "is not needed in this context" - it's more like an optional nice-to-have feature which is totally ok to skip if the runtime doesn't allow it.

winstorecompat also has a similar function but it should not be used with
windowsapp as some functions replaced by winstorecompat are now allowed in
windowsapp.

Hm, wouldn't it make more sense to build separate versions of winstorecompat, one for 8.x and one for 10?

Not strictly opposed to adding things like into libwindowsapp.a, but as we have winstorecompat _exactly_ for this purpose, I'd prefer to keep such dummy fallbacks there, and then build things like libwinstorecompat10.a if there's a different set of functions to stub out.

We already have similar hacks in the tree already, so if others like it I won't stay in a way of the patch, but I think that this could be done better. We should be able to avoid the call in the first place. One way to achieve that would be to move crt_handler.c to msvcrt importlib. Then we can customize that for windowsapp crt and avoid problematic functions.

I don't think particularly that is a good idea here. windowsapp is a replacement for kernel32 and a few other dlls, but the CRT in this case is libucrt.a (which links against the api-ms-win-crt-*) which also can be used for normal desktop things.

// Martin



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to