+
+2008-03-14 Robert Jordan <robertj@gmx.net>
+
+ * mono-dl.c (w32_load_module): prevent error dialog by resetting
+ the Win32 error mode during LoadLibrary (). Fixes #360363.
+
+ * mono-dl.c (w32_dlerror): kill a warning.
+
2007-MM-DD Yoichi NAKAYAMA <nakayama@pixela.co.jp>
* mono-membar.h: Memory barrier for mips.
DWORD code = GetLastError ();
if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
- code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &buf, 0, NULL))
+ code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL))
{
ret = g_utf16_to_utf8 (buf, wcslen(buf), NULL, NULL, NULL);
LocalFree (buf);
w32_load_module (const char* file, int flags)
{
gpointer hModule = NULL;
- if (file)
- {
+ if (file) {
gunichar2* file_utf16 = g_utf8_to_utf16 (file, strlen (file), NULL, NULL, NULL);
+ guint last_sem = SetErrorMode (SEM_FAILCRITICALERRORS);
+ guint32 last_error = 0;
+
hModule = LoadLibrary (file_utf16);
+ if (!hModule)
+ last_error = GetLastError ();
+
+ SetErrorMode (last_sem);
g_free (file_utf16);
- }
- else
- {
+
+ if (!hModule)
+ SetLastError (last_error);
+ } else {
hModule = GetModuleHandle (NULL);
}
return hModule;