Build mono runtime under none desktop Windows API family, adjustments and cleanup.
[mono.git] / eglib / src / gmodule-win32-uwp.c
1 /*
2  * gmodule-win32-uwp.c: UWP gmodule support.
3  *
4  * Copyright 2016 Microsoft
5  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 */
7 #include <config.h>
8 #include <glib.h>
9
10 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
11 #include <windows.h>
12 #include <gmodule-win32-internals.h>
13
14 gpointer
15 w32_find_symbol (const gchar *symbol_name)
16 {
17         g_unsupported_api ("EnumProcessModules");
18         SetLastError (ERROR_NOT_SUPPORTED);
19         return NULL;
20 }
21
22 const gchar *
23 g_module_error (void)
24 {
25         gchar *ret = NULL;
26         TCHAR buf [1024];
27         DWORD code = GetLastError ();
28
29         if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
30                 code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) )
31                 buf[0] = TEXT('\0');
32
33         ret = u16to8 (buf);
34         return ret;
35 }
36
37 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
38
39 #ifdef _MSC_VER
40 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
41 void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {}
42 #endif
43 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */