Commit 170e5561 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

win32: call SetErrorMode() while still single-threaded

(This is required by MSDN.)
parent 81055423
...@@ -26,10 +26,12 @@ ...@@ -26,10 +26,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
# include <getopt.h> # include <getopt.h>
#endif #endif
#ifdef WIN32
# include <windows.h>
#endif
static void version (void) static void version (void)
{ {
...@@ -47,6 +49,9 @@ static void usage (const char *path) ...@@ -47,6 +49,9 @@ static void usage (const char *path)
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
#ifdef WIN32
SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
static const struct option opts[] = static const struct option opts[] =
{ {
{ "force", no_argument, NULL, 'f' }, { "force", no_argument, NULL, 'f' },
......
...@@ -79,6 +79,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, ...@@ -79,6 +79,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share"); putenv("VLC_DATA_PATH=Z:"TOP_SRCDIR"/share");
#endif #endif
SetErrorMode(SEM_FAILCRITICALERRORS);
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0); HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
/* SetProcessDEPPolicy */ /* SetProcessDEPPolicy */
......
...@@ -58,13 +58,9 @@ int module_Load( vlc_object_t *p_this, const char *psz_file, ...@@ -58,13 +58,9 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
return -1; return -1;
module_handle_t handle; module_handle_t handle;
/* FIXME: this is not thread-safe -- Courmisch */
UINT mode = SetErrorMode (SEM_FAILCRITICALERRORS);
SetErrorMode (mode|SEM_FAILCRITICALERRORS);
handle = LoadLibraryW (wfile); handle = LoadLibraryW (wfile);
SetErrorMode (mode);
free (wfile); free (wfile);
if( handle == NULL ) if( handle == NULL )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment