mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 23:02:59 +00:00
[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. svn path=/trunk/; revision=71767
This commit is contained in:
parent
7afa7475cc
commit
12df37e35b
4 changed files with 92 additions and 41 deletions
|
@ -771,7 +771,7 @@
|
||||||
@ stdcall -arch=x86_64 RtlLookupFunctionEntry(long ptr ptr)
|
@ stdcall -arch=x86_64 RtlLookupFunctionEntry(long ptr ptr)
|
||||||
767 stdcall RtlMakeSelfRelativeSD(ptr ptr ptr)
|
767 stdcall RtlMakeSelfRelativeSD(ptr ptr ptr)
|
||||||
768 stdcall RtlMapGenericMask(long ptr)
|
768 stdcall RtlMapGenericMask(long ptr)
|
||||||
# stdcall RtlMapSecurityErrorToNtStatus
|
769 stdcall RtlMapSecurityErrorToNtStatus(long)
|
||||||
770 stdcall RtlMoveMemory(ptr ptr long)
|
770 stdcall RtlMoveMemory(ptr ptr long)
|
||||||
771 stdcall RtlMultiAppendUnicodeStringBuffer(ptr long ptr)
|
771 stdcall RtlMultiAppendUnicodeStringBuffer(ptr long ptr)
|
||||||
772 stdcall RtlMultiByteToUnicodeN(ptr long ptr ptr long)
|
772 stdcall RtlMultiByteToUnicodeN(ptr long ptr ptr long)
|
||||||
|
|
|
@ -609,7 +609,7 @@ RtlIsGenericTableEmptyAvl(
|
||||||
#endif /* RTL_USE_AVL_TABLES */
|
#endif /* RTL_USE_AVL_TABLES */
|
||||||
|
|
||||||
//
|
//
|
||||||
// Error and Exception Functions
|
// Exception and Error Functions
|
||||||
//
|
//
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
PVOID
|
PVOID
|
||||||
|
@ -637,13 +637,11 @@ RtlSetUnhandledExceptionFilter(
|
||||||
_In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
|
_In_ PRTLP_UNHANDLED_EXCEPTION_FILTER TopLevelExceptionFilter
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif /* NTOS_MODE_USER */
|
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
LONG
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlCaptureContext(
|
RtlUnhandledExceptionFilter(
|
||||||
_Out_ PCONTEXT ContextRecord
|
_In_ struct _EXCEPTION_POINTERS* ExceptionInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -674,6 +672,58 @@ RtlDecodeSystemPointer(
|
||||||
_In_ PVOID Pointer
|
_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
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlCaptureContext(
|
||||||
|
_Out_ PCONTEXT ContextRecord
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -702,10 +752,10 @@ RtlNtStatusToDosErrorNoTeb(
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlSetLastWin32ErrorAndNtStatusFromNtStatus(
|
RtlMapSecurityErrorToNtStatus(
|
||||||
_In_ NTSTATUS Status
|
_In_ ULONG SecurityError
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
|
@ -723,13 +773,6 @@ RtlRaiseStatus(
|
||||||
_In_ NTSTATUS Status
|
_In_ NTSTATUS Status
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
|
||||||
LONG
|
|
||||||
NTAPI
|
|
||||||
RtlUnhandledExceptionFilter(
|
|
||||||
_In_ struct _EXCEPTION_POINTERS* ExceptionInfo
|
|
||||||
);
|
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -46,21 +46,23 @@ static const struct error_table error_table[20];
|
||||||
* The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no
|
* The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no
|
||||||
* mapping defined.
|
* mapping defined.
|
||||||
*/
|
*/
|
||||||
ULONG WINAPI RtlNtStatusToDosErrorNoTeb( NTSTATUS status )
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
RtlNtStatusToDosErrorNoTeb(IN NTSTATUS Status)
|
||||||
{
|
{
|
||||||
const struct error_table *table = error_table;
|
const struct error_table *table = error_table;
|
||||||
|
|
||||||
if (!status || (status & 0x20000000)) return status;
|
if (!Status || (Status & 0x20000000)) return Status;
|
||||||
|
|
||||||
/* 0xd... is equivalent to 0xc... */
|
/* 0xd... is equivalent to 0xc... */
|
||||||
if ((status & 0xf0000000) == 0xd0000000) status &= ~0x10000000;
|
if ((Status & 0xf0000000) == 0xd0000000) Status &= ~0x10000000;
|
||||||
|
|
||||||
while (table->start)
|
while (table->start)
|
||||||
{
|
{
|
||||||
if ((ULONG)status < table->start) break;
|
if ((ULONG)Status < table->start) break;
|
||||||
if ((ULONG)status < table->end)
|
if ((ULONG)Status < table->end)
|
||||||
{
|
{
|
||||||
DWORD ret = table->table[status - table->start];
|
DWORD ret = table->table[Status - table->start];
|
||||||
/* unknown entries are 0 */
|
/* unknown entries are 0 */
|
||||||
if (!ret) goto no_mapping;
|
if (!ret) goto no_mapping;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -69,11 +71,11 @@ ULONG WINAPI RtlNtStatusToDosErrorNoTeb( NTSTATUS status )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now some special cases */
|
/* now some special cases */
|
||||||
if (HIWORD(status) == 0xc001) return LOWORD(status);
|
if (HIWORD(Status) == 0xc001) return LOWORD(Status);
|
||||||
if (HIWORD(status) == 0x8007) return LOWORD(status);
|
if (HIWORD(Status) == 0x8007) return LOWORD(Status);
|
||||||
|
|
||||||
no_mapping:
|
no_mapping:
|
||||||
DPRINT1( "no mapping for %08x\n", status );
|
DPRINT1( "no mapping for %08x\n", Status );
|
||||||
return ERROR_MR_MID_NOT_FOUND;
|
return ERROR_MR_MID_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,15 +91,17 @@ no_mapping:
|
||||||
* The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no
|
* The mapped Win32 error code, or ERROR_MR_MID_NOT_FOUND if there is no
|
||||||
* mapping defined.
|
* mapping defined.
|
||||||
*/
|
*/
|
||||||
ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status )
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
RtlNtStatusToDosError(IN NTSTATUS Status)
|
||||||
{
|
{
|
||||||
PTEB Teb = NtCurrentTeb();
|
PTEB Teb = NtCurrentTeb();
|
||||||
|
|
||||||
if (NULL != Teb)
|
if (NULL != Teb)
|
||||||
{
|
{
|
||||||
Teb->LastStatusValue = status;
|
Teb->LastStatusValue = Status;
|
||||||
}
|
}
|
||||||
return RtlNtStatusToDosErrorNoTeb( status );
|
return RtlNtStatusToDosErrorNoTeb(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
|
@ -105,7 +109,9 @@ ULONG WINAPI RtlNtStatusToDosError( NTSTATUS status )
|
||||||
*
|
*
|
||||||
* Get the current per-thread status.
|
* Get the current per-thread status.
|
||||||
*/
|
*/
|
||||||
NTSTATUS WINAPI RtlGetLastNtStatus(void)
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlGetLastNtStatus(VOID)
|
||||||
{
|
{
|
||||||
return NtCurrentTeb()->LastStatusValue;
|
return NtCurrentTeb()->LastStatusValue;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +127,9 @@ NTSTATUS WINAPI RtlGetLastNtStatus(void)
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* The current error value for the thread, as set by SetLastWin32Error() or SetLastError().
|
* The current error value for the thread, as set by SetLastWin32Error() or SetLastError().
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI RtlGetLastWin32Error(void)
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
RtlGetLastWin32Error(VOID)
|
||||||
{
|
{
|
||||||
return NtCurrentTeb()->LastErrorValue;
|
return NtCurrentTeb()->LastErrorValue;
|
||||||
}
|
}
|
||||||
|
@ -138,9 +146,11 @@ DWORD WINAPI RtlGetLastWin32Error(void)
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Nothing.
|
* Nothing.
|
||||||
*/
|
*/
|
||||||
void WINAPI RtlSetLastWin32Error( DWORD err )
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlSetLastWin32Error(IN ULONG LastError)
|
||||||
{
|
{
|
||||||
NtCurrentTeb()->LastErrorValue = err;
|
NtCurrentTeb()->LastErrorValue = LastError;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -154,9 +164,11 @@ void WINAPI RtlSetLastWin32Error( DWORD err )
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Nothing.
|
* Nothing.
|
||||||
*/
|
*/
|
||||||
void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus( NTSTATUS status )
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlSetLastWin32ErrorAndNtStatusFromNtStatus(IN NTSTATUS Status)
|
||||||
{
|
{
|
||||||
NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError( status );
|
NtCurrentTeb()->LastErrorValue = RtlNtStatusToDosError(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -164,9 +176,7 @@ void WINAPI RtlSetLastWin32ErrorAndNtStatusFromNtStatus( NTSTATUS status )
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlMapSecurityErrorToNtStatus(
|
RtlMapSecurityErrorToNtStatus(IN ULONG SecurityError)
|
||||||
IN ULONG SecurityError
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_NOT_IMPLEMENTED;
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
// FIXME: Add this prototype to winternl.h / rtlfuncs.h / ...
|
|
||||||
NTSTATUS NTAPI RtlGetLastNtStatus(VOID);
|
|
||||||
|
|
||||||
/* GLOBALS ********************************************************************/
|
/* GLOBALS ********************************************************************/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue