Skip to content

Some more uwp patches: error out when using APIs with no replacement

Nirbheek Chauhan requested to merge nirbheek/glib:moderate-uwp-patches into master

No console, pipes, exec/spawning, or win32 window messages. Lookup of DNS records with DnsQuery is also deprecated, and there's no replacement for that, afaict.

@pwithnall we discussed having a replacement for the GIOChannel win32 window message integration, but after thinking about it, I realized that there is no replacement for that workflow, because with C++/WinRT you're supposed to use C++ coroutines, which do not map to the GIOChannel model at all.

commit cab257d0:

gmodule/uwp: Don't check for the targeted Windows version
UWP APIs are only available when targeting Windows 8+ anyway, so
`G_WINAPI_ONLY_APP` being set means Windows 8+ is being targeted.
We don't need that extra check.

commit 5169fb1b:

win_iconv: Use LoadPackagedLibrary when building UWP apps
LoadLibrary is not available at all when building with
`-DWINAPI_FAMILY=WINAPI_FAMILY_APP`.

commit 03376b56:

gspawn: Do not allow spawning processes or making pipes on UWP
_pipe(), _wspawn*() are not allowed on UWP apps, and will cause
a Windows App Certification Kit error.

Set errno as ENOSYS instead of EACCES so that it's slightly clearer to
the user that they shouldn't use the gspawn API on UWP.

commit 38734054:

giowin32: Error on invalid usage of GIOChannels on UWP
Win32 window handles and consoles do not exist on UWP apps, and the
corresponding APIs are not allowed. They cause an error when running
the Windows App Certification Kit.

The console is gone, the APIs are gone, and there is no replacement.

Win32 Windows are gone, and so is the event-based messaging system.
There's a new model for handling user input in app windows, but it is
only available in C++17/WinRT, so you cannot use that from C anyway,
and we do not need to add a replacement for it in GIOChannel.

Error out whenever possible when the user calls the GIOChannel API for
either of those when glib is built for the Universal Windows Platform.
This means we will print criticals and return a valid GIOChannel, but
doing anything with it will fail and return GErrors.

commit d7f1d22a:

glocalfile: Trash as a concept does not exist on UWP
And the functions we use to implement `g_local_file_trash()` are not
available on UWP either, so just return an error when it's called.

commit af15c97d:

gresolver: DnsQuery is not available on UWP
Return an error when looking up records when glib is built for UWP
apps.

commit 5fe25607:

gdbusprivate: Disable console and win32 window usage on UWP
These are not allowed when shipping a UWP app, and we use it all for
debugging anyway.
Edited by Philip Withnall

Merge request reports