From: Johan Lorensson Date: Fri, 11 Nov 2016 10:43:49 +0000 (+0100) Subject: Merge pull request #3809 from lateralusX/jlorenss/win-api-family-support-cleanup X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=ced1dce6fb73eb9e57d31b30ec3e8d8d971a18dd;hp=b21be86802deac21e3d11ae203828d55527215fc Merge pull request #3809 from lateralusX/jlorenss/win-api-family-support-cleanup Build mono runtime under none desktop Windows API family, adjustments and cleanup. --- diff --git a/eglib/src/Makefile.am b/eglib/src/Makefile.am index 1527ba26d30..f89138ba851 100644 --- a/eglib/src/Makefile.am +++ b/eglib/src/Makefile.am @@ -5,7 +5,7 @@ AM_CFLAGS = $(WERROR_CFLAGS) win_files = \ eglib-config.hw \ gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \ - gmodule-win32.c gtimer-win32.c + gmodule-win32.c gtimer-win32.c gunicode-win32.c unix_files = \ gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \ diff --git a/eglib/src/gmisc-win32-uwp.c b/eglib/src/gmisc-win32-uwp.c new file mode 100644 index 00000000000..cdf5896de42 --- /dev/null +++ b/eglib/src/gmisc-win32-uwp.c @@ -0,0 +1,39 @@ +/* + * gmisc-win32-uwp.c: UWP misc support. + * + * Copyright 2016 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ +#include +#include + +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#include +#include + +gchar* +g_win32_getlocale(void) +{ + gunichar2 buf[19]; + gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9); + assert (ccBuf <= 9); + if (ccBuf != 0) { + buf[ccBuf - 1] = L'-'; + ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9); + assert (ccBuf <= 9); + } + + // Check for GetLocaleInfoEx failure. + if (ccBuf == 0) + buf[0] = L'\0'; + + return u16to8 (buf); +} + +#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ + +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {} +#endif +#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/eglib/src/gmisc-win32.c b/eglib/src/gmisc-win32.c index f9fdb668f2d..4aac0ef6946 100644 --- a/eglib/src/gmisc-win32.c +++ b/eglib/src/gmisc-win32.c @@ -101,27 +101,6 @@ g_win32_getlocale(void) ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9); return g_strdup (buf); } - -#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ - -gchar* -g_win32_getlocale(void) -{ - gunichar2 buf[19]; - gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9); - assert (ccBuf <= 9); - if (ccBuf != 0) { - buf[ccBuf - 1] = L'-'; - ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9); - assert (ccBuf <= 9); - } - - // Check for GetLocaleInfoEx failure. - if (ccBuf == 0) - buf[0] = L'\0'; - - return u16to8 (buf); -} #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ gboolean @@ -142,20 +121,35 @@ g_path_is_absolute (const char *filename) return FALSE; } -const gchar * -g_get_home_dir (void) -{ - gchar *home_dir = NULL; - #if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +static gchar* +g_get_known_folder_path (void) +{ + gchar *folder_path = NULL; PWSTR profile_path = NULL; HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path); if (SUCCEEDED(hr)) { - home_dir = u16to8 (profile_path); + folder_path = u16to8 (profile_path); CoTaskMemFree (profile_path); } + + return folder_path; +} + +#else + +static inline gchar * +g_get_known_folder_path (void) +{ + return NULL; +} #endif +const gchar * +g_get_home_dir (void) +{ + gchar *home_dir = g_get_known_folder_path (); + if (!home_dir) { home_dir = (gchar *) g_getenv ("USERPROFILE"); } diff --git a/eglib/src/gmodule-win32-internals.h b/eglib/src/gmodule-win32-internals.h new file mode 100644 index 00000000000..d18e27f485e --- /dev/null +++ b/eglib/src/gmodule-win32-internals.h @@ -0,0 +1,13 @@ +#ifndef __G_MODULE_WINDOWS_INTERNALS_H__ +#define __G_MODULE_WINDOWS_INTERNALS_H__ + +#include +#include + +#ifdef G_OS_WIN32 +#include + +gpointer +w32_find_symbol (const gchar *symbol_name); +#endif /* G_OS_WIN32 */ +#endif /* __G_MODULE_WINDOWS_INTERNALS_H__ */ diff --git a/eglib/src/gmodule-win32-uwp.c b/eglib/src/gmodule-win32-uwp.c new file mode 100644 index 00000000000..5117e3b7218 --- /dev/null +++ b/eglib/src/gmodule-win32-uwp.c @@ -0,0 +1,43 @@ +/* + * gmodule-win32-uwp.c: UWP gmodule support. + * + * Copyright 2016 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ +#include +#include + +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#include +#include + +gpointer +w32_find_symbol (const gchar *symbol_name) +{ + g_unsupported_api ("EnumProcessModules"); + SetLastError (ERROR_NOT_SUPPORTED); + return NULL; +} + +const gchar * +g_module_error (void) +{ + gchar *ret = NULL; + TCHAR buf [1024]; + DWORD code = GetLastError (); + + if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, + code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS (buf) - 1, NULL) ) + buf[0] = TEXT('\0'); + + ret = u16to8 (buf); + return ret; +} + +#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ + +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +void __mono_win32_gmodule_win32_uwp_quiet_lnk4221(void) {} +#endif +#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/eglib/src/gmodule-win32.c b/eglib/src/gmodule-win32.c index d1dca5303eb..72eaca32fb7 100644 --- a/eglib/src/gmodule-win32.c +++ b/eglib/src/gmodule-win32.c @@ -30,9 +30,9 @@ */ #include #include -#include #include #include +#include #define LIBSUFFIX ".dll" #define LIBPREFIX "" @@ -70,7 +70,7 @@ g_module_open (const gchar *file, GModuleFlags flags) } #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -static gpointer +gpointer w32_find_symbol (const gchar *symbol_name) { HMODULE *modules; @@ -116,16 +116,6 @@ w32_find_symbol (const gchar *symbol_name) g_free (modules); return NULL; } - -#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ - -static gpointer -w32_find_symbol (const gchar *symbol_name) -{ - g_unsupported_api ("EnumProcessModules"); - SetLastError (ERROR_NOT_SUPPORTED); - return NULL; -} #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ gboolean @@ -164,34 +154,6 @@ g_module_error (void) return ret; } - -#elif G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ - -const gchar * -g_module_error (void) -{ - gchar* ret = NULL; - TCHAR buf[1024]; - DWORD code = GetLastError (); - - if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, - code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, G_N_ELEMENTS(buf) - 1, NULL) ) - buf[0] = TEXT('\0'); - - ret = u16to8 (buf); - return ret; -} - -#else - -const gchar * -g_module_error (void) -{ - g_unsupported_api ("FormatMessage"); - SetLastError (ERROR_NOT_SUPPORTED); - return NULL; -} - #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ gboolean diff --git a/eglib/src/gunicode-win32-uwp.c b/eglib/src/gunicode-win32-uwp.c new file mode 100644 index 00000000000..ef36ffc17f5 --- /dev/null +++ b/eglib/src/gunicode-win32-uwp.c @@ -0,0 +1,42 @@ +/* + * gunicode-win32-uwp.c: UWP unicode support. + * + * Copyright 2016 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ +#include +#include + +#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) +#define CODESET 1 +#include + +extern const char *my_charset; +static gboolean is_utf8; + +gboolean +g_get_charset (G_CONST_RETURN char **charset) +{ + if (my_charset == NULL) { + static char buf [14]; + CPINFOEXA cp_info; + + GetCPInfoExA (CP_ACP, 0, &cp_info); + sprintf (buf, "CP%u", cp_info.CodePage); + my_charset = buf; + is_utf8 = FALSE; + } + + if (charset != NULL) + *charset = my_charset; + + return is_utf8; +} + +#else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ + +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +void __mono_win32_gunicode_win32_uwp_quiet_lnk4221(void) {} +#endif +#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/eglib/src/gunicode-win32.c b/eglib/src/gunicode-win32.c new file mode 100644 index 00000000000..a35cfcd48c1 --- /dev/null +++ b/eglib/src/gunicode-win32.c @@ -0,0 +1,39 @@ +/* + * gunicode-win32.c: Windows unicode support. + * + * Copyright 2016 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. +*/ +#include +#include + +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#define CODESET 1 +#include + +extern const char *my_charset; +static gboolean is_utf8; + +gboolean +g_get_charset (G_CONST_RETURN char **charset) +{ + if (my_charset == NULL) { + static char buf [14]; + sprintf (buf, "CP%u", GetACP ()); + my_charset = buf; + is_utf8 = FALSE; + } + + if (charset != NULL) + *charset = my_charset; + + return is_utf8; +} + +#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ + +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {} +#endif +#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ diff --git a/eglib/src/gunicode.c b/eglib/src/gunicode.c index f979f429ff7..c1280f9b8bf 100644 --- a/eglib/src/gunicode.c +++ b/eglib/src/gunicode.c @@ -39,18 +39,13 @@ #include #include -#if defined(_MSC_VER) || defined(G_OS_WIN32) -/* FIXME */ -# define CODESET 1 -# include -#else +#ifndef G_OS_WIN32 # ifdef HAVE_LOCALCHARSET_H # include # endif #endif -static const char *my_charset; -static gboolean is_utf8; +const char *my_charset; /* * Character set conversion @@ -205,31 +200,8 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs return res; } -#ifdef G_OS_WIN32 -extern WINBASEAPI UINT WINAPI GetACP(void); -gboolean -g_get_charset (G_CONST_RETURN char **charset) -{ - if (my_charset == NULL) { - static char buf [14]; -#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) - CPINFOEXA cp_info; - GetCPInfoExA (CP_ACP, 0, &cp_info); - sprintf (buf, "CP%u", cp_info.CodePage); -#else - sprintf (buf, "CP%u", GetACP ()); -#endif - my_charset = buf; - is_utf8 = FALSE; - } - - if (charset != NULL) - *charset = my_charset; - - return is_utf8; -} - -#else /* G_OS_WIN32 */ +#ifndef G_OS_WIN32 +static gboolean is_utf8; gboolean g_get_charset (G_CONST_RETURN char **charset) diff --git a/eglib/winconfig.h b/eglib/winconfig.h index 3a64e217ef0..238250bba05 100755 --- a/eglib/winconfig.h +++ b/eglib/winconfig.h @@ -92,9 +92,15 @@ #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #define HAVE_CLASSIC_WINAPI_SUPPORT 0 #define HAVE_UWP_WINAPI_SUPPORT 1 +#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT + #error Unsupported WINAPI family +#endif #else #define HAVE_CLASSIC_WINAPI_SUPPORT 0 #define HAVE_UWP_WINAPI_SUPPORT 0 +#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT + #error Unsupported WINAPI family +#endif #endif #endif diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index 0d47d88beda..aed903cc6a9 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -33,6 +33,7 @@ #include #include #include +#include #if HAVE_BOEHM_GC @@ -1938,8 +1939,5 @@ mono_gchandle_free_domain (MonoDomain *domain) } #else -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_boehm_gc_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (boehm_gc); #endif /* no Boehm GC */ diff --git a/mono/metadata/console-win32-uwp.c b/mono/metadata/console-win32-uwp.c index 56d43362d96..938ef80b171 100644 --- a/mono/metadata/console-win32-uwp.c +++ b/mono/metadata/console-win32-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/console-win32-internals.h" MonoBoolean @@ -93,8 +94,5 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_console_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (console_win32_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/coree-windows-uwp.c b/mono/metadata/coree-windows-uwp.c index 7aacb5ec864..d75660775e7 100644 --- a/mono/metadata/coree-windows-uwp.c +++ b/mono/metadata/coree-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/coree-internals.h" BOOL STDMETHODCALLTYPE @@ -50,8 +51,5 @@ mono_coree_set_act_ctx (const char *file_name) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_coree_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (coree_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/file-io-internals.h b/mono/metadata/file-io-internals.h index 3fe59706eed..ad455297d11 100644 --- a/mono/metadata/file-io-internals.h +++ b/mono/metadata/file-io-internals.h @@ -29,4 +29,13 @@ mono_file_io_replace_file (gunichar2 *destinationFileName, gunichar2 *sourceFile gboolean mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 *error); +HANDLE +mono_file_io_get_console_output (void); + +HANDLE +mono_file_io_get_console_error (void); + +HANDLE +mono_file_io_get_console_input (void); + #endif /* __MONO_FILE_IO_INTERNALS_H__ */ diff --git a/mono/metadata/file-io-windows-uwp.c b/mono/metadata/file-io-windows-uwp.c index 2ece546a9c3..3af6c056c85 100644 --- a/mono/metadata/file-io-windows-uwp.c +++ b/mono/metadata/file-io-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/file-io-windows-internals.h" gboolean @@ -112,10 +113,55 @@ mono_file_io_unlock_file (HANDLE handle, gint64 position, gint64 length, gint32 return result; } +HANDLE +mono_file_io_get_console_output (void) +{ + MonoError mono_error; + mono_error_init (&mono_error); + + g_unsupported_api ("GetStdHandle (STD_OUTPUT_HANDLE)"); + + mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_OUTPUT_HANDLE)"); + mono_error_set_pending_exception (&mono_error); + + SetLastError (ERROR_NOT_SUPPORTED); + + return INVALID_HANDLE_VALUE; +} + +HANDLE +mono_file_io_get_console_input (void) +{ + MonoError mono_error; + mono_error_init (&mono_error); + + g_unsupported_api ("GetStdHandle (STD_INPUT_HANDLE)"); + + mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_INPUT_HANDLE)"); + mono_error_set_pending_exception (&mono_error); + + SetLastError (ERROR_NOT_SUPPORTED); + + return INVALID_HANDLE_VALUE; +} + +HANDLE +mono_file_io_get_console_error (void) +{ + MonoError mono_error; + mono_error_init (&mono_error); + + g_unsupported_api ("GetStdHandle (STD_ERROR_HANDLE)"); + + mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "GetStdHandle (STD_ERROR_HANDLE)"); + mono_error_set_pending_exception (&mono_error); + + SetLastError (ERROR_NOT_SUPPORTED); + + return INVALID_HANDLE_VALUE; +} + #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_file_io_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (file_io_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/file-io.c b/mono/metadata/file-io.c index 7f55a5e9542..0b001db6689 100644 --- a/mono/metadata/file-io.c +++ b/mono/metadata/file-io.c @@ -1085,22 +1085,46 @@ ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time, return(ret); } +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +HANDLE +mono_file_io_get_console_output (void) +{ + return GetStdHandle (STD_OUTPUT_HANDLE); +} +#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ + HANDLE ves_icall_System_IO_MonoIO_get_ConsoleOutput () { - return GetStdHandle (STD_OUTPUT_HANDLE); + return mono_file_io_get_console_output (); } +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +HANDLE +mono_file_io_get_console_input (void) +{ + return GetStdHandle (STD_INPUT_HANDLE); +} +#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ + HANDLE ves_icall_System_IO_MonoIO_get_ConsoleInput () { - return GetStdHandle (STD_INPUT_HANDLE); + return mono_file_io_get_console_input (); +} + +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +HANDLE +mono_file_io_get_console_error (void) +{ + return GetStdHandle (STD_ERROR_HANDLE); } +#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ HANDLE ves_icall_System_IO_MonoIO_get_ConsoleError () { - return GetStdHandle (STD_ERROR_HANDLE); + return mono_file_io_get_console_error (); } MonoBoolean diff --git a/mono/metadata/file-mmap-windows.c b/mono/metadata/file-mmap-windows.c index b0fd5d9b896..3cc9124c085 100644 --- a/mono/metadata/file-mmap-windows.c +++ b/mono/metadata/file-mmap-windows.c @@ -13,8 +13,9 @@ */ #include - -#ifdef HOST_WIN32 +#include +#include +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) && defined(HOST_WIN32) #include @@ -410,4 +411,8 @@ gboolean mono_mmap_unmap (void *mmap_handle) return result; } +#else + +MONO_EMPTY_SOURCE_FILE (file_mmap_windows); + #endif diff --git a/mono/metadata/icall-windows-uwp.c b/mono/metadata/icall-windows-uwp.c index 0b5afa2624b..f43e22f5d39 100644 --- a/mono/metadata/icall-windows-uwp.c +++ b/mono/metadata/icall-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/icall-windows-internals.h" MonoString * @@ -87,8 +88,5 @@ mono_icall_wait_for_input_idle (gpointer handle, gint32 milliseconds) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_icall_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (icall_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/lock-tracer.c b/mono/metadata/lock-tracer.c index 551f8a751e8..8ca4a27ab82 100644 --- a/mono/metadata/lock-tracer.c +++ b/mono/metadata/lock-tracer.c @@ -21,6 +21,7 @@ #endif #include +#include #include "lock-tracer.h" @@ -142,8 +143,5 @@ mono_locks_lock_released (RuntimeLocks kind, gpointer lock) } #else -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_lock_tracer_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (lock_tracer); #endif /* LOCK_TRACER */ diff --git a/mono/metadata/marshal-windows-uwp.c b/mono/metadata/marshal-windows-uwp.c index a2fa813499b..7ac1a33b47a 100644 --- a/mono/metadata/marshal-windows-uwp.c +++ b/mono/metadata/marshal-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/marshal-windows-internals.h" void * @@ -32,8 +33,5 @@ mono_marshal_free_hglobal (gpointer ptr) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_marshal_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (marshal_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/mono-endian.c b/mono/metadata/mono-endian.c index a4c48f1413d..0a697360e22 100644 --- a/mono/metadata/mono-endian.c +++ b/mono/metadata/mono-endian.c @@ -9,6 +9,7 @@ * Licensed under the MIT license. See LICENSE file in the project root for full license information. */ #include +#include #include "mono-endian.h" #if NO_UNALIGNED_ACCESS @@ -86,4 +87,8 @@ mono_read64 (const unsigned char *x) return r.i; } +#else /* NO_UNALIGNED_ACCESS */ + +MONO_EMPTY_SOURCE_FILE (mono_endian); + #endif diff --git a/mono/metadata/mono-security-windows-uwp.c b/mono/metadata/mono-security-windows-uwp.c index 791e76c2f8e..01549b8d3fc 100644 --- a/mono/metadata/mono-security-windows-uwp.c +++ b/mono/metadata/mono-security-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include "mono/metadata/mono-security-windows-internals.h" gpointer @@ -172,8 +173,5 @@ mono_security_win_protect_user (gunichar2 *path) } #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_security_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_security_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/metadata/null-gc.c b/mono/metadata/null-gc.c index 0990ff875fd..9ea87bd844c 100644 --- a/mono/metadata/null-gc.c +++ b/mono/metadata/null-gc.c @@ -552,8 +552,5 @@ mono_gc_is_null (void) } #else -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_null_gc_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (null_gc); #endif /* HAVE_NULL_GC */ diff --git a/mono/metadata/w32process-win32-internals.h b/mono/metadata/w32process-win32-internals.h index 1699f957533..a5eb90a8cdd 100644 --- a/mono/metadata/w32process-win32-internals.h +++ b/mono/metadata/w32process-win32-internals.h @@ -20,7 +20,7 @@ mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle,STARTUPINFO *startinfo); gboolean -mono_process_create_process (MonoProcInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, +mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags, gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info); @@ -35,6 +35,9 @@ mono_icall_get_priority_class (gpointer handle); MonoBoolean mono_icall_set_priority_class (gpointer handle, gint32 priorityClass); + +gboolean +mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed); #endif /* !G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */ #endif /* __MONO_METADATA_PROCESS_INTERNALS_H__ */ diff --git a/mono/metadata/w32process-win32-uwp.c b/mono/metadata/w32process-win32-uwp.c index 9fc329ad7a2..cbd46b794aa 100644 --- a/mono/metadata/w32process-win32-uwp.c +++ b/mono/metadata/w32process-win32-uwp.c @@ -6,9 +6,13 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include +#include +#include "mono/metadata/w32process.h" +#include "mono/metadata/w32process-internals.h" #include "mono/metadata/w32process-win32-internals.h" gboolean @@ -24,16 +28,17 @@ mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed) HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid) { - HANDLE handle; - - /* GetCurrentProcess returns a pseudo-handle, so use - * OpenProcess instead - */ - handle = OpenProcess (PROCESS_ALL_ACCESS, TRUE, pid); - if (handle == NULL) - /* FIXME: Throw an exception */ - return NULL; - return handle; + MonoError mono_error; + mono_error_init (&mono_error); + + g_unsupported_api ("OpenProcess"); + + mono_error_set_not_supported (&mono_error, G_UNSUPPORTED_API, "OpenProcess"); + mono_error_set_pending_exception (&mono_error); + + SetLastError (ERROR_NOT_SUPPORTED); + + return NULL; } void @@ -77,7 +82,7 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, } MonoBoolean -ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_info) +ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStartInfo *proc_start_info, MonoW32ProcessInfo *process_info) { MonoError mono_error; mono_error_init (&mono_error); @@ -124,7 +129,7 @@ mono_process_init_startup_info (HANDLE stdin_handle, HANDLE stdout_handle, HANDL } gboolean -mono_process_create_process (MonoProcInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags, +mono_process_create_process (MonoW32ProcessInfo *mono_process_info, gunichar2 *shell_path, MonoString *cmd, guint32 creation_flags, gchar *env_vars, gunichar2 *dir, STARTUPINFO *start_info, PROCESS_INFORMATION *process_info) { MonoError mono_error; @@ -214,8 +219,5 @@ mono_icall_set_priority_class (gpointer handle, gint32 priorityClass) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_process_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (process_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/mini/abcremoval.c b/mono/mini/abcremoval.c index 17a8e84d91a..c4c00645c16 100644 --- a/mono/mini/abcremoval.c +++ b/mono/mini/abcremoval.c @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -1380,4 +1381,8 @@ mono_perform_abc_removal (MonoCompile *cfg) process_block (cfg, cfg->bblocks [0], &area); } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (abcremoval); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/alias-analysis.c b/mono/mini/alias-analysis.c index 82e3672ae1d..c419dfa2b42 100644 --- a/mono/mini/alias-analysis.c +++ b/mono/mini/alias-analysis.c @@ -13,6 +13,7 @@ #include "mini.h" #include "ir-emit.h" #include "glib.h" +#include #ifndef DISABLE_JIT @@ -362,4 +363,8 @@ done: mono_print_code (cfg, "AFTER ALIAS_ANALYSIS"); } +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (alias_analysis); + #endif /* !DISABLE_JIT */ diff --git a/mono/mini/branch-opts.c b/mono/mini/branch-opts.c index c85bd5e0f1d..1602b03d59a 100644 --- a/mono/mini/branch-opts.c +++ b/mono/mini/branch-opts.c @@ -10,6 +10,7 @@ */ #include "config.h" +#include #ifndef DISABLE_JIT #include "mini.h" @@ -1479,4 +1480,8 @@ mono_optimize_branches (MonoCompile *cfg) } while (changed && (niterations > 0)); } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (branch_opts); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/decompose.c b/mono/mini/decompose.c index a883e70ee89..aaa34a3bc34 100644 --- a/mono/mini/decompose.c +++ b/mono/mini/decompose.c @@ -15,6 +15,7 @@ #include #include +#include #ifndef DISABLE_JIT @@ -1968,4 +1969,8 @@ mono_local_emulate_ops (MonoCompile *cfg) } } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (decompose); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c index ad25f58728e..6c191d0b37d 100644 --- a/mono/mini/dwarfwriter.c +++ b/mono/mini/dwarfwriter.c @@ -8,6 +8,7 @@ */ #include "config.h" +#include #if !defined(DISABLE_AOT) && !defined(DISABLE_JIT) #include "dwarfwriter.h" @@ -2002,4 +2003,9 @@ mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, c emit_fde (w, w->fde_index, start_symbol, end_symbol, code, code_size, unwind_info, FALSE); w->fde_index ++; } + +#else /* !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */ + +MONO_EMPTY_SOURCE_FILE (dwarfwriter); + #endif /* End of: !defined(DISABLE_AOT) && !defined(DISABLE_JIT) */ diff --git a/mono/mini/graph.c b/mono/mini/graph.c index 08d2891f87c..95e1fff2bb4 100644 --- a/mono/mini/graph.c +++ b/mono/mini/graph.c @@ -8,6 +8,7 @@ */ #include +#include #ifndef DISABLE_JIT @@ -346,5 +347,9 @@ mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options) #endif } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (graph); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/linear-scan.c b/mono/mini/linear-scan.c index 287022daad7..faadc048ec9 100644 --- a/mono/mini/linear-scan.c +++ b/mono/mini/linear-scan.c @@ -9,6 +9,7 @@ #include "mini.h" #include +#include #ifndef DISABLE_JIT @@ -512,4 +513,8 @@ mono_linear_scan2 (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_m g_list_free (inactive); } -#endif /* #ifndef DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (linear_scan); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/liveness.c b/mono/mini/liveness.c index c8978930740..7cc05634123 100644 --- a/mono/mini/liveness.c +++ b/mono/mini/liveness.c @@ -10,6 +10,7 @@ */ #include +#include #ifndef DISABLE_JIT @@ -1158,4 +1159,8 @@ mono_analyze_liveness_gc (MonoCompile *cfg) g_free (vreg_to_varinfo); } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (liveness); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/local-propagation.c b/mono/mini/local-propagation.c index e19b91c5fca..647d787dafc 100644 --- a/mono/mini/local-propagation.c +++ b/mono/mini/local-propagation.c @@ -14,6 +14,8 @@ */ #include +#include + #ifndef DISABLE_JIT #include @@ -1002,4 +1004,8 @@ mono_local_deadce (MonoCompile *cfg) //mono_print_code (cfg, "AFTER LOCAL-DEADCE"); } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (local_propagation); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 3143431b6c4..ee0535ec252 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -12,6 +12,7 @@ */ #include +#include #ifndef DISABLE_JIT @@ -15295,4 +15296,8 @@ NOTES the values on the stack before emitting the last instruction of the bb. */ -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (method_to_ir); + +#endif /* !DISABLE_JIT */ diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index 4ed38f2b583..b9a4503e2e2 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -438,7 +438,7 @@ collect_field_info_nested (MonoClass *klass, StructFieldInfo *fields, int index, #define MONO_WIN64_VALUE_TYPE_FITS_REG(arg_size) (arg_size <= SIZEOF_REGISTER && (arg_size == 1 || arg_size == 2 || arg_size == 4 || arg_size == 8)) static gboolean -allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg) +allocate_register_for_valuetype_win64 (ArgInfo *arg_info, ArgumentClass arg_class, guint32 arg_size, AMD64_Reg_No int_regs [], int int_reg_count, AMD64_XMM_Reg_No float_regs [], int float_reg_count, guint32 *current_int_reg, guint32 *current_float_reg) { gboolean result = FALSE; diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index 8ac16a17176..24eb6524bf7 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -191,11 +191,11 @@ typedef struct MonoCompileArch { static AMD64_Reg_No param_regs [] = { AMD64_RCX, AMD64_RDX, AMD64_R8, AMD64_R9 }; -static AMD64_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 }; +static AMD64_XMM_Reg_No float_param_regs [] = { AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3 }; static AMD64_Reg_No return_regs [] = { AMD64_RAX }; -static AMD64_Reg_No float_return_regs [] = { AMD64_XMM0 }; +static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 }; #define PARAM_REGS G_N_ELEMENTS(param_regs) #define FLOAT_PARAM_REGS G_N_ELEMENTS(float_param_regs) diff --git a/mono/mini/mini-windows-uwp.c b/mono/mini/mini-windows-uwp.c index c2367aae9c2..2d479708fcd 100644 --- a/mono/mini/mini-windows-uwp.c +++ b/mono/mini/mini-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include void mono_runtime_setup_stat_profiler (void) @@ -35,9 +36,6 @@ mono_setup_thread_context(DWORD thread_id, MonoContext *mono_context) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mini_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mini_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/mini/ssa.c b/mono/mini/ssa.c index cb100267ef7..d70788c6afb 100644 --- a/mono/mini/ssa.c +++ b/mono/mini/ssa.c @@ -13,6 +13,7 @@ #include #include #include +#include #ifndef DISABLE_JIT @@ -1515,4 +1516,8 @@ mono_ssa_loop_invariant_code_motion (MonoCompile *cfg) } } -#endif /* DISABLE_JIT */ +#else /* !DISABLE_JIT */ + +MONO_EMPTY_SOURCE_FILE (ssa); + +#endif /* !DISABLE_JIT */ diff --git a/mono/sgen/sgen-layout-stats.c b/mono/sgen/sgen-layout-stats.c index 44ddf94b24d..04b1f241e1a 100644 --- a/mono/sgen/sgen-layout-stats.c +++ b/mono/sgen/sgen-layout-stats.c @@ -9,6 +9,7 @@ #include "sgen/sgen-gc.h" #include "sgen/sgen-layout-stats.h" +#include #ifdef SGEN_OBJECT_LAYOUT_STATISTICS @@ -60,9 +61,6 @@ sgen_object_layout_dump (FILE *out) } #else -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_sgen_layout_stats_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (sgen_layout_stats); #endif /* SGEN_OBJECT_LAYOUT_STATISTICS */ #endif diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am index ab301d1700b..35f218a8d0a 100644 --- a/mono/utils/Makefile.am +++ b/mono/utils/Makefile.am @@ -40,7 +40,7 @@ monoutils_sources = \ mono-dl-darwin.c \ mono-dl-posix.c \ mono-dl.h \ - mono-dl-windows.h \ + mono-dl-windows-internals.h \ mono-log-windows.c \ mono-log-common.c \ mono-log-posix.c \ @@ -57,7 +57,7 @@ monoutils_sources = \ mono-mmap-windows.c \ mono-mmap.h \ mono-mmap-internals.h \ - mono-mmap-windows.h \ + mono-mmap-windows-internals.h \ mono-os-mutex.h \ mono-coop-mutex.h \ mono-once.h \ @@ -67,7 +67,7 @@ monoutils_sources = \ mono-proclib.c \ mono-proclib-windows.c \ mono-proclib.h \ - mono-proclib-windows.h \ + mono-proclib-windows-internals.h \ mono-publib.c \ mono-string.h \ mono-time.c \ @@ -166,7 +166,7 @@ monoutils_sources = \ mono-rand.c \ mono-rand-windows.c \ mono-rand.h \ - mono-rand-windows.h \ + mono-rand-windows-internals.h \ memfuncs.c \ memfuncs.h \ parse.c \ diff --git a/mono/utils/atomic.c b/mono/utils/atomic.c index 2f5e8a8a673..543e8ce9b0c 100644 --- a/mono/utils/atomic.c +++ b/mono/utils/atomic.c @@ -12,6 +12,7 @@ #include #include +#include #if defined (WAPI_NO_ATOMIC_ASM) || defined (BROKEN_64BIT_ATOMICS_INTRINSIC) @@ -584,7 +585,6 @@ InterlockedCompareExchange64(volatile gint64 *dest, gint64 exch, gint64 comp) #endif #endif -#if defined(HOST_WIN32) && defined(_MSC_VER) -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_atomic_lnk4221(void) {} +#if !defined (WAPI_NO_ATOMIC_ASM) && !defined (BROKEN_64BIT_ATOMICS_INTRINSIC) && !defined (NEED_64BIT_CMPXCHG_FALLBACK) +MONO_EMPTY_SOURCE_FILE (atomic); #endif diff --git a/mono/utils/mono-compiler.h b/mono/utils/mono-compiler.h index 7becf4816ff..680c5a4cdde 100644 --- a/mono/utils/mono-compiler.h +++ b/mono/utils/mono-compiler.h @@ -268,6 +268,13 @@ typedef SSIZE_T ssize_t; #endif /* _MSC_VER */ +#ifdef _MSC_VER +// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. +#define MONO_EMPTY_SOURCE_FILE(x) void __mono_win32_ ## x ## _quiet_lnk4221 (void) {} +#else +#define MONO_EMPTY_SOURCE_FILE(x) +#endif + #if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN #if MONO_LLVM_LOADED #define MONO_LLVM_INTERNAL MONO_API diff --git a/mono/utils/mono-dl-windows-internals.h b/mono/utils/mono-dl-windows-internals.h new file mode 100644 index 00000000000..52154180488 --- /dev/null +++ b/mono/utils/mono-dl-windows-internals.h @@ -0,0 +1,14 @@ +#ifndef __MONO_UTILS_DL_WINDOWS_H__ +#define __MONO_UTILS_DL_WINDOWS_H__ + +#include +#include + +#ifdef HOST_WIN32 +#include "mono/utils/mono-dl.h" + +void* +mono_dl_lookup_symbol_in_process (const char *symbol_name); +#endif /* HOST_WIN32 */ +#endif /* __MONO_UTILS_DL_WINDOWS_H__ */ + diff --git a/mono/utils/mono-dl-windows-uwp.c b/mono/utils/mono-dl-windows-uwp.c index 8bb8e6c7e08..36ade1f67e9 100644 --- a/mono/utils/mono-dl-windows-uwp.c +++ b/mono/utils/mono-dl-windows-uwp.c @@ -6,10 +6,11 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include -#include "mono/utils/mono-dl-windows.h" +#include +#include "mono/utils/mono-dl-windows-internals.h" void* mono_dl_lookup_symbol_in_process (const char *symbol_name) @@ -37,8 +38,5 @@ mono_dl_current_error_string (void) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_dl_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_dl_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/utils/mono-dl-windows.c b/mono/utils/mono-dl-windows.c index 04f695d22de..32eaac799b6 100644 --- a/mono/utils/mono-dl-windows.c +++ b/mono/utils/mono-dl-windows.c @@ -13,7 +13,7 @@ #if defined(HOST_WIN32) #include "mono/utils/mono-dl.h" -#include "mono/utils/mono-dl-windows.h" +#include "mono/utils/mono-dl-windows-internals.h" #include "mono/utils/mono-embed.h" #include "mono/utils/mono-path.h" diff --git a/mono/utils/mono-dl-windows.h b/mono/utils/mono-dl-windows.h deleted file mode 100644 index 52154180488..00000000000 --- a/mono/utils/mono-dl-windows.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __MONO_UTILS_DL_WINDOWS_H__ -#define __MONO_UTILS_DL_WINDOWS_H__ - -#include -#include - -#ifdef HOST_WIN32 -#include "mono/utils/mono-dl.h" - -void* -mono_dl_lookup_symbol_in_process (const char *symbol_name); -#endif /* HOST_WIN32 */ -#endif /* __MONO_UTILS_DL_WINDOWS_H__ */ - diff --git a/mono/utils/mono-io-portability.c b/mono/utils/mono-io-portability.c index f423096a780..7e22eafa8cc 100644 --- a/mono/utils/mono-io-portability.c +++ b/mono/utils/mono-io-portability.c @@ -7,6 +7,7 @@ #include #include #include +#include #ifndef DISABLE_PORTABILITY @@ -390,8 +391,6 @@ static inline gchar *mono_portability_find_file_internal (GString **report, cons #else /* DISABLE_PORTABILITY */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_io_portability_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_io_portability); + #endif /* DISABLE_PORTABILITY */ diff --git a/mono/utils/mono-mmap-windows-internals.h b/mono/utils/mono-mmap-windows-internals.h new file mode 100644 index 00000000000..44da254692b --- /dev/null +++ b/mono/utils/mono-mmap-windows-internals.h @@ -0,0 +1,15 @@ +#ifndef __MONO_UTILS_MMAP_WINDOWS_H__ +#define __MONO_UTILS_MMAP_WINDOWS_H__ + +#include +#include + +#ifdef HOST_WIN32 +#include "mono/utils/mono-mmap.h" +#include "mono/utils/mono-mmap-internals.h" + +int +mono_mmap_win_prot_from_flags (int flags); +#endif /* HOST_WIN32 */ +#endif /* __MONO_UTILS_MMAP_WINDOWS_H__ */ + diff --git a/mono/utils/mono-mmap-windows-uwp.c b/mono/utils/mono-mmap-windows-uwp.c index 55652006d5a..347fb70e89f 100644 --- a/mono/utils/mono-mmap-windows-uwp.c +++ b/mono/utils/mono-mmap-windows-uwp.c @@ -6,10 +6,11 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include -#include +#include +#include void* mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle) @@ -50,8 +51,5 @@ mono_file_unmap (void *addr, void *handle) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_mmap_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_mmap_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/utils/mono-mmap-windows.c b/mono/utils/mono-mmap-windows.c index d0b6072bece..69619f8acb9 100644 --- a/mono/utils/mono-mmap-windows.c +++ b/mono/utils/mono-mmap-windows.c @@ -13,7 +13,7 @@ #if defined(HOST_WIN32) #include -#include "mono/utils/mono-mmap-windows.h" +#include "mono/utils/mono-mmap-windows-internals.h" #include #include diff --git a/mono/utils/mono-mmap-windows.h b/mono/utils/mono-mmap-windows.h deleted file mode 100644 index 44da254692b..00000000000 --- a/mono/utils/mono-mmap-windows.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __MONO_UTILS_MMAP_WINDOWS_H__ -#define __MONO_UTILS_MMAP_WINDOWS_H__ - -#include -#include - -#ifdef HOST_WIN32 -#include "mono/utils/mono-mmap.h" -#include "mono/utils/mono-mmap-internals.h" - -int -mono_mmap_win_prot_from_flags (int flags); -#endif /* HOST_WIN32 */ -#endif /* __MONO_UTILS_MMAP_WINDOWS_H__ */ - diff --git a/mono/utils/mono-proclib-windows-internals.h b/mono/utils/mono-proclib-windows-internals.h new file mode 100644 index 00000000000..f14c7a402b6 --- /dev/null +++ b/mono/utils/mono-proclib-windows-internals.h @@ -0,0 +1,13 @@ +#ifndef __MONO_UTILS_PROCLIB_WINDOWS_H__ +#define __MONO_UTILS_PROCLIB_WINDOWS_H__ + +#include +#include + +#ifdef HOST_WIN32 +#include +#include "mono/utils/mono-proclib.h" + +#endif /* HOST_WIN32 */ +#endif /* __MONO_UTILS_PROCLIB_WINDOWS_H__ */ + diff --git a/mono/utils/mono-proclib-windows-uwp.c b/mono/utils/mono-proclib-windows-uwp.c index e278eccede2..4a2f37dabf9 100644 --- a/mono/utils/mono-proclib-windows-uwp.c +++ b/mono/utils/mono-proclib-windows-uwp.c @@ -6,9 +6,10 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include +#include #include gint32 @@ -57,8 +58,5 @@ mono_cpu_usage (MonoCpuUsageState *prev) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_proclib_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_proclib_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/utils/mono-proclib-windows.h b/mono/utils/mono-proclib-windows.h deleted file mode 100644 index f14c7a402b6..00000000000 --- a/mono/utils/mono-proclib-windows.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __MONO_UTILS_PROCLIB_WINDOWS_H__ -#define __MONO_UTILS_PROCLIB_WINDOWS_H__ - -#include -#include - -#ifdef HOST_WIN32 -#include -#include "mono/utils/mono-proclib.h" - -#endif /* HOST_WIN32 */ -#endif /* __MONO_UTILS_PROCLIB_WINDOWS_H__ */ - diff --git a/mono/utils/mono-rand-windows-internals.h b/mono/utils/mono-rand-windows-internals.h new file mode 100644 index 00000000000..f60c121c98d --- /dev/null +++ b/mono/utils/mono-rand-windows-internals.h @@ -0,0 +1,33 @@ +#ifndef _MONO_UTILS_RAND_WINDOWS_H_ +#define _MONO_UTILS_RAND_WINDOWS_H_ + +#include +#include + +#ifdef HOST_WIN32 + +#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) +#include +#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV + +#else + +#include +#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE +#endif + +MONO_WIN32_CRYPT_PROVIDER_HANDLE +mono_rand_win_open_provider (void); + +gboolean +mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size); + +gboolean +mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size); + +void +mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider); + +#endif /* HOST_WIN32 */ +#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */ + diff --git a/mono/utils/mono-rand-windows-uwp.c b/mono/utils/mono-rand-windows-uwp.c index e9030fe8551..7d92434526c 100644 --- a/mono/utils/mono-rand-windows-uwp.c +++ b/mono/utils/mono-rand-windows-uwp.c @@ -6,10 +6,11 @@ */ #include #include +#include "mono/utils/mono-compiler.h" #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) -#include -#include "mono/utils/mono-rand-windows.h" +#include +#include "mono/utils/mono-rand-windows-internals.h" MONO_WIN32_CRYPT_PROVIDER_HANDLE mono_rand_win_open_provider (void) @@ -45,8 +46,5 @@ mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider) #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_mono_rand_windows_uwp_quiet_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (mono_rand_windows_uwp); #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ diff --git a/mono/utils/mono-rand-windows.c b/mono/utils/mono-rand-windows.c index 2ff32a99fa1..97f57cee4ee 100644 --- a/mono/utils/mono-rand-windows.c +++ b/mono/utils/mono-rand-windows.c @@ -12,7 +12,7 @@ #if defined(HOST_WIN32) #include -#include "mono/utils/mono-rand-windows.h" +#include "mono/utils/mono-rand-windows-internals.h" #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) #ifndef PROV_INTEL_SEC diff --git a/mono/utils/mono-rand-windows.h b/mono/utils/mono-rand-windows.h deleted file mode 100644 index f60c121c98d..00000000000 --- a/mono/utils/mono-rand-windows.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _MONO_UTILS_RAND_WINDOWS_H_ -#define _MONO_UTILS_RAND_WINDOWS_H_ - -#include -#include - -#ifdef HOST_WIN32 - -#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) -#include -#define MONO_WIN32_CRYPT_PROVIDER_HANDLE HCRYPTPROV - -#else - -#include -#define MONO_WIN32_CRYPT_PROVIDER_HANDLE BCRYPT_ALG_HANDLE -#endif - -MONO_WIN32_CRYPT_PROVIDER_HANDLE -mono_rand_win_open_provider (void); - -gboolean -mono_rand_win_gen (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *buffer, size_t buffer_size); - -gboolean -mono_rand_win_seed (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider, guchar *seed, size_t seed_size); - -void -mono_rand_win_close_provider (MONO_WIN32_CRYPT_PROVIDER_HANDLE provider); - -#endif /* HOST_WIN32 */ -#endif /* _MONO_UTILS_RAND_WINDOWS_H_ */ - diff --git a/mono/utils/networking-missing.c b/mono/utils/networking-missing.c index 763c85b0d37..8c8c75b5a10 100644 --- a/mono/utils/networking-missing.c +++ b/mono/utils/networking-missing.c @@ -8,6 +8,7 @@ */ #include +#include #include #ifdef HAVE_NETDB_H @@ -55,8 +56,5 @@ inet_pton (int family, const char *address, void *inaddrp) #else /* !HAVE_INET_PTON */ -#ifdef _MSC_VER -// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty. -void __mono_win32_networking_missing_lnk4221(void) {} -#endif +MONO_EMPTY_SOURCE_FILE (networking_missing); #endif /* !HAVE_INET_PTON */ diff --git a/msvc/eglib.vcxproj b/msvc/eglib.vcxproj index 94a7127d731..98a8849ab35 100644 --- a/msvc/eglib.vcxproj +++ b/msvc/eglib.vcxproj @@ -1,4 +1,4 @@ - + @@ -178,11 +178,13 @@ + + @@ -191,7 +193,10 @@ {92ae7622-5f58-4234-9a26-9ec71876b3f4} + + + - + \ No newline at end of file diff --git a/msvc/eglib.vcxproj.filters b/msvc/eglib.vcxproj.filters index 680ff1a9fd9..f49e42ae159 100644 --- a/msvc/eglib.vcxproj.filters +++ b/msvc/eglib.vcxproj.filters @@ -88,7 +88,7 @@ Source Files - + Source Files @@ -102,6 +102,9 @@ Header Files + + Header Files + @@ -114,4 +117,9 @@ {38a39ff1-842b-431b-b54b-24094e8283eb} + + + Resource Files + + \ No newline at end of file diff --git a/msvc/libmono-static.vcxproj b/msvc/libmono-static.vcxproj index 775c7b8e5e3..b8ba2add1e2 100644 --- a/msvc/libmono-static.vcxproj +++ b/msvc/libmono-static.vcxproj @@ -334,6 +334,9 @@ {8fc2b0c8-51ad-49df-851f-5d01a77a75e4} + + + diff --git a/msvc/libmono-static.vcxproj.filters b/msvc/libmono-static.vcxproj.filters index e0a3ad1227f..77099bed2f1 100644 --- a/msvc/libmono-static.vcxproj.filters +++ b/msvc/libmono-static.vcxproj.filters @@ -246,4 +246,9 @@ {5370c3c4-b6ec-4f8a-8b21-ce4e782720a6} + + + Resource Files + + \ No newline at end of file diff --git a/msvc/libmonoruntime.vcxproj b/msvc/libmonoruntime.vcxproj index 54361b9ef2d..3078de5130e 100644 --- a/msvc/libmonoruntime.vcxproj +++ b/msvc/libmonoruntime.vcxproj @@ -208,6 +208,9 @@ {158073ed-99ae-4196-9edc-ddb2344f8466} + + + {C36612BD-22D3-4B95-85E2-7FDC4FC5D739} Win32Proj diff --git a/msvc/libmonoruntime.vcxproj.filters b/msvc/libmonoruntime.vcxproj.filters index c412bbe885d..6227790707d 100644 --- a/msvc/libmonoruntime.vcxproj.filters +++ b/msvc/libmonoruntime.vcxproj.filters @@ -576,4 +576,9 @@ {e37c9a88-bfb3-47dd-948c-a74dea25b3ad} + + + Resource Files + + \ No newline at end of file diff --git a/msvc/libmonoutils.vcxproj b/msvc/libmonoutils.vcxproj index ae6dadbcc61..bd512ab75e6 100644 --- a/msvc/libmonoutils.vcxproj +++ b/msvc/libmonoutils.vcxproj @@ -144,7 +144,7 @@ - + @@ -157,7 +157,8 @@ - + + @@ -165,11 +166,11 @@ - + - + @@ -205,6 +206,9 @@ {158073ed-99ae-4196-9edc-ddb2344f8466} + + + {8FC2B0C8-51AD-49DF-851F-5D01A77A75E4} Win32Proj diff --git a/msvc/libmonoutils.vcxproj.filters b/msvc/libmonoutils.vcxproj.filters index 8ee4fbe7c97..30b819626b6 100644 --- a/msvc/libmonoutils.vcxproj.filters +++ b/msvc/libmonoutils.vcxproj.filters @@ -408,16 +408,19 @@ Header Files - + Header Files - + Header Files - + Header Files - + + Header Files + + Header Files @@ -440,4 +443,9 @@ Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/winconfig.h b/winconfig.h index d15685302eb..73f67534019 100644 --- a/winconfig.h +++ b/winconfig.h @@ -657,9 +657,15 @@ #elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #define HAVE_CLASSIC_WINAPI_SUPPORT 0 #define HAVE_UWP_WINAPI_SUPPORT 1 +#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT + #error Unsupported WINAPI family +#endif #else #define HAVE_CLASSIC_WINAPI_SUPPORT 0 #define HAVE_UWP_WINAPI_SUPPORT 0 +#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT + #error Unsupported WINAPI family +#endif #endif #endif