8bb8e6c7e08cf211e8a5c22e2f87028000453054
[mono.git] / mono / utils / mono-dl-windows-uwp.c
1 /*
2  * mono-dl-windows-uwp.c: UWP dl support for Mono.
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 "mono/utils/mono-dl-windows.h"
13
14 void*
15 mono_dl_lookup_symbol_in_process (const char *symbol_name)
16 {
17         g_unsupported_api ("EnumProcessModules");
18         SetLastError (ERROR_NOT_SUPPORTED);
19
20         return NULL;
21 }
22
23 char*
24 mono_dl_current_error_string (void)
25 {
26         char *ret = NULL;
27         TCHAR buf [1024];
28         DWORD code = GetLastError ();
29
30         if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
31                 code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS(buf) - 1, NULL))
32                 buf[0] = TEXT('\0');
33
34         ret = u16to8 (buf);
35         return ret;
36 }
37
38 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
39
40 #ifdef _MSC_VER
41 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
42 void __mono_win32_mono_dl_windows_uwp_quiet_lnk4221(void) {}
43 #endif
44 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */