*
* Copyright 2001-2004 Ximian, Inc.
* Copyright 2004-2009 Novell, Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#if defined(HOST_WIN32)
#include "mono/utils/mono-dl.h"
+#include "mono/utils/mono-dl-windows-internals.h"
#include "mono/utils/mono-embed.h"
#include "mono/utils/mono-path.h"
#include <windows.h>
#include <psapi.h>
-
const char*
mono_dl_get_so_prefix (void)
{
gpointer hModule = NULL;
if (file) {
gunichar2* file_utf16 = g_utf8_to_utf16 (file, strlen (file), NULL, NULL, NULL);
+
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
guint last_sem = SetErrorMode (SEM_FAILCRITICALERRORS);
+#endif
guint32 last_error = 0;
hModule = LoadLibrary (file_utf16);
if (!hModule)
last_error = GetLastError ();
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
SetErrorMode (last_sem);
+#endif
+
g_free (file_utf16);
if (!hModule)
FreeLibrary (module->handle);
}
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
void*
-mono_dl_lookup_symbol (MonoDl *module, const char *symbol_name)
+mono_dl_lookup_symbol_in_process (const char *symbol_name)
{
HMODULE *modules;
DWORD buffer_size = sizeof (HMODULE) * 1024;
DWORD needed, i;
gpointer proc = NULL;
- /* get the symbol directly from the specified module */
- if (!module->main_module)
- return GetProcAddress (module->handle, symbol_name);
-
- /* get the symbol from the main module */
- proc = GetProcAddress (module->handle, symbol_name);
- if (proc != NULL)
- return proc;
-
/* get the symbol from the loaded DLLs */
modules = (HMODULE *) g_malloc (buffer_size);
if (modules == NULL)
g_free (modules);
return NULL;
}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
+
+void*
+mono_dl_lookup_symbol (MonoDl *module, const char *symbol_name)
+{
+ gpointer proc = NULL;
+
+ /* get the symbol directly from the specified module */
+ if (!module->main_module)
+ return GetProcAddress (module->handle, symbol_name);
+
+ /* get the symbol from the main module */
+ proc = GetProcAddress (module->handle, symbol_name);
+ if (proc != NULL)
+ return proc;
+
+ /* get the symbol from the loaded DLLs */
+ return mono_dl_lookup_symbol_in_process (symbol_name);
+}
int
mono_dl_convert_flags (int flags)
return 0;
}
+#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
char*
mono_dl_current_error_string (void)
{
}
return ret;
}
+#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
int
mono_dl_get_executable_path (char *buf, int buflen)
return -1; //TODO
}
+const char*
+mono_dl_get_system_dir (void)
+{
+ return NULL;
+}
#endif