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.

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