mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
fixed implementation of SetErrorMode() which should rather store the mode in the EPROCESS structure
svn path=/trunk/; revision=13136
This commit is contained in:
parent
c0ff13e571
commit
837f31e111
9 changed files with 80 additions and 15 deletions
|
@ -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 @@ UINT
|
|||
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 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
|
|||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if ((GlobalErrorMode & SEM_NOGPFAULTERRORBOX) == 0)
|
||||
if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
|
||||
{
|
||||
#ifdef _X86_
|
||||
PULONG Frame;
|
||||
|
|
|
@ -25,7 +25,7 @@ static PFN_TYPE CcZeroPage = 0;
|
|||
#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
|
||||
|
|
|
@ -100,7 +100,7 @@ static CLIENT_ID LazyCloseThreadId;
|
|||
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
|
||||
|
|
|
@ -62,4 +62,6 @@
|
|||
#include <napi/teb.h>
|
||||
#include <napi/win32.h>
|
||||
|
||||
#include <pseh.h>
|
||||
|
||||
#endif /* INCLUDE_NTOSKRNL_H */
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#include <pseh.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
/* INCLUDES ****************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#include <pseh.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
/* INCLUDE *****************************************************************/
|
||||
|
||||
#include <ntoskrnl.h>
|
||||
#include <pseh.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
|
|
@ -1139,7 +1139,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
*/
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_SET_INFORMATION,
|
||||
PROCESS_QUERY_INFORMATION,
|
||||
PsProcessType,
|
||||
UserMode,
|
||||
(PVOID*)&Process,
|
||||
|
@ -1272,12 +1272,21 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
else
|
||||
{
|
||||
PULONG HardErrMode = (PULONG)ProcessInformation;
|
||||
*HardErrMode = Process->DefaultHardErrorProcessing;
|
||||
|
||||
if (ReturnLength)
|
||||
_SEH_TRY
|
||||
{
|
||||
*ReturnLength = sizeof(ULONG);
|
||||
*HardErrMode = Process->DefaultHardErrorProcessing;
|
||||
if (ReturnLength)
|
||||
{
|
||||
*ReturnLength = sizeof(ULONG);
|
||||
}
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1445,10 +1454,32 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue