Modified: trunk/reactos/lib/kernel32/except/except.c
Modified: trunk/reactos/ntoskrnl/cc/copy.c
Modified: trunk/reactos/ntoskrnl/cc/view.c
Modified: trunk/reactos/ntoskrnl/include/ntoskrnl.h
Modified: trunk/reactos/ntoskrnl/ke/i386/exp.c
Modified: trunk/reactos/ntoskrnl/mm/pool.c
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
Modified: trunk/reactos/ntoskrnl/ps/process.c
Modified: trunk/reactos/ntoskrnl/ps/w32call.c
--- trunk/reactos/lib/kernel32/except/except.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/lib/kernel32/except/except.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -15,9 +15,28 @@
#define NDEBUG
#include "../include/debug.h"
-UINT GlobalErrorMode = 0;
LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter = UnhandledExceptionFilter;
+UINT
+STDCALL
+GetErrorMode(VOID)
+{
+ NTSTATUS Status;
+ UINT ErrMode;
+
+ Status = NtQueryInformationProcess(NtCurrentProcess(),
+ ProcessDefaultHardErrorMode,
+ (PVOID)&ErrMode,
+ sizeof(ErrMode),
+ NULL);
+ if(!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return 0;
+ }
+
+ return ErrMode;
+}
/*
* @implemented
@@ -26,7 +45,22 @@
STDCALL
SetErrorMode(UINT uMode)
{
- return (UINT)InterlockedExchange((LONG*)&GlobalErrorMode, (LONG)uMode);
+ UINT PrevErrMode;
+ NTSTATUS Status;
+
+ PrevErrMode = GetErrorMode();
+
+ Status = NtSetInformationProcess(NtCurrentProcess(),
+ ProcessDefaultHardErrorMode,
+ (PVOID)&uMode,
+ sizeof(uMode));
+ if(!NT_SUCCESS(Status))
+ {
+ SetLastErrorByStatus(Status);
+ return 0;
+ }
+
+ return PrevErrMode;
}
@@ -114,7 +148,7 @@
return EXCEPTION_CONTINUE_SEARCH;
}
- if ((GlobalErrorMode & SEM_NOGPFAULTERRORBOX) == 0)
+ if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
{
#ifdef _X86_
PULONG Frame;
--- trunk/reactos/ntoskrnl/cc/copy.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/cc/copy.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -25,7 +25,7 @@
#define MAX_RW_LENGTH (256 * 1024)
#if defined(__GNUC__)
-void * alloca(size_t size);
+/* void * alloca(size_t size); */
#elif defined(_MSC_VER)
void* _alloca(size_t size);
#else
--- trunk/reactos/ntoskrnl/cc/view.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/cc/view.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -100,7 +100,7 @@
static volatile BOOLEAN LazyCloseThreadShouldTerminate;
#if defined(__GNUC__)
-void * alloca(size_t size);
+/* void * alloca(size_t size); */
#elif defined(_MSC_VER)
void* _alloca(size_t size);
#else
--- trunk/reactos/ntoskrnl/include/ntoskrnl.h 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/include/ntoskrnl.h 2005-01-19 20:16:26 UTC (rev 13136)
@@ -62,4 +62,6 @@
#include <napi/teb.h>
#include <napi/win32.h>
+#include <pseh.h>
+
#endif /* INCLUDE_NTOSKRNL_H */
--- trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/ke/i386/exp.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -30,7 +30,7 @@
/* INCLUDES *****************************************************************/
#include <ntoskrnl.h>
-#include <pseh.h>
+
#define NDEBUG
#include <internal/debug.h>
--- trunk/reactos/ntoskrnl/mm/pool.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/mm/pool.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -10,7 +10,6 @@
/* INCLUDES ****************************************************************/
#include <ntoskrnl.h>
-#include <pseh.h>
#define NDEBUG
#include <internal/debug.h>
--- trunk/reactos/ntoskrnl/mm/virtual.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/mm/virtual.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -27,7 +27,6 @@
/* INCLUDE *****************************************************************/
#include <ntoskrnl.h>
-#include <pseh.h>
#define NDEBUG
#include <internal/debug.h>
--- trunk/reactos/ntoskrnl/ps/process.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/ps/process.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -1139,7 +1139,7 @@
*/
Status = ObReferenceObjectByHandle(ProcessHandle,
- PROCESS_SET_INFORMATION,
+ PROCESS_QUERY_INFORMATION,
PsProcessType,
UserMode,
(PVOID*)&Process,
@@ -1272,12 +1272,21 @@
else
{
PULONG HardErrMode = (PULONG)ProcessInformation;
- *HardErrMode = Process->DefaultHardErrorProcessing;
+ _SEH_TRY
+ {
+ *HardErrMode = Process->DefaultHardErrorProcessing;
+ if (ReturnLength)
+ {
+ *ReturnLength = sizeof(ULONG);
+ }
- if (ReturnLength)
+ Status = STATUS_SUCCESS;
+ }
+ _SEH_HANDLE
{
- *ReturnLength = sizeof(ULONG);
+ Status = _SEH_GetExceptionCode();
}
+ _SEH_END;
}
break;
@@ -1445,10 +1454,32 @@
ProcessAccessTokenP = (PHANDLE)ProcessInformation;
Status = PspAssignPrimaryToken(Process, *ProcessAccessTokenP);
break;
+
+ case ProcessDefaultHardErrorMode:
+ {
+ if(ProcessInformationLength != sizeof(UINT))
+ {
+ Status = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ else
+ {
+ _SEH_TRY
+ {
+ InterlockedExchange((LONG*)&Process->DefaultHardErrorProcessing,
+ *(PLONG)ProcessInformation);
+ Status = STATUS_SUCCESS;
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END;
+ }
+ break;
+ }
case ProcessLdtInformation:
case ProcessLdtSize:
- case ProcessDefaultHardErrorMode:
case ProcessIoPortHandlers:
case ProcessWorkingSetWatch:
case ProcessUserModeIOPL:
--- trunk/reactos/ntoskrnl/ps/w32call.c 2005-01-19 19:49:57 UTC (rev 13135)
+++ trunk/reactos/ntoskrnl/ps/w32call.c 2005-01-19 20:16:26 UTC (rev 13136)
@@ -25,7 +25,7 @@
#include <internal/debug.h>
#if defined(__GNUC__)
-void * alloca(size_t size);
+/* void * alloca(size_t size); */
#elif defined(_MSC_VER)
void* _alloca(size_t size);
#else