win32: don't use SetThreadErrorMode in XBOX builds

LoadLibraryExW is available, but not SetThreadErrorMode.
DLL dependencies/errors need to be managed by the host app.

This is a sandboxed environment where the library dependencies
need to be managed manually per platform.
This commit is contained in:
Steve Lhomme 2023-02-15 02:00:44 -08:00
parent de4b18ebf4
commit 4ff98ff54e
1 changed files with 9 additions and 2 deletions

View File

@ -57,15 +57,22 @@ void *vlc_dlopen(const char *psz_file, bool lazy)
return NULL;
HMODULE handle = NULL;
#ifndef VLC_WINSTORE_APP
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
DWORD mode;
if (SetThreadErrorMode (SEM_FAILCRITICALERRORS, &mode) != 0)
{
handle = LoadLibraryExW(wfile, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
SetThreadErrorMode (mode, NULL);
}
#else
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
handle = LoadPackagedLibrary( wfile, 0 );
#elif defined(WINAPI_FAMILY_GAMES) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
// SEM_FAILCRITICALERRORS is not available on Xbox, error messages are not
// possible. This is a sandboxed environment where the library dependencies
// need to be managed manually per platform.
handle = LoadLibraryExW(wfile, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
#else
#error Unknown Windows Platform!
#endif
free (wfile);