made SetErrorMode() thread-safe
Modified: trunk/reactos/lib/kernel32/except/except.c

Modified: trunk/reactos/lib/kernel32/except/except.c
--- trunk/reactos/lib/kernel32/except/except.c	2005-01-19 14:25:10 UTC (rev 13133)
+++ trunk/reactos/lib/kernel32/except/except.c	2005-01-19 19:14:56 UTC (rev 13134)
@@ -15,25 +15,18 @@
 #define NDEBUG
 #include "../include/debug.h"
 
-UINT GlobalErrMode = 0;
+UINT GlobalErrorMode = 0;
 LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter = UnhandledExceptionFilter;
 
-UINT GetErrorMode(void)
-{
-	return GlobalErrMode;
-}
 
-
 /*
  * @implemented
  */
 UINT 
 STDCALL
-SetErrorMode(  UINT uMode  )
+SetErrorMode(UINT uMode)
 {
-	UINT OldErrMode = GetErrorMode();
-	GlobalErrMode = uMode;
-	return OldErrMode;
+   return (UINT)InterlockedExchange((LONG*)&GlobalErrorMode, (LONG)uMode);
 }
 
 
@@ -121,7 +114,7 @@
       return EXCEPTION_CONTINUE_SEARCH;
    }
 
-   if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
+   if ((GlobalErrorMode & SEM_NOGPFAULTERRORBOX) == 0)
    {
 #ifdef _X86_
       PULONG Frame;