Author: hbelusca Date: Sat Jul 2 20:37:35 2016 New Revision: 71767
URL: http://svn.reactos.org/svn/reactos?rev=71767&view=rev Log: [NTDLL] Export RtlMapSecurityErrorToNtStatus since we have it available in our RTL library (however it is still only stubbed).
[RTL][NDK] - NT-ify a bit error.c - Add the prototypes of the functions that manipulate the "last Win32 error" and "last NT status". - Add the prototypes of the functions that get & set the thread-error-mode (for hard-errors). - Define some prototypes for NTOS_MODE_USER only.
[CONSRV] RtlGetLastNtStatus is now in the NDK, no need to keep its prototype there anymore.
Modified: trunk/reactos/dll/ntdll/def/ntdll.spec trunk/reactos/sdk/include/ndk/rtlfuncs.h trunk/reactos/sdk/lib/rtl/error.c trunk/reactos/win32ss/user/winsrv/consrv/console.c
Modified: trunk/reactos/dll/ntdll/def/ntdll.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/def/ntdll.spec?re... ============================================================================== --- trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/def/ntdll.spec [iso-8859-1] Sat Jul 2 20:37:35 2016 @@ -771,7 +771,7 @@ @ stdcall -arch=x86_64 RtlLookupFunctionEntry(long ptr ptr) 767 stdcall RtlMakeSelfRelativeSD(ptr ptr ptr) 768 stdcall RtlMapGenericMask(long ptr) -# stdcall RtlMapSecurityErrorToNtStatus +769 stdcall RtlMapSecurityErrorToNtStatus(long) 770 stdcall RtlMoveMemory(ptr ptr long) 771 stdcall RtlMultiAppendUnicodeStringBuffer(ptr long ptr) 772 stdcall RtlMultiByteToUnicodeN(ptr long ptr ptr long)
Modified: trunk/reactos/sdk/include/ndk/rtlfuncs.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/ndk/rtlfuncs.h?... ============================================================================== --- trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/ndk/rtlfuncs.h [iso-8859-1] Sat Jul 2 20:37:35 2016 @@ -609,7 +609,7 @@ #endif /* RTL_USE_AVL_TABLES */
// -// Error and Exception Functions +// Exception and Error Functions // NTSYSAPI PVOID @@ -637,6 +637,84 @@ _In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter );
+NTSYSAPI +LONG +NTAPI +RtlUnhandledExceptionFilter( + _In_ struct _EXCEPTION_POINTERS* ExceptionInfo +); + +NTSYSAPI +PVOID +NTAPI +RtlEncodePointer( + _In_ PVOID Pointer +); + +NTSYSAPI +PVOID +NTAPI +RtlDecodePointer( + _In_ PVOID Pointer +); + +NTSYSAPI +PVOID +NTAPI +RtlEncodeSystemPointer( + _In_ PVOID Pointer +); + +NTSYSAPI +PVOID +NTAPI +RtlDecodeSystemPointer( + _In_ PVOID Pointer +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlGetLastNtStatus( + VOID +); + +NTSYSAPI +ULONG +NTAPI +RtlGetLastWin32Error( + VOID +); + +NTSYSAPI +VOID +NTAPI +RtlSetLastWin32Error( + _In_ ULONG LastError +); + +NTSYSAPI +VOID +NTAPI +RtlSetLastWin32ErrorAndNtStatusFromNtStatus( + _In_ NTSTATUS Status +); + +NTSYSAPI +NTSTATUS +NTAPI +RtlSetThreadErrorMode( + _In_ ULONG NewMode, + _Out_opt_ PULONG OldMode +); + +NTSYSAPI +ULONG +NTAPI +RtlGetThreadErrorMode( + VOID +); + #endif /* NTOS_MODE_USER */
NTSYSAPI @@ -644,34 +722,6 @@ NTAPI RtlCaptureContext( _Out_ PCONTEXT ContextRecord -); - -NTSYSAPI -PVOID -NTAPI -RtlEncodePointer( - _In_ PVOID Pointer -); - -NTSYSAPI -PVOID -NTAPI -RtlDecodePointer( - _In_ PVOID Pointer -); - -NTSYSAPI -PVOID -NTAPI -RtlEncodeSystemPointer( - _In_ PVOID Pointer -); - -NTSYSAPI -PVOID -NTAPI -RtlDecodeSystemPointer( - _In_ PVOID Pointer );
NTSYSAPI @@ -702,10 +752,10 @@ );
NTSYSAPI -VOID -NTAPI -RtlSetLastWin32ErrorAndNtStatusFromNtStatus( - _In_ NTSTATUS Status +NTSTATUS +NTAPI +RtlMapSecurityErrorToNtStatus( + _In_ ULONG SecurityError );
NTSYSAPI @@ -721,13 +771,6 @@ NTAPI RtlRaiseStatus( _In_ NTSTATUS Status -); - -NTSYSAPI -LONG -NTAPI -RtlUnhandledExceptionFilter( - _In_ struct _EXCEPTION_POINTERS* ExceptionInfo );
NTSYSAPI
Modified: trunk/reactos/sdk/lib/rtl/error.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/lib/rtl/error.c?rev=717... ============================================================================== --- trunk/reactos/sdk/lib/rtl/error.c [iso-8859-1] (original) +++ trunk/reactos/sdk/lib/rtl/error.c [iso-8859-1] Sat Jul 2 20:37:35 2016 @@ -46,21 +46,23 @@ * The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no * mapping defined. */ -ULONG WINAPI RtlNtStatusToDosErrorNoTeb( NTSTATUS status ) +ULONG +NTAPI +RtlNtStatusToDosErrorNoTeb(IN NTSTATUS Status) { const struct error_table *table = error_table;
- if (!status || (status & 0x20000000)) return status; + if (!Status || (Status & 0x20000000)) return Status;
/* 0xd... is equivalent to 0xc... */ - if ((status & 0xf0000000) == 0xd0000000) status &= ~0x10000000; + if ((Status & 0xf0000000) == 0xd0000000) Status &= ~0x10000000;
while (table->start) { - if ((ULONG)status < table->start) break; - if ((ULONG)status < table->end) + if ((ULONG)Status < table->start) break; + if ((ULONG)Status < table->end) { - DWORD ret = table->table[status - table->start]; + DWORD ret = table->table[Status - table->start]; /* unknown entries are 0 */ if (!ret) goto no_mapping; return ret; @@ -69,11 +71,11 @@ }
/* now some special cases */ - if (HIWORD(status) == 0xc001) return LOWORD(status); - if (HIWORD(status) == 0x8007) return LOWORD(status); + if (HIWORD(Status) == 0xc001) return LOWORD(Status); + if (HIWORD(Status) == 0x8007) return LOWORD(Status);
no_mapping: - DPRINT1( "no mapping for %08x\n", status ); + DPRINT1( "no mapping for %08x\n", Status ); return ERROR_MR_MID_NOT_FOUND; }
@@ -89,15 +91,17 @@ * The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no * mapping defined. */ -ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status ) -{ - PTEB Teb = NtCurrentTeb (); +ULONG +NTAPI +RtlNtStatusToDosError(IN NTSTATUS Status) +{ + PTEB Teb = NtCurrentTeb();
if (NULL != Teb) { - Teb->LastStatusValue = status; + Teb->LastStatusValue = Status; } - return RtlNtStatusToDosErrorNoTeb( status ); + return RtlNtStatusToDosErrorNoTeb(Status); }
/********************************************************************** @@ -105,7 +109,9 @@ * * Get the current per-thread status. */ -NTSTATUS WINAPI RtlGetLastNtStatus(void) +NTSTATUS +NTAPI +RtlGetLastNtStatus(VOID) { return NtCurrentTeb()->LastStatusValue; } @@ -121,7 +127,9 @@ * RETURNS * The current error value for the thread, as set by SetLastWin32Error() or SetLastError(). */ -DWORD WINAPI RtlGetLastWin32Error(void) +ULONG +NTAPI +RtlGetLastWin32Error(VOID) { return NtCurrentTeb()->LastErrorValue; } @@ -138,9 +146,11 @@ * RETURNS * Nothing. */ -void WINAPI RtlSetLastWin32Error( DWORD err ) -{ - NtCurrentTeb()->LastErrorValue = err; +VOID +NTAPI +RtlSetLastWin32Error(IN ULONG LastError) +{ + NtCurrentTeb()->LastErrorValue = LastError; }
/*********************************************************************** @@ -154,9 +164,11 @@ * RETURNS * Nothing. */ -void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus( NTSTATUS status ) -{ - NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError( status ); +VOID +NTAPI +RtlSetLastWin32ErrorAndNtStatusFromNtStatus(IN NTSTATUS Status) +{ + NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError(Status); }
/* @@ -164,9 +176,7 @@ */ NTSTATUS NTAPI -RtlMapSecurityErrorToNtStatus( - IN ULONG SecurityError - ) +RtlMapSecurityErrorToNtStatus(IN ULONG SecurityError) { UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED;
Modified: trunk/reactos/win32ss/user/winsrv/consrv/console.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv/... ============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/console.c [iso-8859-1] Sat Jul 2 20:37:35 2016 @@ -24,8 +24,6 @@ #define NDEBUG #include <debug.h>
-// FIXME: Add this prototype to winternl.h / rtlfuncs.h / ... -NTSTATUS NTAPI RtlGetLastNtStatus(VOID);
/* GLOBALS ********************************************************************/