Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1338 lines
62 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. frserror.c
  5. Abstract:
  6. FRS Error description tables. Contains tables for FRS Errors,
  7. Win32 Errors, Jet Errors and NT Status Codes.
  8. Author:
  9. Billy J. Fuller 01-Apr-1997 Temporary
  10. David A. Orbits 11-Jul-1999
  11. Rewritten to integrate FrsError Codes with Billy's error codes and
  12. handle the problem in a more general way.
  13. Never enuf time to do it right, always enuf time to do it over.
  14. Environment
  15. User mode winnt
  16. --*/
  17. #include <ntreppch.h>
  18. #pragma hdrstop
  19. #include <frs.h>
  20. //
  21. // FRS Format Descriptors.
  22. //
  23. #define FFD_NONE NULL
  24. #define FFD_S "s"
  25. #define FFD_SS "ss"
  26. #define FFD_SSS "sss"
  27. #define FFD_SSSS "ssss"
  28. #define FFD_SSSSS "sssss"
  29. #define FFD_W "w"
  30. #define FFD_WW "ww"
  31. #define FFD_WWW "www"
  32. #define FFD_WWWW "wwww"
  33. #define FFD_WWWWW "wwwww"
  34. #define FFD_WWWWWW "wwwwww"
  35. #define FFD_D "d"
  36. #define FFD_DD "dd"
  37. #define FFD_DDD "ddd"
  38. #define FFD_DW "dw"
  39. #define FFD_WD "wd"
  40. #define FFD_WWD "wwd"
  41. typedef struct _FRS_ERROR_MSG_TABLE {
  42. ULONG ErrorCode; // Error code number for message lookup.
  43. //FRS_ERROR_SEVERITY FrsErrorSeverity;
  44. PCHAR ErrorMsg; // Error Message Code.
  45. PCHAR LongMsg; // Error Message String.
  46. //DWORD EventCode; // Event log error code
  47. //ULONG Flags; // See below.
  48. } FRS_ERROR_MSG_TABLE, *PFRS_ERROR_MSG_TABLE;
  49. /******************************************************************************
  50. *******************************************************************************
  51. ** **
  52. ** **
  53. ** F R S E R R O R D E S C R I P T I O N T A B L E **
  54. ** **
  55. ** **
  56. *******************************************************************************
  57. ******************************************************************************/
  58. FRS_ERROR_MSG_TABLE FrsErrorMsgTable[] = {
  59. {FrsErrorAccess, "FrsErrorAccess" , "couldn't access a file or the db"},
  60. {FrsErrorBadOutLogPartnerData, "FrsErrorBadOutLogPartnerData" , "Either the data was corrupt, unavail or was wrong"},
  61. {FrsErrorBadParam, "FrsErrorBadParam" , "Bad parameter to a function"},
  62. {FrsErrorBadPathname, "FrsErrorBadPathname" , "Invalid path name" },
  63. {FrsErrorBufferOverflow, "FrsErrorBufferOverflow" , "Buffer overflow NTSTATUS"},
  64. {FrsErrorCantMoveOut, "FrsErrorCantMoveOut" , "Request for a Moveout of a non-empty directory failed"},
  65. {FrsErrorChgOrderAbort, "FrsErrorChgOrderAbort" , "Change order processing has been aborted"},
  66. {FrsErrorCmdPktTimeOut, "FrsErrorCmdPktTimeOut" , "Command packet timeout"},
  67. {FrsErrorCmdSrvFailed, "FrsErrorCmdSrvFailed" , "A command server request failed to get submitted"},
  68. {FrsErrorConflict, "FrsErrorConflict" , "Record or table create conflict"},
  69. {FrsErrorDampened, "FrsErrorDampened" , "This request is suppressed because it has already been seen"},
  70. {FrsErrorDatabaseCorrupted, "FrsErrorDatabaseCorrupted" , "not a db or a scrambled db"},
  71. {FrsErrorDatabaseNotFound, "FrsErrorDatabaseNotFound" , "no db or path to db is in error"},
  72. {FrsErrorDbWriteConflict, "FrsErrorDbWriteConflict" , "DB update conflict if two sessions try to update the same record"},
  73. {FrsErrorDeleteRequested, "FrsErrorDeleteRequested" , "Enum function status return to delete entry"},
  74. {FrsErrorDirCreateFailed, "FrsErrorDirCreateFailed" , "We failed to create a new DIR. This stops repl"},
  75. {FrsErrorDirNotEmpty, "FrsErrorDirNotEmpty" , "Directory not empty" },
  76. {FrsErrorDiskSpace, "FrsErrorDiskSpace" , "out of disk space"},
  77. {FrsErrorEndOfTable, "FrsErrorEndOfTable" , "No next record, end of table hit"},
  78. {FrsErrorFileExists, "FrsErrorFileExists" , "File already Eeists" },
  79. {FrsErrorFoundKey, "FrsErrorFoundKey" , "The Key being searched by QHashEnumerateTable was found"},
  80. {FrsErrorIdtFileIsDeleted, "FrsErrorIdtFileIsDeleted" , "File is marked deleted in IDTable"},
  81. {FrsErrorInfo, "FrsErrorInfo" , "informational error, e.g. JET_errObjectNotFound"},
  82. {FrsErrorInternalError, "FrsErrorInternalError" , "unexpected error occurred - catchall"},
  83. {FrsErrorInvalidChangeOrder, "FrsErrorInvalidChangeOrder" , "Invalid change order"},
  84. {FrsErrorInvalidGuid, "FrsErrorInvalidGuid" , "The generated Guid is missing the net address"},
  85. {FrsErrorInvalidHandle, "FrsErrorInvalidHandle" , "Invalid File Handle"},
  86. {FrsErrorInvalidOperation, "FrsErrorInvalidOperation" , "Invalid operation requested"},
  87. {FrsErrorInvalidRegistryParam, "FrsErrorInvalidRegistryParam" , "Invalid registry parameter"},
  88. {FrsErrorJetSecIndexCorrupted, "FrsErrorJetSecIndexCorrupted" , "Jet (upgrade, collating, jet err -1414)"},
  89. {FrsErrorJournalInitFailed, "FrsErrorJournalInitFailed" , "The NTFS journal failed to initialize"},
  90. {FrsErrorJournalPauseFailed, "FrsErrorJournalPauseFailed" , "The NTFS journal failed to Pause, could be timeout"},
  91. {FrsErrorJournalReplicaStop, "FrsErrorJournalReplicaStop" , "Failed to detatch the replica from The journal"},
  92. {FrsErrorJournalStartFailed, "FrsErrorJournalStartFailed" , "The NTFS journal failed to start"},
  93. {FrsErrorJournalStateWrong, "FrsErrorJournalStateWrong" , "The NTFS journal is in an unexpected state"},
  94. {FrsErrorJournalWrapError, "FrsErrorJournalWrapError" , "Initial NTFS journal record not present. Journal has wrapped"},
  95. {FrsErrorKeyDuplicate, "FrsErrorKeyDuplicate" , "An attempt to insert a record with a duplicate key"},
  96. {FrsErrorMoreWork, "FrsErrorMoreWork" , "There is more work to do on this command / operation"},
  97. {FrsErrorNameMorphConflict, "FrsErrorNameMorphConflict" , "File name morph conflict was detected"},
  98. {FrsErrorNoOpenJournals, "FrsErrorNoOpenJournals" , "Can't start replication because no journals were opened"},
  99. {FrsErrorNoPrivileges, "FrsErrorNoPrivileges" , "Couldn't get the necessary privileges to run"},
  100. {FrsErrorNotFound, "FrsErrorNotFound" , "Record or table not found"},
  101. {FrsErrorNotInitialized, "FrsErrorNotInitialized" , "Function called without proper initialization"},
  102. {FrsErrorOplockNotGranted, "FrsErrorOplockNotGranted" , "Op lock not granted" },
  103. {FrsErrorPartnerActivateFailed, "FrsErrorPartnerActivateFailed", "Failed to activate an outbound partner"},
  104. {FrsErrorPreInstallDirectory, "FrsErrorPreInstallDirectory" , "creating preinstall directory"},
  105. {FrsErrorPreinstallCreFail, "FrsErrorPreinstallCreFail" , "Failed to create the pre-install dir"},
  106. {FrsErrorPrepareRoot, "FrsErrorPrepareRoot" , "Could not prepare the root dir for replication, bad path? share viol?"},
  107. {FrsErrorQueueIsRundown, "FrsErrorQueueIsRundown" , "The request queue has been rundown"},
  108. {FrsErrorRecordLocked, "FrsErrorRecordLocked" , "The record being accessed is locked"},
  109. {FrsErrorReplicaPhase1Failed, "FrsErrorReplicaPhase1Failed" , "Phase 1 of replica set init failed"},
  110. {FrsErrorReplicaPhase2Failed, "FrsErrorReplicaPhase2Failed" , "Phase 2 of replica set init failed"},
  111. {FrsErrorReplicaRootDirOpenFail,"FrsErrorReplicaRootDirOpenFail", "Failed to open the replica tree root dir"},
  112. {FrsErrorReplicaSetTombstoned, "FrsErrorReplicaSetTombstoned" , "Replica set is marked for deletion"},
  113. {FrsErrorRequestCancelled, "FrsErrorRequestCancelled" , "Request Cancelled" },
  114. {FrsErrorResource, "FrsErrorResource" , "Resource limit e.g. handles or memory hit"},
  115. {FrsErrorResourceInUse, "FrsErrorResourceInUse" , "A resource required by this operation is in use"},
  116. {FrsErrorRetry, "FrsErrorRetry" , "Error Retry" },
  117. {FrsErrorSessionNotClosed, "FrsErrorSessionNotClosed" , "Failed to close all RtCtx's in replica set"},
  118. {FrsErrorSharingViolation, "FrsErrorSharingViolation" , "File sharing violation" },
  119. {FrsErrorShuttingDown, "FrsErrorShuttingDown" , "Service shutdown in progress"},
  120. {FrsErrorStageDirOpenFail, "FrsErrorStageDirOpenFail" , "Failed to open the staging dir"},
  121. {FrsErrorStageFileDelFailed, "FrsErrorStageFileDelFailed" , "An attempt to delete the staging file failed"},
  122. {FrsErrorSuccess, "FrsErrorSuccess" , "Success"},
  123. {FrsErrorTerminateEnum, "FrsErrorTerminateEnum" , "Enum function status return to end enumeration"},
  124. {FrsErrorTunnelConflict, "FrsErrorTunnelConflict" , "oid conflict with id table entry (resolved)"},
  125. {FrsErrorTunnelConflictRejectCO,"FrsErrorTunnelConflictRejectCO", "oid conflict with id table entry (CO rejected)"},
  126. {FrsErrorUnjoining, "FrsErrorUnjoining" , "cxtion is still unjoining"},
  127. {FrsErrorUnsupportedFileSystem, "FrsErrorUnsupportedFileSystem", "The file system on this volume does provide the features required by FRS"},
  128. {FrsErrorVVSlotNotFound, "FrsErrorVVSlotNotFound" , "VVSlot not found on VVretire of Out of Order CO"},
  129. {FrsErrorVolumeRootDirOpenFail, "FrsErrorVolumeRootDirOpenFail", "Failed to open the volume root directory for this replica set"},
  130. {FrsErrorVvChecksum, "FrsErrorVvChecksum" , "version vector checksum mismatch"},
  131. {FrsErrorVvLength, "FrsErrorVvLength" , "vers vector length mismatch"},
  132. {FrsErrorVvRevision, "FrsErrorVvRevision" , "Vers Vector revision mismatch"},
  133. {FRS_ERROR_LISTEN , "FrsErrorListen" , "FrsErrorListen" },
  134. {FRS_ERROR_REGISTEREP , "FrsErrorRegisterP" , "FrsErrorRegisterP" },
  135. {FRS_ERROR_REGISTERIF , "FrsErrorRegisterIF" , "FrsErrorRegisterIF" },
  136. {FRS_ERROR_INQ_BINDINGS , "FrsErrorIngBindings" , "FrsErrorIngBindings" },
  137. {FRS_ERROR_PROTSEQ , "FrsErrorProtSeq" , "FrsErrorProtSeq" },
  138. //
  139. // New error codes that trigger a non_auth restore.
  140. //
  141. {FrsErrorMismatchedVolumeSerialNumber , "FrsErrorMismatchedVolumeSerialNumber" , "The Volume serial number from DB does not match the one from FileSystem." },
  142. {FrsErrorMismatchedReplicaRootObjectId, "FrsErrorMismatchedReplicaRootObjectId", "The Replica root's ObjectID from DB does not match the one from FileSystem." },
  143. {FrsErrorMismatchedReplicaRootFileId , "FrsErrorMismatchedReplicaRootFileId" , "The Replica root's FID from DB does not match the one from FileSystem." },
  144. {FrsErrorMismatchedJournalId , "FrsErrorMismatchedJournalId" , "The Journal ID from DB does not match the one from FileSystem." },
  145. {MAXULONG, NULL, NULL}
  146. };
  147. //
  148. // If code does not appear in above list it gets added to this list.
  149. //
  150. #define SIZE_OF_FRS_EXTENDED_MSG_TABLE 20
  151. FRS_ERROR_MSG_TABLE FrsErrorMsgTableExt[SIZE_OF_FRS_EXTENDED_MSG_TABLE];
  152. ULONG FrsErrorMsgTableExtUsed = 0;
  153. /******************************************************************************
  154. *******************************************************************************
  155. ** **
  156. ** **
  157. ** W I N 3 2 E R R O R D E S C R I P T I O N T A B L E **
  158. ** (Internal Short Version for Trace Log Only) **
  159. ** **
  160. *******************************************************************************
  161. ******************************************************************************/
  162. typedef struct _FRS_WIN32_ERROR_MSG_TABLE {
  163. ULONG ErrorCode; // Error code number for message lookup.
  164. PCHAR ErrorMsg; // Error Message String.
  165. } FRS_WIN32_ERROR_MSG_TABLE, *PFRS_WIN32_ERROR_MSG_TABLE;
  166. //
  167. // Some names for the Win32 Error codes.
  168. //
  169. FRS_WIN32_ERROR_MSG_TABLE FrsWin32ErrorMsgTable[] = {
  170. {E_UNEXPECTED ,"E_UNEXPECTED"},
  171. {EPT_S_NOT_REGISTERED ,"EPT_S_NOT_REGISTERED"},
  172. {ERROR_ACCESS_DENIED ,"ERROR_ACCESS_DENIED"},
  173. {ERROR_ALREADY_EXISTS ,"ERROR_ALREADY_EXISTS"},
  174. {ERROR_BAD_COMMAND ,"ERROR_BAD_COMMAND"},
  175. {ERROR_BADKEY ,"ERROR_BADKEY"},
  176. {ERROR_BAD_PATHNAME ,"ERROR_BAD_PATHNAME"},
  177. {ERROR_BUSY ,"ERROR_BUSY"},
  178. {ERROR_CALL_NOT_IMPLEMENTED ,"ERROR_CALL_NOT_IMPLEMENTED"},
  179. {ERROR_CANCELLED ,"ERROR_CANCELLED"},
  180. {ERROR_CANNOT_MAKE ,"ERROR_CANNOT_MAKE"},
  181. {ERROR_CANTREAD ,"ERROR_CANTREAD"},
  182. {ERROR_CANT_ACCESS_FILE ,"ERROR_CANT_ACCESS_FILE"}, // 0xc0000279 STATUS_IO_REPARSE_TAG_NOT_HANDLED
  183. {ERROR_CAN_NOT_COMPLETE ,"ERROR_CAN_NOT_COMPLETE"},
  184. {ERROR_COMMITMENT_LIMIT ,"ERROR_COMMITMENT_LIMIT"},
  185. {ERROR_CRC ,"ERROR_CRC"}, // STATUS_DATA_ERROR from journal read
  186. {ERROR_CURRENT_DIRECTORY ,"ERROR_CURRENT_DIRECTORY"},
  187. {ERROR_DIRECTORY ,"ERROR_DIRECTORY"},
  188. {ERROR_DIR_NOT_EMPTY ,"ERROR_DIR_NOT_EMPTY"},
  189. {ERROR_DISK_FULL ,"ERROR_DISK_FULL"},
  190. {ERROR_DUP_NAME ,"ERROR_DUP_NAME"},
  191. {ERROR_ENVVAR_NOT_FOUND ,"ERROR_ENVVAR_NOT_FOUND"},
  192. {ERROR_FILE_EXISTS ,"ERROR_FILE_EXISTS"},
  193. {ERROR_FILE_NOT_FOUND ,"ERROR_FILE_NOT_FOUND"},
  194. {ERROR_FILENAME_EXCED_RANGE ,"ERROR_FILENAME_EXCED_RANGE"},
  195. {ERROR_GEN_FAILURE ,"ERROR_GEN_FAILURE"},
  196. {ERROR_HANDLE_DISK_FULL ,"ERROR_HANDLE_DISK_FULL"},
  197. {ERROR_HANDLE_EOF ,"ERROR_HANDLE_EOF"},
  198. {ERROR_INSUFFICIENT_BUFFER ,"ERROR_INSUFFICIENT_BUFFER"},
  199. {ERROR_INVALID_ACCESS ,"ERROR_INVALID_ACCESS"},
  200. {ERROR_INVALID_ACCOUNT_NAME ,"ERROR_INVALID_ACCOUNT_NAME"},
  201. {ERROR_INVALID_ADDRESS ,"ERROR_INVALID_ADDRESS"},
  202. {ERROR_INVALID_BLOCK ,"ERROR_INVALID_BLOCK"},
  203. {ERROR_INVALID_COMPUTERNAME ,"ERROR_INVALID_COMPUTERNAME"},
  204. {ERROR_INVALID_DATA ,"ERROR_INVALID_DATA"},
  205. {ERROR_INVALID_FUNCTION ,"ERROR_INVALID_FUNCTION"},
  206. {ERROR_INVALID_HANDLE ,"ERROR_INVALID_HANDLE"},
  207. {ERROR_INVALID_NAME ,"ERROR_INVALID_NAME"},
  208. {ERROR_INVALID_OPERATION ,"ERROR_INVALID_OPERATION"},
  209. {ERROR_INVALID_PARAMETER ,"ERROR_INVALID_PARAMETER"},
  210. {ERROR_INVALID_STATE ,"ERROR_INVALID_STATE"},
  211. {ERROR_INVALID_USER_BUFFER ,"ERROR_INVALID_USER_BUFFER"},
  212. {ERROR_IO_DEVICE ,"ERROR_IO_DEVICE"},
  213. {ERROR_IO_PENDING ,"ERROR_IO_PENDING"},
  214. {ERROR_JOURNAL_DELETE_IN_PROGRESS ,"ERROR_JOURNAL_DELETE_IN_PROGRESS"},
  215. {ERROR_JOURNAL_ENTRY_DELETED ,"ERROR_JOURNAL_ENTRY_DELETED"},
  216. {ERROR_JOURNAL_NOT_ACTIVE ,"ERROR_JOURNAL_NOT_ACTIVE"},
  217. {ERROR_LOCK_VIOLATION ,"ERROR_LOCK_VIOLATION"},
  218. {ERROR_LOGON_FAILURE ,"ERROR_LOGON_FAILURE"},
  219. {ERROR_MOD_NOT_FOUND ,"ERROR_MOD_NOT_FOUND"},
  220. {ERROR_MORE_DATA ,"ERROR_MORE_DATA"},
  221. {ERROR_NETWORK_BUSY ,"ERROR_NETWORK_BUSY"},
  222. {ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT ,"ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT"},
  223. {ERROR_NONE_MAPPED ,"ERROR_NONE_MAPPED"},
  224. {ERROR_NOT_AUTHENTICATED ,"ERROR_NOT_AUTHENTICATED"},
  225. {ERROR_NOT_ENOUGH_MEMORY ,"ERROR_NOT_ENOUGH_MEMORY"},
  226. {ERROR_NOT_FOUND ,"ERROR_NOT_FOUND"},
  227. {ERROR_NOT_READY ,"ERROR_NOT_READY"},
  228. {ERROR_NOT_SUPPORTED ,"ERROR_NOT_SUPPORTED"},
  229. {ERROR_NOACCESS ,"ERROR_NOACCESS (AccessViolation)"},
  230. {ERROR_NO_DATA ,"ERROR_NO_DATA"},
  231. {ERROR_NO_MORE_FILES ,"ERROR_NO_MORE_FILES"},
  232. {ERROR_NO_MORE_ITEMS ,"ERROR_NO_MORE_ITEMS"},
  233. {ERROR_NO_SECURITY_ON_OBJECT ,"ERROR_NO_SECURITY_ON_OBJECT"},
  234. {ERROR_NO_SUCH_DOMAIN ,"ERROR_NO_SUCH_DOMAIN"},
  235. {ERROR_NO_SUCH_USER ,"ERROR_NO_SUCH_USER"},
  236. {ERROR_NO_SYSTEM_RESOURCES ,"ERROR_NO_SYSTEM_RESOURCES"},
  237. {ERROR_NO_TOKEN ,"ERROR_NO_TOKEN"},
  238. {ERROR_OPEN_FAILED ,"ERROR_OPEN_FAILED"},
  239. {ERROR_OPERATION_ABORTED ,"ERROR_OPERATION_ABORTED"},
  240. {ERROR_OPLOCK_NOT_GRANTED ,"ERROR_OPLOCK_NOT_GRANTED"},
  241. {ERROR_OUTOFMEMORY ,"ERROR_OUTOFMEMORY"},
  242. {ERROR_PARTIAL_COPY ,"ERROR_PARTIAL_COPY"},
  243. {ERROR_PATH_NOT_FOUND ,"ERROR_PATH_NOT_FOUND"},
  244. {ERROR_PIPE_CONNECTED ,"ERROR_PIPE_CONNECTED"},
  245. {ERROR_PROCESS_ABORTED ,"ERROR_PROCESS_ABORTED"},
  246. {ERROR_REQUEST_ABORTED ,"ERROR_REQUEST_ABORTED"},
  247. {ERROR_RETRY ,"ERROR_RETRY"},
  248. {ERROR_REVISION_MISMATCH ,"ERROR_REVISION_MISMATCH"},
  249. {ERROR_SEEK ,"ERROR_SEEK"},
  250. {ERROR_SEM_OWNER_DIED ,"ERROR_SEM_OWNER_DIED"},
  251. {ERROR_SEM_TIMEOUT ,"ERROR_SEM_TIMEOUT"},
  252. {ERROR_SERVICE_ALREADY_RUNNING ,"ERROR_SERVICE_ALREADY_RUNNING"},
  253. {ERROR_SERVICE_DOES_NOT_EXIST ,"ERROR_SERVICE_DOES_NOT_EXIST"},
  254. {ERROR_SERVICE_EXISTS ,"ERROR_SERVICE_EXISTS"},
  255. {ERROR_SERVICE_MARKED_FOR_DELETE ,"ERROR_SERVICE_MARKED_FOR_DELETE"},
  256. {ERROR_SERVICE_NOT_ACTIVE ,"ERROR_SERVICE_NOT_ACTIVE"},
  257. {ERROR_SERVICE_REQUEST_TIMEOUT ,"ERROR_SERVICE_REQUEST_TIMEOUT"},
  258. {ERROR_SERVICE_SPECIFIC_ERROR ,"ERROR_SERVICE_SPECIFIC_ERROR"},
  259. {ERROR_SHARING_VIOLATION ,"ERROR_SHARING_VIOLATION"},
  260. {ERROR_SUCCESS ,"ERROR_SUCCESS"},
  261. {ERROR_TIMEOUT ,"ERROR_TIMEOUT"},
  262. {ERROR_TOO_MANY_OPEN_FILES ,"ERROR_TOO_MANY_OPEN_FILES"},
  263. {ERROR_TRUSTED_DOMAIN_FAILURE ,"ERROR_TRUSTED_DOMAIN_FAILURE"},
  264. {ERROR_UNEXP_NET_ERR ,"ERROR_UNEXP_NET_ERR"},
  265. {FRS_ERR_INVALID_API_SEQUENCE ,"FRS_ERR_INVALID_API_SEQUENCE"},
  266. {FRS_ERR_STARTING_SERVICE ,"FRS_ERR_STARTING_SERVICE"},
  267. {FRS_ERR_STOPPING_SERVICE ,"FRS_ERR_STOPPING_SERVICE"},
  268. {FRS_ERR_INTERNAL_API ,"FRS_ERR_INTERNAL_API"},
  269. {FRS_ERR_INTERNAL ,"FRS_ERR_INTERNAL"},
  270. {FRS_ERR_SERVICE_COMM ,"FRS_ERR_SERVICE_COMM"},
  271. {FRS_ERR_INSUFFICIENT_PRIV ,"FRS_ERR_INSUFFICIENT_PRIV"},
  272. {FRS_ERR_AUTHENTICATION ,"FRS_ERR_AUTHENTICATION"},
  273. {FRS_ERR_PARENT_INSUFFICIENT_PRIV ,"FRS_ERR_PARENT_INSUFFICIENT_PRIV"},
  274. {FRS_ERR_PARENT_AUTHENTICATION ,"FRS_ERR_PARENT_AUTHENTICATION"},
  275. {FRS_ERR_CHILD_TO_PARENT_COMM ,"FRS_ERR_CHILD_TO_PARENT_COMM"},
  276. {FRS_ERR_PARENT_TO_CHILD_COMM ,"FRS_ERR_PARENT_TO_CHILD_COMM"},
  277. {FRS_ERR_SYSVOL_POPULATE ,"FRS_ERR_SYSVOL_POPULATE"},
  278. {FRS_ERR_SYSVOL_POPULATE_TIMEOUT ,"FRS_ERR_SYSVOL_POPULATE_TIMEOUT"},
  279. {FRS_ERR_SYSVOL_IS_BUSY ,"FRS_ERR_SYSVOL_IS_BUSY"},
  280. {FRS_ERR_SYSVOL_DEMOTE ,"FRS_ERR_SYSVOL_DEMOTE"},
  281. {FRS_ERR_INVALID_SERVICE_PARAMETER ,"FRS_ERR_INVALID_SERVICE_PARAMETER"},
  282. {RPC_S_CALL_CANCELLED ,"RPC_S_CALL_CANCELLED"},
  283. {RPC_S_CALL_FAILED ,"RPC_S_CALL_FAILED"},
  284. {RPC_S_CALL_FAILED_DNE ,"RPC_S_CALL_FAILED_DNE"},
  285. {RPC_S_CANNOT_SUPPORT ,"RPC_S_CANNOT_SUPPORT"},
  286. {RPC_S_SEC_PKG_ERROR ,"RPC_S_SEC_PKG_ERROR"},
  287. {RPC_S_SERVER_TOO_BUSY ,"RPC_S_SERVER_TOO_BUSY"},
  288. {RPC_S_SERVER_UNAVAILABLE ,"RPC_S_SERVER_UNAVAILABLE"},
  289. {RPC_S_UNKNOWN_IF ,"RPC_S_UNKNOWN_IF"},
  290. {EXCEPTION_ACCESS_VIOLATION ,"EXCEPTION_ACCESS_VIOLATION"},
  291. {EXCEPTION_DATATYPE_MISALIGNMENT ,"EXCEPTION_DATATYPE_MISALIGNMENT"},
  292. {EXCEPTION_BREAKPOINT ,"EXCEPTION_BREAKPOINT"},
  293. {EXCEPTION_SINGLE_STEP ,"EXCEPTION_SINGLE_STEP"},
  294. {EXCEPTION_ARRAY_BOUNDS_EXCEEDED ,"EXCEPTION_ARRAY_BOUNDS_EXCEEDED"},
  295. {EXCEPTION_FLT_DENORMAL_OPERAND ,"EXCEPTION_FLT_DENORMAL_OPERAND"},
  296. {EXCEPTION_FLT_DIVIDE_BY_ZERO ,"EXCEPTION_FLT_DIVIDE_BY_ZERO"},
  297. {EXCEPTION_FLT_INEXACT_RESULT ,"EXCEPTION_FLT_INEXACT_RESULT"},
  298. {EXCEPTION_FLT_INVALID_OPERATION ,"EXCEPTION_FLT_INVALID_OPERATION"},
  299. {EXCEPTION_FLT_OVERFLOW ,"EXCEPTION_FLT_OVERFLOW"},
  300. {EXCEPTION_FLT_STACK_CHECK ,"EXCEPTION_FLT_STACK_CHECK"},
  301. {EXCEPTION_FLT_UNDERFLOW ,"EXCEPTION_FLT_UNDERFLOW"},
  302. {EXCEPTION_INT_DIVIDE_BY_ZERO ,"EXCEPTION_INT_DIVIDE_BY_ZERO"},
  303. {EXCEPTION_INT_OVERFLOW ,"EXCEPTION_INT_OVERFLOW"},
  304. {EXCEPTION_PRIV_INSTRUCTION ,"EXCEPTION_PRIV_INSTRUCTION"},
  305. {EXCEPTION_IN_PAGE_ERROR ,"EXCEPTION_IN_PAGE_ERROR"},
  306. {EXCEPTION_ILLEGAL_INSTRUCTION ,"EXCEPTION_ILLEGAL_INSTRUCTION"},
  307. {EXCEPTION_NONCONTINUABLE_EXCEPTION ,"EXCEPTION_NONCONTINUABLE_EXCEPTION"},
  308. {EXCEPTION_STACK_OVERFLOW ,"EXCEPTION_STACK_OVERFLOW"},
  309. {EXCEPTION_INVALID_DISPOSITION ,"EXCEPTION_INVALID_DISPOSITION"},
  310. {EXCEPTION_GUARD_PAGE ,"EXCEPTION_GUARD_PAGE"},
  311. {EXCEPTION_INVALID_HANDLE ,"EXCEPTION_INVALID_HANDLE"},
  312. {CONTROL_C_EXIT ,"CONTROL_C_EXIT"},
  313. {WAIT_OBJECT_0 ,"WAIT_OBJECT_0"},
  314. {WAIT_FAILED ,"WAIT_FAILED"},
  315. {WAIT_ABANDONED ,"WAIT_ABANDONED"},
  316. {WAIT_TIMEOUT ,"WAIT_TIMEOUT"},
  317. {MAXULONG , NULL}
  318. };
  319. //
  320. // If code does not appear in above list it gets added to this list.
  321. //
  322. #define SIZE_OF_FRSWIN32_EXTENDED_MSG_TABLE 50
  323. FRS_WIN32_ERROR_MSG_TABLE FrsWin32ErrorMsgTableExt[SIZE_OF_FRSWIN32_EXTENDED_MSG_TABLE];
  324. ULONG FrsWin32ErrorMsgTableExtUsed = 0;
  325. typedef struct _FRS_NT_ERROR_MSG_TABLE {
  326. NTSTATUS Status;
  327. FRS_ERROR_CODE FrsErrorCode;
  328. FRS_ERROR_SEVERITY FrsErrorSeverity;
  329. PCHAR ErrorMsg;
  330. } FRS_NT_ERROR_MSG_TABLE, *PFRS_NT_ERROR_MSG_TABLE;
  331. /******************************************************************************
  332. *******************************************************************************
  333. ** **
  334. ** **
  335. ** N T E R R O R D E S C R I P T I O N T A B L E **
  336. ** **
  337. ** **
  338. *******************************************************************************
  339. ******************************************************************************/
  340. //
  341. // This error table translates NT Status codes to an FRS_ERROR_CODE class and an
  342. // associated severity level. It also has a message string. See frserror.h
  343. //
  344. // NT Status code FRS Error Code FRS Severity NT Error message
  345. //
  346. FRS_NT_ERROR_MSG_TABLE FrsNtErrorMsgTable[] = {
  347. {STATUS_ACCESS_DENIED ,FrsErrorAccess ,FrsSeverityServiceFatal, "STATUS_ACCESS_DENIED"},
  348. {STATUS_BAD_WORKING_SET_LIMIT ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_BAD_WORKING_SET_LIMIT"},
  349. {STATUS_BUFFER_OVERFLOW ,FrsErrorBufferOverflow ,FrsSeverityServiceFatal, "STATUS_BUFFER_OVERFLOW"},
  350. {STATUS_CANCELLED ,FrsErrorRequestCancelled,FrsSeverityInfo, "STATUS_CANCELLED"},
  351. {STATUS_DATA_ERROR ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_DATA_ERROR"},
  352. {STATUS_DELETE_PENDING ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_DELETE_PENDING"},
  353. {STATUS_FILE_DELETED ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_FILE_DELETED"},
  354. {STATUS_DEVICE_CONFIGURATION_ERROR,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_DEVICE_CONFIGURATION_ERROR"},
  355. {STATUS_DIRECTORY_NOT_EMPTY ,FrsErrorConflict ,FrsSeverityInfo, "STATUS_DIRECTORY_NOT_EMPTY"},
  356. {STATUS_DUPLICATE_NAME ,FrsErrorConflict ,FrsSeverityServiceFatal, "STATUS_DUPLICATE_NAME"},
  357. {STATUS_FILE_IS_A_DIRECTORY ,FrsErrorConflict ,FrsSeverityServiceFatal, "STATUS_FILE_IS_A_DIRECTORY"},
  358. {STATUS_INCOMPATIBLE_FILE_MAP ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INCOMPATIBLE_FILE_MAP"},
  359. {STATUS_INVALID_ADDRESS ,FrsErrorInternalError ,FrsSeverityServiceFatal, "STATUS_INVALID_ADDRESS"},
  360. {STATUS_INVALID_INFO_CLASS ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_INFO_CLASS"},
  361. {STATUS_INVALID_DEVICE_REQUEST ,FrsErrorBadParam ,FrsSeverityInfo, "STATUS_INVALID_DEVICE_REQUEST"},
  362. {STATUS_INVALID_CID ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_CID"},
  363. {STATUS_INVALID_PARAMETER ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER"},
  364. {STATUS_INVALID_PARAMETER_1 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_1"},
  365. {STATUS_INVALID_PARAMETER_2 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_2"},
  366. {STATUS_INVALID_PARAMETER_3 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_3"},
  367. {STATUS_INVALID_PARAMETER_4 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_4"},
  368. {STATUS_INVALID_PARAMETER_5 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_5"},
  369. {STATUS_INVALID_PARAMETER_6 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_6"},
  370. {STATUS_INVALID_PARAMETER_7 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_7"},
  371. {STATUS_INVALID_PARAMETER_8 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_8"},
  372. {STATUS_INVALID_PARAMETER_9 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_9"},
  373. {STATUS_INVALID_PARAMETER_10 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_10"},
  374. {STATUS_INVALID_PARAMETER_11 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_11"},
  375. {STATUS_INVALID_PARAMETER_12 ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_12"},
  376. {STATUS_INVALID_PARAMETER_MIX ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PARAMETER_MIX"},
  377. {STATUS_INVALID_PAGE_PROTECTION ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_PAGE_PROTECTION"},
  378. {STATUS_IO_REPARSE_TAG_INVALID ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_IO_REPARSE_TAG_INVALID"},
  379. {STATUS_IO_REPARSE_TAG_MISMATCH ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_IO_REPARSE_TAG_MISMATCH"},
  380. {STATUS_IO_REPARSE_TAG_NOT_HANDLED,FrsErrorAccess ,FrsSeverityInfo, "STATUS_IO_REPARSE_TAG_NOT_HANDLED"},
  381. {STATUS_IO_REPARSE_DATA_INVALID ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_IO_REPARSE_DATA_INVALID"},
  382. {STATUS_JOURNAL_DELETE_IN_PROGRESS,FrsErrorInvalidOperation,FrsSeverityInfo, "STATUS_JOURNAL_DELETE_IN_PROGRESS"},
  383. {STATUS_JOURNAL_NOT_ACTIVE ,FrsErrorInvalidOperation,FrsSeverityServiceFatal, "STATUS_JOURNAL_NOT_ACTIVE"},
  384. {STATUS_JOURNAL_ENTRY_DELETED ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_JOURNAL_ENTRY_DELETED"},
  385. {STATUS_NO_MORE_FILES ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_NO_MORE_FILES"},
  386. {STATUS_NOT_IMPLEMENTED ,FrsErrorInvalidOperation,FrsSeverityServiceFatal, "STATUS_NOT_IMPLEMENTED"},
  387. {STATUS_NOT_LOCKED ,FrsErrorInvalidOperation,FrsSeverityServiceFatal, "STATUS_NOT_LOCKED"},
  388. {STATUS_OBJECT_NAME_COLLISION ,FrsErrorConflict ,FrsSeverityServiceFatal, "STATUS_OBJECT_NAME_COLLISION"},
  389. {STATUS_OBJECT_NAME_INVALID ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_OBJECT_NAME_INVALID"},
  390. {STATUS_OBJECT_NAME_NOT_FOUND ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_OBJECT_NAME_NOT_FOUND"},
  391. {STATUS_OBJECT_PATH_NOT_FOUND ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_OBJECT_PATH_NOT_FOUND"},
  392. {STATUS_OBJECT_PATH_SYNTAX_BAD ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_INVALID_ADDRESS"},
  393. {STATUS_OBJECT_TYPE_MISMATCH ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_OBJECT_TYPE_MISMATCH"},
  394. {STATUS_OBJECTID_EXISTS ,FrsErrorConflict ,FrsSeverityInfo, "STATUS_OBJECTID_EXISTS"},
  395. {STATUS_OBJECTID_NOT_FOUND ,FrsErrorNotFound ,FrsSeverityInfo, "STATUS_OBJECTID_NOT_FOUND"},
  396. {STATUS_OPLOCK_NOT_GRANTED ,FrsErrorAccess ,FrsSeverityInfo, "STATUS_OPLOCK_NOT_GRANTED"},
  397. {STATUS_PORT_ALREADY_SET ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_PORT_ALREADY_SET"},
  398. {STATUS_PRIVILEGE_NOT_HELD ,FrsErrorNoPrivileges ,FrsSeverityServiceFatal, "STATUS_OBJECT_PATH_SYNTAX_BAD"},
  399. {STATUS_SECTION_NOT_IMAGE ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_SECTION_NOT_IMAGE"},
  400. {STATUS_SECTION_PROTECTION ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_SECTION_PROTECTION"},
  401. {STATUS_SHARING_VIOLATION ,FrsErrorAccess ,FrsSeverityInfo, "STATUS_SHARING_VIOLATION"},
  402. {STATUS_UNABLE_TO_FREE_VM ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_UNABLE_TO_FREE_VM"},
  403. {STATUS_UNABLE_TO_DELETE_SECTION ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_UNABLE_TO_DELETE_SECTION"},
  404. {STATUS_WORKING_SET_LIMIT_RANGE ,FrsErrorBadParam ,FrsSeverityServiceFatal, "STATUS_WORKING_SET_LIMIT_RA"},
  405. {STATUS_SUCCESS ,FrsErrorSuccess ,FrsSeverityIgnore , "STATUS_SUCCESS"} // MUST BE LAST.
  406. };
  407. //
  408. // If code does not appear in above list it gets added to this list.
  409. //
  410. #define SIZE_OF_NT_EXTENDED_MSG_TABLE 20
  411. FRS_NT_ERROR_MSG_TABLE FrsNtErrorMsgTableExt[SIZE_OF_NT_EXTENDED_MSG_TABLE];
  412. ULONG FrsNtErrorMsgTableExtUsed = 0;
  413. /******************************************************************************
  414. *******************************************************************************
  415. ** **
  416. ** **
  417. ** J E T E R R O R D E S C R I P T I O N T A B L E **
  418. ** **
  419. ** **
  420. *******************************************************************************
  421. ******************************************************************************/
  422. //
  423. // This error table translates Jet Errors to an FRS_ERROR_CODE class and an
  424. // associated severity level. It also has a message string. See frserror.h
  425. //
  426. typedef struct _FRS_JET_ERROR_MSG_TABLE {
  427. LONG JetErrorCode;
  428. PCHAR JetErrorMsgTag;
  429. FRS_ERROR_CODE FrsErrorCode;
  430. FRS_ERROR_SEVERITY FrsErrorSeverity;
  431. PCHAR JetErrorMsg;
  432. } FRS_JET_ERROR_MSG_TABLE, *PFRS_JET_ERROR_MSG_TABLE;
  433. //
  434. // JET error code Error Msg Tag FRS Error Code FRS Severity JET Error message
  435. //
  436. FRS_JET_ERROR_MSG_TABLE FrsJetErrorMsgTable[] = {
  437. { JET_errAccessDenied ,"AccessDenied" ,FrsErrorAccess , FrsSeverityServiceFatal, "Cannot access file, the file is locked or in use"},
  438. { JET_errBadDbSignature ,"BadDbSignature" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Bad signature for a db file"},
  439. { JET_errBadLogSignature ,"BadLogSignature" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Bad signature for a log file"},
  440. { JET_errBadLogVersion ,"BadLogVersion" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Version of log file is not compatible with Jet version"},
  441. { JET_errCannotDisableVersioning ,"CannotDisableVersioning" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Cannot disable versioning for this database"},
  442. { JET_errColumnNotFound ,"ColumnNotFound" ,FrsErrorInternalError , FrsSeverityServiceFatal, "No such column"},
  443. { JET_errDatabaseCorrupted ,"DatabaseCorrupted" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Non-db file or corrupted db"},
  444. { JET_errDatabaseDuplicate ,"DatabaseDuplicate" ,FrsErrorAccess , FrsSeverityServiceFatal, "Database already exists"},
  445. { JET_errDatabaseFileReadOnly ,"DatabaseFileReadOnly" ,FrsErrorAccess , FrsSeverityServiceFatal, "Attach a readonly database file for read/write operations"},
  446. { JET_errDatabaseInUse ,"DatabaseInUse" ,FrsErrorAccess , FrsSeverityServiceFatal, "Database in use"},
  447. { JET_errDatabaseInconsistent ,"DatabaseInconsistent" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Database is in inconsistent state"},
  448. { JET_errDatabaseInvalidName ,"DatabaseInvalidName" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Invalid database name"},
  449. { JET_errDatabaseInvalidPages ,"DatabaseInvalidPages" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Invalid number of pages"},
  450. { JET_errDatabaseLocked ,"DatabaseLocked" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Database exclusively locked"},
  451. { JET_errDatabaseNotFound ,"DatabaseNotFound" ,FrsErrorDatabaseNotFound , FrsSeverityServiceFatal, "No such database"},
  452. { JET_errFileNotFound ,"FileNotFound" ,FrsErrorDatabaseNotFound , FrsSeverityWarning, "Database File not found"},
  453. { JET_errDiskFull ,"DiskFull" ,FrsErrorDiskSpace , FrsSeverityServiceFatal, "No space left on disk"},
  454. { JET_errDiskIO ,"DiskIO" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Disk IO error"},
  455. { JET_errKeyDuplicate ,"KeyDuplicate" ,FrsErrorKeyDuplicate , FrsSeverityWarning, "Illegal duplicate key"},
  456. { JET_errFileAccessDenied ,"FileAccessDenied" ,FrsErrorAccess , FrsSeverityServiceFatal, "Cannot access file"},
  457. { JET_errIllegalOperation ,"IllegalOperation" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Operation not supported on table"},
  458. { JET_errIndexInvalidDef ,"IndexInvalidDef" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Illegal/invalid index definition"},
  459. { JET_errInvalidBufferSize ,"InvalidBufferSize" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Data buffer doesn't match column size"},
  460. { JET_errInvalidColumnType ,"InvalidColumnType" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Invalid column data type"},
  461. { JET_errInvalidDatabase ,"InvalidDatabase" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Not a database file"},
  462. { JET_errInvalidFilename ,"InvalidFilename" ,FrsErrorAccess , FrsSeverityServiceFatal, "Filename is invalid"},
  463. { JET_errInvalidName ,"InvalidName" ,FrsErrorAccess , FrsSeverityServiceFatal, "Invalid name"},
  464. { JET_errInvalidObject ,"InvalidObject" ,FrsErrorAccess , FrsSeverityWarning, "Object is invalid for operation"},
  465. { JET_errInvalidParameter ,"InvalidParameter" ,FrsErrorBadParam , FrsSeverityReplicaFatal, "Invalid API parameter"},
  466. { JET_errInvalidPath ,"InvalidPath" ,FrsErrorAccess , FrsSeverityServiceFatal, "Invalid file path"},
  467. { JET_errInvalidSesid ,"InvalidSesid" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "System parameters were set improperly"},
  468. { JET_errInvalidSettings ,"InvalidSettings" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "Invalid session handle"},
  469. { JET_errInvalidTableId ,"InvalidTableId" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "Invalid table id"},
  470. { JET_errLogCorrupted ,"LogCorrupted" ,FrsErrorDatabaseCorrupted, FrsSeverityServiceFatal, "Logs could not be interpreted"},
  471. { JET_errLogDiskFull ,"LogDiskFull" ,FrsErrorDiskSpace , FrsSeverityServiceFatal, "Log disk full"},
  472. { JET_errLogWriteFail ,"LogWriteFail" ,FrsErrorDiskSpace , FrsSeverityServiceFatal, "Fail when writing to log file"},
  473. { JET_errMissingLogFile ,"MissingLogFile" ,FrsErrorDatabaseNotFound , FrsSeverityServiceFatal, "current log file missing"},
  474. { JET_errNoCurrentRecord ,"NoCurrentRecord" ,FrsErrorInternalError , FrsSeverityWarning, "Currency not on a record"},
  475. { JET_errNotInitialized ,"NotInitialized" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "JetInit not yet called"},
  476. { JET_errObjectNotFound ,"ObjectNotFound" ,FrsErrorNotFound , FrsSeverityInfo , "No such table or object"},
  477. { JET_errOutOfCursors ,"OutOfCursors" ,FrsErrorResource , FrsSeverityServiceFatal, "Out of table cursors"},
  478. { JET_errOutOfDatabaseSpace ,"OutOfDatabaseSpace" ,FrsErrorDiskSpace , FrsSeverityServiceFatal, "Maximum database size reached"},
  479. { JET_errOutOfFileHandles ,"OutOfFileHandles" ,FrsErrorResource , FrsSeverityServiceFatal, "Out of file handles"},
  480. { JET_errOutOfMemory ,"OutOfMemory" ,FrsErrorResource , FrsSeverityServiceFatal, "Out of Memory"},
  481. { JET_errOutOfSessions ,"OutOfSessions" ,FrsErrorResource , FrsSeverityServiceFatal, "Out of sessions"},
  482. { JET_errPermissionDenied ,"PermissionDenied" ,FrsErrorAccess , FrsSeverityServiceFatal, "Permission denied"},
  483. { JET_errReadVerifyFailure ,"ReadVerifyFailure" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Read verification error"},
  484. { JET_errRecordDeleted ,"RecordDeleted" ,FrsErrorNotFound , FrsSeverityInfo , "Record has been deleted"},
  485. { JET_errRecordPrimaryChanged ,"RecordPrimaryChanged" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Primary key may not change"},
  486. { JET_errRecordNotFound ,"RecordNotFound" ,FrsErrorNotFound , FrsSeverityInfo , "The key was not found"},
  487. { JET_errRecordTooBig ,"RecordTooBig" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "Record larger than maximum size"},
  488. { JET_errSecondaryIndexCorrupted ,"SecondaryIndexCorrupted" ,FrsErrorJetSecIndexCorrupted, FrsSeverityWarning , "Jet non-error (upgrade/collating thing)"},
  489. { JET_errTableLocked ,"TableLocked" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "Table is exclusively locked"},
  490. { JET_errTableDuplicate ,"TableDuplicate" ,FrsErrorConflict , FrsSeverityInfo , "Table already exists"},
  491. { JET_errTableInUse ,"TableInUse" ,FrsErrorInternalError , FrsSeverityIgnore , "Table is in use, cannot lock"},
  492. { JET_errTempFileOpenError ,"TempFileOpenError" ,FrsErrorAccess , FrsSeverityReplicaFatal, "Temp file could not be opened"},
  493. { JET_errTermInProgress ,"TermInProgress" ,FrsErrorShuttingDown , FrsSeverityReplicaFatal, "Termination in progress"},
  494. { JET_errTooManyAttachedDatabases ,"TooManyAttachedDatabases" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Too many attached databases"},
  495. { JET_errTooManyOpenDatabases ,"TooManyOpenDatabases" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Too many open databases"},
  496. { JET_errTooManyOpenTables ,"TooManyOpenTables" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Cannot open any more tables"},
  497. { JET_errVersionStoreOutOfMemory ,"VersionStoreOutOfMemory" ,FrsErrorInternalError , FrsSeverityServiceFatal, "Version store out of memory"},
  498. { JET_errWriteConflict ,"WriteConflict" ,FrsErrorDbWriteConflict , FrsSeverityInfo , "Write lock failed due to outstanding write lock"},
  499. { JET_wrnBufferTruncated ,"BufferTruncated" ,FrsErrorInfo , FrsSeverityInfo , "Buffer too small for data"},
  500. { JET_wrnColumnNull ,"ColumnNull" ,FrsErrorNotFound , FrsSeverityInfo , "Column is NULL-valued"},
  501. { JET_wrnDatabaseAttached ,"DatabaseAttached" ,FrsErrorInternalError , FrsSeverityReplicaFatal, "Database is already attached"},
  502. { JET_wrnFileOpenReadOnly ,"FileOpenReadOnly" ,FrsErrorAccess , FrsSeverityServiceFatal, "Database file is read only"},
  503. { JET_wrnSeekNotEqual ,"SeekNotEqual" ,FrsErrorInfo , FrsSeverityInfo , "SeekLE or SeekGE didn't find exact match"},
  504. { JET_wrnTableEmpty ,"TableEmpty" ,FrsErrorAccess , FrsSeverityIgnore , "Open an empty table"},
  505. { JET_errSuccess ,"Success" ,FrsErrorSuccess , FrsSeverityIgnore , "Success"} // MUST BE LAST.
  506. };
  507. //
  508. // If code does not appear in above list it gets added to this list.
  509. //
  510. #define SIZE_OF_JET_EXTENDED_MSG_TABLE 20
  511. FRS_JET_ERROR_MSG_TABLE FrsJetErrorMsgTableExt[SIZE_OF_JET_EXTENDED_MSG_TABLE];
  512. ULONG FrsJetErrorMsgTableExtUsed = 0;
  513. //
  514. // Win32 to FRS error code translation table.
  515. //
  516. typedef struct _FRS_WIN32_ERROR_MAP {
  517. DWORD Win32ErrorCode;
  518. FRS_ERROR_CODE FrsErrorCode;
  519. } FRS_WIN32_ERROR_MAP, *PFRS_WIN32_ERROR_MAP;
  520. FRS_WIN32_ERROR_MAP FrsWin32ErrorMap[] = {
  521. { ERROR_ACCESS_DENIED ,FrsErrorAccess },
  522. { ERROR_BAD_PATHNAME ,FrsErrorBadPathname },
  523. { ERROR_DIR_NOT_EMPTY ,FrsErrorDirNotEmpty },
  524. { ERROR_DISK_FULL ,FrsErrorDiskSpace },
  525. { ERROR_FILE_EXISTS ,FrsErrorFileExists },
  526. { ERROR_FILE_NOT_FOUND ,FrsErrorNotFound },
  527. { ERROR_GEN_FAILURE ,FrsErrorInternalError },
  528. { ERROR_HANDLE_DISK_FULL ,FrsErrorDiskSpace },
  529. { ERROR_INSUFFICIENT_BUFFER ,FrsErrorBufferOverflow },
  530. { ERROR_INVALID_FUNCTION ,FrsErrorInvalidOperation },
  531. { ERROR_INVALID_PARAMETER ,FrsErrorBadParam },
  532. { ERROR_MORE_DATA ,FrsErrorBufferOverflow },
  533. { ERROR_OPERATION_ABORTED ,FrsErrorRequestCancelled },
  534. { ERROR_OPLOCK_NOT_GRANTED ,FrsErrorOplockNotGranted },
  535. { ERROR_RETRY ,FrsErrorRetry },
  536. { ERROR_SHARING_VIOLATION ,FrsErrorSharingViolation },
  537. { ERROR_SUCCESS ,FrsErrorSuccess } // MUST BE LAST.
  538. };
  539. FRS_ERROR_CODE
  540. FrsTranslateWin32Error(
  541. IN DWORD WStatus
  542. )
  543. /*++
  544. Routine Description:
  545. This routine translates a Win32 error code to an FRS error code.
  546. It returns the FRS error code.
  547. Arguments:
  548. WStatus - The Win32 error code.
  549. Return Value:
  550. FRS error code.
  551. --*/
  552. {
  553. #undef DEBSUB
  554. #define DEBSUB "FrsTranslateWin32Error:"
  555. PFRS_WIN32_ERROR_MAP FrsErrTable = FrsWin32ErrorMap;
  556. //
  557. // skip lookup if called with success status.
  558. //
  559. if (WIN_SUCCESS(WStatus)) {
  560. return FrsErrorSuccess;
  561. }
  562. //
  563. // Look thru the table for a match on the Win32 error code.
  564. // The table ends with a ERROR_SUCCESS entry in the Win32ErrorCode field.
  565. //
  566. while (FrsErrTable->Win32ErrorCode != ERROR_SUCCESS) {
  567. if (FrsErrTable->Win32ErrorCode == WStatus) {
  568. break;
  569. }
  570. FrsErrTable += 1;
  571. }
  572. if (FrsErrTable->Win32ErrorCode != ERROR_SUCCESS) {
  573. return FrsErrTable->FrsErrorCode;
  574. }
  575. //
  576. // Win32 error code not in the table.
  577. //
  578. DPRINT1(1, "Win32 Error code, %08x, Not present in FrsWin32ErrorMap.\n", WStatus);
  579. return FrsErrorInternalError;
  580. }
  581. FRS_ERROR_CODE
  582. FrsTranslateNtError(
  583. IN NTSTATUS Status,
  584. IN BOOL BPrint
  585. )
  586. /*++
  587. Routine Description:
  588. This routine translates NT error codes to a smaller set of FRS error codes
  589. and optionally prints a message. It returns the FRS error code.
  590. Arguments:
  591. Status - The NT error code.
  592. BPrint - If true print the error message.
  593. Return Value:
  594. FRS error code.
  595. --*/
  596. {
  597. #undef DEBSUB
  598. #define DEBSUB "FrsTranslateNtError:"
  599. USHORT Severity;
  600. USHORT Level[FRS_MAX_ERROR_SEVERITY];
  601. PFRS_NT_ERROR_MSG_TABLE FrsErrTable = FrsNtErrorMsgTable;
  602. //
  603. // skip lookup if called with success status.
  604. //
  605. if (NT_SUCCESS(Status)) {
  606. return FrsErrorSuccess;
  607. }
  608. //
  609. // Look thru the table for a match on the NT error code.
  610. // The table ends with a STATUS_SUCCESS entry in the Status field.
  611. //
  612. while (FrsErrTable->Status != STATUS_SUCCESS) {
  613. if (FrsErrTable->Status == Status) {
  614. break;
  615. }
  616. FrsErrTable += 1;
  617. }
  618. if (FrsErrTable->Status != STATUS_SUCCESS) {
  619. //
  620. // Found a match.
  621. //
  622. if (BPrint) {
  623. //
  624. // Translate the FRS severity to a DPRINT serverity level
  625. //
  626. Level[FrsSeverityServiceFatal] = 0;
  627. Level[FrsSeverityReplicaFatal] = 0;
  628. Level[FrsSeverityException] = 1;
  629. Level[FrsSeverityWarning] = 3;
  630. Level[FrsSeverityInfo] = 5;
  631. Level[FrsSeverityIgnore] = 5;
  632. Severity = Level[FrsErrTable->FrsErrorSeverity];
  633. DPRINT2(Severity, "NTStatus %08x -- %s\n", Status, FrsErrTable->ErrorMsg);
  634. }
  635. return FrsErrTable->FrsErrorCode;
  636. }
  637. //
  638. // NT error code not in the table so be happy.
  639. //
  640. DPRINT1(1, "NT Error: %08x, Not present in FrsNtErrorMsgTable. \n", Status);
  641. return FrsErrorInternalError;
  642. }
  643. ULONG
  644. DisplayNTStatusSev(
  645. IN ULONG Sev,
  646. IN NTSTATUS Status
  647. )
  648. /*++
  649. Routine Description:
  650. This routine translates NT error codes to a smaller set of FRS error codes
  651. and prints a message describing the NT status. It returns the FRS error code.
  652. Nothing is printed if NT_SUCCESS(Status) is true.
  653. If NT_SUCCESS(Status) is not TRUE then GetLastError is called and the
  654. Win32 message is printed.
  655. The message is printed at the indicated severity level.
  656. Arguments:
  657. Sev - dprint severity
  658. Status - The NT error code.
  659. Return Value:
  660. FRS error code.
  661. --*/
  662. {
  663. #undef DEBSUB
  664. #define DEBSUB "DisplayNTStatusSev:"
  665. ULONG WStatus;
  666. ULONG FStatus;
  667. FStatus = FrsTranslateNtError(Status, TRUE);
  668. if (FStatus != FrsErrorSuccess) {
  669. //
  670. // Check for a win32 error.
  671. //
  672. WStatus = GetLastError();
  673. if (!WIN_SUCCESS(WStatus)) {
  674. DPRINT1(Sev, "GetLastError returned (dec): %d\n", WStatus );
  675. DisplayErrorMsg(Sev, WStatus);
  676. }
  677. return FStatus;
  678. }
  679. return FrsErrorSuccess;
  680. }
  681. ULONG
  682. DisplayNTStatus(
  683. IN NTSTATUS Status
  684. )
  685. /*++
  686. Routine Description:
  687. This routine translates NT error codes to a smaller set of FRS error codes
  688. and prints a message describing the NT status. It returns the FRS error code.
  689. Nothing is printed if NT_SUCCESS(Status) is true.
  690. If NT_SUCCESS(Status) is not TRUE then GetLastError is called and the
  691. Win32 message is printed.
  692. Arguments:
  693. Status - The NT error code.
  694. Return Value:
  695. FRS error code.
  696. --*/
  697. {
  698. #undef DEBSUB
  699. #define DEBSUB "DisplayNTStatus:"
  700. return (DisplayNTStatusSev(0, Status));
  701. }
  702. ULONG
  703. FrsSetLastNTError(
  704. NTSTATUS Status
  705. )
  706. /*++
  707. Routine Description:
  708. Translate NT status codes to WIN32 status codes for those functions that
  709. make NT calls. Map a few status values differently.
  710. Arguments:
  711. Status - the NTstatus to map.
  712. Return Value:
  713. The WIN32 status. Also puts this into LastError.
  714. --*/
  715. {
  716. #undef DEBSUB
  717. #define DEBSUB "FrsSetLastNTError:"
  718. ULONG WStatus;
  719. //
  720. // Do the standard system mapping first.
  721. //
  722. WStatus = RtlNtStatusToDosError( Status );
  723. //
  724. // If we try to generate a staging file and get the NT status that delete
  725. // is pending or the file is deleted then treat it as file not found
  726. // rather than Access Denied. The later is a hard failure that will stop
  727. // file replication if it happens on a directory. FileNotFound just means
  728. // the user deleted the file before we could do the propagation.
  729. //
  730. // Currently (March, 98) the following NT errors map into ERROR_ACCESS_DENIED.
  731. // STATUS_INVALID_LOCK_SEQUENCE STATUS_THREAD_IS_TERMINATING
  732. // STATUS_INVALID_VIEW_SIZE STATUS_DELETE_PENDING
  733. // STATUS_ALREADY_COMMITTED STATUS_FILE_IS_A_DIRECTORY
  734. // STATUS_ACCESS_DENIED STATUS_PROCESS_IS_TERMINATING
  735. // STATUS_PORT_CONNECTION_REFUSED STATUS_CANNOT_DELETE
  736. // STATUS_FILE_DELETED
  737. // Update: Currently (Feb, 2001) STATUS_DELETE_PENDING maps to
  738. // ERROR_DELETE_PENDING. This change has broken some code. We need to
  739. // handle it here. The macro WIN_NOT_FOUND was updated too.
  740. //
  741. if (WStatus == ERROR_ACCESS_DENIED) {
  742. if (Status == STATUS_FILE_DELETED) {
  743. WStatus = ERROR_FILE_NOT_FOUND;
  744. } else if (Status == STATUS_DELETE_PENDING) {
  745. WStatus = ERROR_DELETE_PENDING;
  746. }
  747. }
  748. SetLastError( WStatus );
  749. return WStatus;
  750. }
  751. //
  752. // Dump out the windows error message string.
  753. //
  754. VOID
  755. DisplayErrorMsg(
  756. IN ULONG Severity,
  757. IN ULONG WindowsErrorCode
  758. )
  759. {
  760. #undef DEBSUB
  761. #define DEBSUB "DisplayErrorMsg:"
  762. LPVOID lpMsgBuf;
  763. FormatMessage(
  764. FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
  765. NULL,
  766. WindowsErrorCode,
  767. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  768. (LPTSTR) &lpMsgBuf,
  769. 0,
  770. NULL
  771. );
  772. DPRINT1(Severity, "Msg: %S\n", lpMsgBuf);
  773. LocalFree( lpMsgBuf );
  774. }
  775. PCHAR
  776. ErrLabelW32(
  777. ULONG WStatus
  778. )
  779. /*++
  780. Routine Description:
  781. Return a ptr to the Win32 error code label.
  782. Arguments:
  783. WStatus - a win32 error status.
  784. Return Value:
  785. Ptr to the win 32 error status label string.
  786. --*/
  787. {
  788. #undef DEBSUB
  789. #define DEBSUB "ErrLabelW32:"
  790. PFRS_WIN32_ERROR_MSG_TABLE Entry;
  791. ULONG i;
  792. Entry = FrsWin32ErrorMsgTable;
  793. //
  794. // Scan table looking for match. Null msg ends table.
  795. //
  796. while (Entry->ErrorMsg != NULL) {
  797. if (Entry->ErrorCode == WStatus) {
  798. return Entry->ErrorMsg;
  799. }
  800. Entry++;
  801. }
  802. //
  803. // Scan the extended error table where new entries are put.
  804. //
  805. Entry = FrsWin32ErrorMsgTableExt;
  806. for (i = 0; i < FrsWin32ErrorMsgTableExtUsed; i++) {
  807. if (Entry->ErrorCode == WStatus) {
  808. return Entry->ErrorMsg;
  809. }
  810. Entry++;
  811. }
  812. //
  813. // Out of space?
  814. //
  815. if (FrsWin32ErrorMsgTableExtUsed >= SIZE_OF_FRSWIN32_EXTENDED_MSG_TABLE) {
  816. return "???";
  817. }
  818. i = InterlockedIncrement(&FrsWin32ErrorMsgTableExtUsed) - 1;
  819. if (i >= SIZE_OF_FRSWIN32_EXTENDED_MSG_TABLE) {
  820. return "???";
  821. }
  822. //
  823. // Create new entry.
  824. //
  825. Entry = &FrsWin32ErrorMsgTableExt[i];
  826. Entry->ErrorCode = WStatus;
  827. Entry->ErrorMsg = FrsAlloc(16);
  828. _snprintf(Entry->ErrorMsg, 16, "%d-???", WStatus);
  829. Entry->ErrorMsg[15] = '\0';
  830. return Entry->ErrorMsg;
  831. }
  832. PCHAR
  833. ErrLabelNT(
  834. NTSTATUS Status
  835. )
  836. /*++
  837. Routine Description:
  838. Return a ptr to the NT error code label.
  839. Arguments:
  840. Status - an NTStatus error status.
  841. Return Value:
  842. Ptr to the NT error status label string.
  843. --*/
  844. {
  845. #undef DEBSUB
  846. #define DEBSUB "ErrLabelNT:"
  847. PFRS_NT_ERROR_MSG_TABLE Entry;
  848. ULONG i;
  849. Entry = FrsNtErrorMsgTable;
  850. //
  851. // skip lookup if called with success status.
  852. //
  853. if (Status == STATUS_SUCCESS) {
  854. return "Success";
  855. }
  856. //
  857. // Look thru the table for a match on the NT error code.
  858. // The table ends with a STATUS_SUCCESS entry.
  859. //
  860. while (Entry->Status != STATUS_SUCCESS) {
  861. if (Entry->Status == Status) {
  862. return Entry->ErrorMsg;
  863. }
  864. Entry += 1;
  865. }
  866. //
  867. // Scan the extended error table where new entries are put.
  868. //
  869. Entry = FrsNtErrorMsgTableExt;
  870. for (i = 0; i < FrsNtErrorMsgTableExtUsed; i++) {
  871. if (Entry->Status == Status) {
  872. return Entry->ErrorMsg;
  873. }
  874. Entry += 1;
  875. }
  876. //
  877. // Out of space?
  878. //
  879. if (FrsNtErrorMsgTableExtUsed >= SIZE_OF_NT_EXTENDED_MSG_TABLE) {
  880. return "???";
  881. }
  882. i = InterlockedIncrement(&FrsNtErrorMsgTableExtUsed) - 1;
  883. if (i >= SIZE_OF_NT_EXTENDED_MSG_TABLE) {
  884. return "???";
  885. }
  886. //
  887. // Create new entry.
  888. //
  889. Entry = &FrsNtErrorMsgTableExt[i];
  890. Entry->Status = Status;
  891. Entry->ErrorMsg = FrsAlloc(16);
  892. _snprintf(Entry->ErrorMsg, 16, "%08x-???", Status);
  893. Entry->ErrorMsg[15] = '\0';
  894. return Entry->ErrorMsg;
  895. }
  896. PCHAR
  897. ErrLabelFrs(
  898. ULONG FStatus
  899. )
  900. /*++
  901. Routine Description:
  902. Return a ptr to the Frs error code label.
  903. Arguments:
  904. FStatus - an FRS error status.
  905. Return Value:
  906. Ptr to the Frs error status label string.
  907. --*/
  908. {
  909. #undef DEBSUB
  910. #define DEBSUB "ErrLabelFrs:"
  911. PFRS_ERROR_MSG_TABLE Entry;
  912. ULONG i;
  913. Entry = FrsErrorMsgTable;
  914. //
  915. // Scan table looking for match. Null msg ends table.
  916. //
  917. while (Entry->ErrorMsg != NULL) {
  918. if (Entry->ErrorCode == FStatus) {
  919. return Entry->ErrorMsg;
  920. }
  921. Entry++;
  922. }
  923. //
  924. // Scan the extended error table where new entries are put.
  925. //
  926. Entry = FrsErrorMsgTableExt;
  927. for (i = 0; i < FrsErrorMsgTableExtUsed; i++) {
  928. if (Entry->ErrorCode == FStatus) {
  929. return Entry->ErrorMsg;
  930. }
  931. Entry++;
  932. }
  933. //
  934. // Out of space?
  935. //
  936. if (FrsErrorMsgTableExtUsed >= SIZE_OF_FRS_EXTENDED_MSG_TABLE) {
  937. return "???";
  938. }
  939. i = InterlockedIncrement(&FrsErrorMsgTableExtUsed) - 1;
  940. if (i >= SIZE_OF_FRS_EXTENDED_MSG_TABLE) {
  941. return "???";
  942. }
  943. //
  944. // Create new entry.
  945. //
  946. Entry = &FrsErrorMsgTableExt[i];
  947. Entry->ErrorCode = FStatus;
  948. Entry->ErrorMsg = FrsAlloc(16);
  949. _snprintf(Entry->ErrorMsg, 16, "%d-???", FStatus);
  950. Entry->ErrorMsg[15] = '\0';
  951. return Entry->ErrorMsg;
  952. }
  953. PCHAR
  954. ErrLabelJet(
  955. LONG jerr
  956. )
  957. /*++
  958. Routine Description:
  959. Return a ptr to the Jet error code label.
  960. Arguments:
  961. jerr - the jet error status.
  962. Return Value:
  963. Ptr to the jet error status label string.
  964. --*/
  965. {
  966. #undef DEBSUB
  967. #define DEBSUB "ErrLabelJet:"
  968. PFRS_JET_ERROR_MSG_TABLE Entry = FrsJetErrorMsgTable;
  969. ULONG i;
  970. //
  971. // skip lookup if called with success status.
  972. //
  973. if (JET_SUCCESS(jerr)) {
  974. return "Success";
  975. }
  976. //
  977. // Look thru the table for a match on the jet error code.
  978. // The table ends with a JER_errSuccess entry in the JetErrorCode field.
  979. //
  980. while (!JET_SUCCESS(Entry->JetErrorCode)) {
  981. if (Entry->JetErrorCode == jerr) {
  982. return Entry->JetErrorMsgTag;
  983. }
  984. Entry += 1;
  985. }
  986. //
  987. // Scan the extended error table where new entries are put.
  988. //
  989. Entry = FrsJetErrorMsgTableExt;
  990. for (i = 0; i < FrsJetErrorMsgTableExtUsed; i++) {
  991. if (Entry->JetErrorCode == jerr) {
  992. return Entry->JetErrorMsgTag;
  993. }
  994. Entry += 1;
  995. }
  996. //
  997. // Out of space?
  998. //
  999. if (FrsJetErrorMsgTableExtUsed >= SIZE_OF_JET_EXTENDED_MSG_TABLE) {
  1000. return "???";
  1001. }
  1002. i = InterlockedIncrement(&FrsJetErrorMsgTableExtUsed) - 1;
  1003. if (i >= SIZE_OF_JET_EXTENDED_MSG_TABLE) {
  1004. return "???";
  1005. }
  1006. //
  1007. // Create new entry.
  1008. //
  1009. Entry = &FrsJetErrorMsgTableExt[i];
  1010. Entry->JetErrorCode = jerr;
  1011. Entry->JetErrorMsgTag = FrsAlloc(16);
  1012. _snprintf(Entry->JetErrorMsgTag, 16, "%d-???", jerr);
  1013. Entry->JetErrorMsgTag[15] = '\0';
  1014. return Entry->JetErrorMsgTag;
  1015. }
  1016. FRS_ERROR_CODE
  1017. DbsTranslateJetError0(
  1018. IN JET_ERR jerr,
  1019. IN BOOL BPrint
  1020. )
  1021. /*++
  1022. Routine Description:
  1023. This routine translates jet error codes to a smaller set of FRS error codes
  1024. and optionally prints a message. It returns the FRS error code.
  1025. Arguments:
  1026. jerr - The jet error code.
  1027. BPrint - If true print the error message.
  1028. Return Value:
  1029. FRS error code.
  1030. --*/
  1031. {
  1032. #undef DEBSUB
  1033. #define DEBSUB "DbsTranslateJetError0:"
  1034. USHORT Severity;
  1035. USHORT Level[FRS_MAX_ERROR_SEVERITY];
  1036. PFRS_JET_ERROR_MSG_TABLE FrsErrTable = FrsJetErrorMsgTable;
  1037. //
  1038. // skip lookup if called with success status.
  1039. //
  1040. if (JET_SUCCESS(jerr)) {
  1041. return FrsErrorSuccess;
  1042. }
  1043. //
  1044. // Look thru the table for a match on the jet error code.
  1045. // The table ends with a JER_errSuccess entry in the JetErrorCode field.
  1046. //
  1047. while (FrsErrTable->JetErrorCode != JET_errSuccess) {
  1048. if (FrsErrTable->JetErrorCode == jerr) {
  1049. break;
  1050. }
  1051. FrsErrTable += 1;
  1052. }
  1053. if (!JET_SUCCESS(FrsErrTable->JetErrorCode)) {
  1054. //
  1055. // Found a match.
  1056. //
  1057. if (BPrint) {
  1058. //
  1059. // Translate the FRS severity to a DPRINT serverity level
  1060. //
  1061. Level[FrsSeverityServiceFatal] = 0;
  1062. Level[FrsSeverityReplicaFatal] = 0;
  1063. Level[FrsSeverityException] = 1;
  1064. Level[FrsSeverityWarning] = 3;
  1065. Level[FrsSeverityInfo] = 5;
  1066. Level[FrsSeverityIgnore] = 5;
  1067. Severity = Level[FrsErrTable->FrsErrorSeverity];
  1068. DPRINT2(Severity, "Jet related FRS error: %d - %s\n",
  1069. jerr, FrsErrTable->JetErrorMsg);
  1070. }
  1071. return FrsErrTable->FrsErrorCode;
  1072. }
  1073. //
  1074. // Jet error code not in the table so be happy.
  1075. //
  1076. DPRINT1(0, "Jet Error: %d, Not present in FrsJetErrorMsgTable. Treated as service fatal.\n", jerr);
  1077. return FrsErrorInternalError;
  1078. }