From bdebad094ce826da0498ccc23b0a054b3636d66e Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Tue, 2 Feb 2010 13:50:16 +0100 Subject: [PATCH] ntdll: Add RtlSetThreadErrorMode and RtlGetThreadErrorMode. --- dlls/ntdll/ntdll.spec | 2 ++ dlls/ntdll/rtl.c | 23 +++++++++++++++++++++++ dlls/ntdll/tests/rtl.c | 2 +- include/winternl.h | 2 ++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 67a9d13364..c7c81e8bcd 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -643,6 +643,7 @@ @ stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr) # @ stub RtlGetSecurityDescriptorRMControl # @ stub RtlGetSetBootStatusData +@ stdcall RtlGetThreadErrorMode() # @ stub RtlGetUnloadEventTrace @ stub RtlGetUserInfoHeap @ stdcall RtlGetVersion(ptr) @@ -842,6 +843,7 @@ # @ stub RtlSetSecurityDescriptorRMControl @ stub RtlSetSecurityObject # @ stub RtlSetSecurityObjectEx +@ stdcall RtlSetThreadErrorMode(long ptr) # @ stub RtlSetThreadIsCritical # @ stub RtlSetThreadPoolStartFunc @ stdcall RtlSetTimeZoneInformation(ptr) diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index ad4bc10d99..69a2955421 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1165,3 +1165,26 @@ NTSTATUS WINAPI RtlDecompressBuffer(USHORT CompressionFormat, PUCHAR Uncompresse return STATUS_NOT_IMPLEMENTED; } + +/*********************************************************************** + * RtlSetThreadErrorMode [NTDLL.@] + */ +NTSTATUS WINAPI RtlSetThreadErrorMode( DWORD mode, LPDWORD oldmode ) +{ + if (mode & ~0x70) + return STATUS_INVALID_PARAMETER_1; + + if (oldmode) + *oldmode = NtCurrentTeb()->HardErrorDisabled; + + NtCurrentTeb()->HardErrorDisabled = mode; + return STATUS_SUCCESS; +} + +/*********************************************************************** + * RtlGetThreadErrorMode [NTDLL.@] + */ +DWORD WINAPI RtlGetThreadErrorMode( void ) +{ + return NtCurrentTeb()->HardErrorDisabled; +} diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 61ceb72fea..6e76a3cc58 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -1039,7 +1039,7 @@ static void test_RtlThreadErrorMode(void) if (!pRtlGetThreadErrorMode || !pRtlSetThreadErrorMode) { - skip("RtlGetThreadErrorMode and/or RtlSetThreadErrorMode not available\n"); + win_skip("RtlGetThreadErrorMode and/or RtlSetThreadErrorMode not available\n"); return; } diff --git a/include/winternl.h b/include/winternl.h index 08172b0535..2f88cad2a4 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2273,6 +2273,7 @@ NTSYSAPI ULONG WINAPI RtlGetNtGlobalFlags(void); NTSYSAPI BOOLEAN WINAPI RtlGetNtProductType(LPDWORD); NTSYSAPI NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(PSECURITY_DESCRIPTOR,PSID *,PBOOLEAN); NTSYSAPI ULONG WINAPI RtlGetProcessHeaps(ULONG,HANDLE*); +NTSYSAPI DWORD WINAPI RtlGetThreadErrorMode(void); NTSYSAPI NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,PBOOLEAN,PACL *,PBOOLEAN); NTSYSAPI NTSTATUS WINAPI RtlGetVersion(RTL_OSVERSIONINFOEXW*); NTSYSAPI NTSTATUS WINAPI RtlGUIDFromString(PUNICODE_STRING,GUID*); @@ -2364,6 +2365,7 @@ NTSYSAPI NTSTATUS WINAPI RtlSetIoCompletionCallback(HANDLE,PRTL_OVERLAPPED_COMP NTSYSAPI void WINAPI RtlSetLastWin32Error(DWORD); NTSYSAPI void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus(NTSTATUS); NTSYSAPI NTSTATUS WINAPI RtlSetSaclSecurityDescriptor(PSECURITY_DESCRIPTOR,BOOLEAN,PACL,BOOLEAN); +NTSYSAPI NTSTATUS WINAPI RtlSetThreadErrorMode(DWORD,LPDWORD); NTSYSAPI NTSTATUS WINAPI RtlSetTimeZoneInformation(const RTL_TIME_ZONE_INFORMATION*); NTSYSAPI SIZE_T WINAPI RtlSizeHeap(HANDLE,ULONG,const void*); NTSYSAPI NTSTATUS WINAPI RtlStringFromGUID(REFGUID,PUNICODE_STRING); -- 2.32.0.93.g670b81a890