forked from mono/mono
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mono#3707 from lateralusX/jlorenss/win-api-family-…
…support-libmonoutils Build libmonoutils under none desktop Windows API family.
- Loading branch information
Showing
26 changed files
with
862 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* mono-dl-windows-uwp.c: UWP dl support for Mono. | ||
* | ||
* Copyright 2016 Microsoft | ||
* Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
#include <config.h> | ||
#include <glib.h> | ||
|
||
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) | ||
#include <Windows.h> | ||
#include "mono/utils/mono-dl-windows.h" | ||
|
||
void* | ||
mono_dl_lookup_symbol_in_process (const char *symbol_name) | ||
{ | ||
g_unsupported_api ("EnumProcessModules"); | ||
SetLastError (ERROR_NOT_SUPPORTED); | ||
|
||
return NULL; | ||
} | ||
|
||
char* | ||
mono_dl_current_error_string (void) | ||
{ | ||
char *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_mono_dl_windows_uwp_quiet_lnk4221(void) {} | ||
#endif | ||
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef __MONO_UTILS_DL_WINDOWS_H__ | ||
#define __MONO_UTILS_DL_WINDOWS_H__ | ||
|
||
#include <config.h> | ||
#include <glib.h> | ||
|
||
#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__ */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* mono-dl-windows-uwp.c: UWP dl support for Mono. | ||
* | ||
* Copyright 2016 Microsoft | ||
* Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
*/ | ||
#include <config.h> | ||
#include <glib.h> | ||
|
||
#if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) | ||
#include <Windows.h> | ||
#include <mono/utils/mono-mmap-windows.h> | ||
|
||
void* | ||
mono_file_map (size_t length, int flags, int fd, guint64 offset, void **ret_handle) | ||
{ | ||
void *ptr; | ||
int mflags = 0; | ||
HANDLE file, mapping; | ||
int prot = mono_mmap_win_prot_from_flags (flags); | ||
|
||
mflags = FILE_MAP_READ; | ||
if (flags & MONO_MMAP_WRITE) | ||
mflags = FILE_MAP_COPY; | ||
|
||
file = (HANDLE) _get_osfhandle (fd); | ||
mapping = CreateFileMappingFromApp (file, NULL, prot, length, NULL); | ||
|
||
if (mapping == NULL) | ||
return NULL; | ||
|
||
ptr = MapViewOfFileFromApp (mapping, mflags, offset, length); | ||
|
||
if (ptr == NULL) { | ||
CloseHandle (mapping); | ||
return NULL; | ||
} | ||
|
||
*ret_handle = (void*)mapping; | ||
return ptr; | ||
} | ||
|
||
int | ||
mono_file_unmap (void *addr, void *handle) | ||
{ | ||
UnmapViewOfFile (addr); | ||
CloseHandle ((HANDLE)handle); | ||
return 0; | ||
} | ||
|
||
#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 | ||
#endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */ |
Oops, something went wrong.