Source code of Windows XP (NT5)
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.

207 lines
6.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: dbgdef.h
  8. //
  9. // Contents: Defines for debug exports in crypt32 (crypt32d.lib)
  10. //
  11. // History: 17-Apr-96 kevinr created
  12. // 05-Sep-1997 pberkman added subsystem id's
  13. //
  14. //--------------------------------------------------------------------------
  15. #ifndef DBGDEF_H
  16. #define DBGDEF_H
  17. #ifndef _XELIBCA_SRC_
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22. #endif
  23. #if (DBG)
  24. //--------------------------------------------------------------------------
  25. // OSS and heap-checking
  26. //--------------------------------------------------------------------------
  27. # include <crtdbg.h>
  28. // To turn on heap checking (the whole nine yards) (slow):
  29. // set DEBUG_MASK=0x26
  30. // To only check for leaks:
  31. // set DEBUG_MASK=0x20
  32. # ifndef NO_OSS_DEBUG
  33. # include <asn1code.h>
  34. // To turn on OSS tracing (all encodes and decodes):
  35. // set OSS_DEBUG_MASK=0x02
  36. //
  37. // To turn on OSS tracing of only decoder errors
  38. // set OSS_DEBUG_MASK=0x10
  39. //
  40. // To send the OSS tracing output to a file:
  41. // set OSS_DEBUG_TRACEFILE=<filename>
  42. extern BOOL WINAPI DbgInitOSS( OssGlobal *pog);
  43. # endif // NO_OSS_DEBUG
  44. #endif // DBG
  45. //
  46. // 05-Sep-1997 pberkman:
  47. //
  48. // DEBUG_PRINT_MASK settings to turn on sub-system debugs
  49. //
  50. #define DBG_SS_CRYPT32 0x00000001
  51. #define DBG_SS_TRUSTCOMMON 0x00010000
  52. #define DBG_SS_TRUST 0x00020000
  53. #define DBG_SS_TRUSTPROV 0x00040000
  54. #define DBG_SS_SIP 0x00080000
  55. #define DBG_SS_CATALOG 0x00100000
  56. #define DBG_SS_SIGNING 0x00200000
  57. #define DBG_SS_OFFSIGN 0x00400000
  58. #define DBG_SS_CATDBSVC 0x00800000
  59. #define DBG_SS_APP 0x10000000
  60. typedef struct _DBG_SS_TAG
  61. {
  62. DWORD dwSS;
  63. const char *pszTag; // 7 characters!
  64. } DBG_SS_TAG;
  65. #define __DBG_SS_TAGS { \
  66. DBG_SS_CRYPT32, "CRYPT32", \
  67. DBG_SS_TRUSTCOMMON, "PKITRST", \
  68. DBG_SS_TRUST, "WINTRST", \
  69. DBG_SS_TRUSTPROV, "SOFTPUB", \
  70. DBG_SS_CATALOG, "MSCAT32", \
  71. DBG_SS_SIP, "MSSIP32", \
  72. DBG_SS_SIGNING, "MSSGN32", \
  73. DBG_SS_OFFSIGN, "OFFSIGN", \
  74. DBG_SS_APP, "CONAPPL", \
  75. DBG_SS_CATDBSVC, "CATDBSV", \
  76. NULL, NULL \
  77. }
  78. //--------------------------------------------------------------------------
  79. // DBG_TRACE
  80. //--------------------------------------------------------------------------
  81. #if DBG
  82. void DbgPrintf( DWORD dwSubSysId, LPCSTR lpFmt, ...);
  83. # define DBG_TRACE_EX(argFmt) DbgPrintf argFmt
  84. # define DBG_TRACE(argFmt) DBG_TRACE_EX((DBG_SS_CRYPT32,argFmt))
  85. # define DBG_PRINTF(args) DbgPrintf args
  86. #else
  87. # define DBG_TRACE_EX(argFmt)
  88. # define DBG_TRACE(argFmt)
  89. # define DBG_PRINTF(args)
  90. #endif // DBG
  91. //--------------------------------------------------------------------------
  92. // Error-handling
  93. //--------------------------------------------------------------------------
  94. #ifndef ERROR_RETURN_LABEL
  95. #define ERROR_RETURN_LABEL ErrorReturn
  96. #endif
  97. #define TRACE_ERROR_EX(id,name) \
  98. name##: \
  99. DBG_TRACE_EX((id,"(" #name ":%s,%d)\n", __FILE__, __LINE__)); \
  100. goto ERROR_RETURN_LABEL;
  101. #define SET_ERROR_EX(id,name,err) \
  102. name##: \
  103. SetLastError( (DWORD)(err)); \
  104. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError " #err "\n", __FILE__, __LINE__)); \
  105. goto ERROR_RETURN_LABEL;
  106. #define SET_ERROR_VAR_EX(id,name,err) \
  107. name##: \
  108. SetLastError( (DWORD)(err)); \
  109. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError(0x%x)\n", __FILE__, __LINE__, (err))); \
  110. goto ERROR_RETURN_LABEL;
  111. #define SET_HRESULT_EX(id,name,err) \
  112. name##: \
  113. hr = (HRESULT) (err); \
  114. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = " #err "\n", __FILE__, __LINE__)); \
  115. goto ERROR_RETURN_LABEL;
  116. #define SET_HRESULT_VAR_EX(id,name,err) \
  117. name##: \
  118. hr = (HRESULT) (err); \
  119. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n" , __FILE__, __LINE__, (hr))); \
  120. goto ERROR_RETURN_LABEL;
  121. #define TRACE_HRESULT_EX(id,name) \
  122. name##: \
  123. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n", __FILE__, __LINE__, (hr))); \
  124. goto ERROR_RETURN_LABEL;
  125. #define SET_DWRESULT_EX(id,name,err) \
  126. name##: \
  127. dwResult = (DWORD) (err); \
  128. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = " #err "\n", __FILE__, __LINE__)); \
  129. goto ERROR_RETURN_LABEL;
  130. #define TRACE_ERROR(name) TRACE_ERROR_EX(DBG_SS_CRYPT32,name)
  131. #define SET_ERROR(name,err) SET_ERROR_EX(DBG_SS_CRYPT32,name,err)
  132. #define SET_ERROR_VAR(name,err) SET_ERROR_VAR_EX(DBG_SS_CRYPT32,name,err)
  133. #define SET_HRESULT(name,err) SET_HRESULT_EX(DBG_SS_CRYPT32,name,err)
  134. #define SET_HRESULT_VAR(name,err) SET_HRESULT_VAR_EX(DBG_SS_CRYPT32,name,err)
  135. #define TRACE_HRESULT(name) TRACE_HRESULT_EX(DBG_SS_CRYPT32,name)
  136. #define SET_DWRESULT(name,err) SET_DWRESULT_EX(DBG_SS_CRYPT32,name,err)
  137. #define _JumpCondition(condition, label) \
  138. if (condition) \
  139. { \
  140. goto label; \
  141. } \
  142. else { }
  143. #define _JumpConditionWithExpr(condition, label, expr) \
  144. if (condition) \
  145. { \
  146. expr; \
  147. goto label; \
  148. } \
  149. else { }
  150. #define _JumpConditionWithPrint(condition, label, ids) \
  151. if (condition) \
  152. { \
  153. LocalizedWPrintf(ids); \
  154. goto label; \
  155. } \
  156. else { }
  157. #ifndef _XELIBCA_SRC_
  158. #ifdef __cplusplus
  159. } // balance of extern "C"
  160. #endif
  161. #endif
  162. #endif // DBGDEF_H