Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

error.c File Reference

#include <ntrtlp.h>
#include "winerror.h"
#include "error.h"

Go to the source code of this file.

Functions

ULONG RtlNtStatusToDosError (IN NTSTATUS Status)
ULONG RtlNtStatusToDosErrorNoTeb (IN NTSTATUS Status)


Function Documentation

ULONG RtlNtStatusToDosError IN NTSTATUS  Status  ) 
 

Definition at line 40 of file error.c.

References RtlNtStatusToDosErrorNoTeb(), and Status.

Referenced by _ExitWindowsEx(), ClientThread(), IsPrivileged(), main(), and ServerThread().

00046 : 00047 00048 This routine converts an NT status code to its DOS/OS|2 equivalent. 00049 Remembers the Status code value in the TEB. 00050 00051 Arguments: 00052 00053 Status - Supplies the status value to convert. 00054 00055 Return Value: 00056 00057 The matching DOS/OS|2 error code. 00058 00059 --*/ 00060 00061 { 00062 PTEB Teb; 00063 00064 Teb = NtCurrentTeb(); 00065 if ( Teb ) { 00066 Teb->LastStatusValue = Status; 00067 } 00068 00069 return RtlNtStatusToDosErrorNoTeb( Status ); 00070 }

ULONG RtlNtStatusToDosErrorNoTeb IN NTSTATUS  Status  ) 
 

Definition at line 73 of file error.c.

References DbgPrint, Index, Offset, and Status.

Referenced by RtlNtStatusToDosError().

00079 : 00080 00081 This routine converts an NT status code to its DOS/OS 2 equivalent 00082 and returns the translated value. 00083 00084 Arguments: 00085 00086 Status - Supplies the status value to convert. 00087 00088 Return Value: 00089 00090 The matching DOS/OS 2 error code. 00091 00092 --*/ 00093 00094 { 00095 00096 ULONG Offset; 00097 ULONG Entry; 00098 ULONG Index; 00099 00100 // 00101 // Convert any HRESULTs to their original form of a NTSTATUS or a 00102 // WIN32 error 00103 // 00104 00105 00106 if (Status & 0x20000000) { 00107 00108 // 00109 // The customer bit is set so lets just pass the 00110 // error code on thru 00111 // 00112 00113 return Status; 00114 00115 } 00116 else if ((Status & 0xffff0000) == 0x80070000) { 00117 00118 // 00119 // The status code was a win32 error already. 00120 // 00121 00122 return(Status & 0x0000ffff); 00123 } 00124 else if ((Status & 0xf0000000) == 0xd0000000) { 00125 00126 // 00127 // The status code is a HRESULT from NTSTATUS 00128 // 00129 00130 Status &= 0xcfffffff; 00131 } 00132 00133 // 00134 // Scan the run length table and compute the entry in the translation 00135 // table that maps the specified status code to a DOS error code. 00136 // 00137 00138 Entry = 0; 00139 Index = 0; 00140 do { 00141 if ((ULONG)Status >= RtlpRunTable[Entry + 1].BaseCode) { 00142 Index += (RtlpRunTable[Entry].RunLength * RtlpRunTable[Entry].CodeSize); 00143 00144 } else { 00145 Offset = (ULONG)Status - RtlpRunTable[Entry].BaseCode; 00146 if (Offset >= RtlpRunTable[Entry].RunLength) { 00147 break; 00148 00149 } else { 00150 Index += (Offset * (ULONG)RtlpRunTable[Entry].CodeSize); 00151 if (RtlpRunTable[Entry].CodeSize == 1) { 00152 return (ULONG)RtlpStatusTable[Index]; 00153 00154 } else { 00155 return (((ULONG)RtlpStatusTable[Index + 1] << 16) | 00156 (ULONG)RtlpStatusTable[Index]); 00157 } 00158 } 00159 } 00160 00161 Entry += 1; 00162 } while (Entry < (sizeof(RtlpRunTable) / sizeof(RUN_ENTRY))); 00163 00164 // 00165 // The translation to a DOS error code failed. 00166 // 00167 // The redirector maps unknown OS/2 error codes by ORing 0xC001 into 00168 // the high 16 bits. Detect this and return the low 16 bits if true. 00169 // 00170 00171 if (((ULONG)Status >> 16) == 0xC001) { 00172 return ((ULONG)Status & 0xFFFF); 00173 } 00174 00175 #ifndef NTOS_KERNEL_RUNTIME 00176 DbgPrint("RTL: RtlNtStatusToDosError(0x%lx): No Valid Win32 Error Mapping\n",Status); 00177 DbgPrint("RTL: Edit ntos\\rtl\\generr.c to correct the problem\n"); 00178 DbgPrint("RTL: ERROR_MR_MID_NOT_FOUND is being returned\n"); 00179 00180 #if DBG 00181 DbgBreakPoint(); 00182 #endif // DBG 00183 00184 #endif // NTOS_KERNEL_RUNTIME 00185 00186 return ERROR_MR_MID_NOT_FOUND; 00187 } }


Generated on Sat May 15 19:43:33 2004 for test by doxygen 1.3.7