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.

190 lines
6.5 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. #ifdef _XELIBCA_SRC_
  46. // Copied from CA\include\cs.h:
  47. #define DBG_SS_INFO 0x00000004 // or in with any of the below
  48. #define DBG_SS_CERTLIB 0x40000000
  49. #define DBG_SS_CERTLIBI (DBG_SS_CERTLIB | DBG_SS_INFO)
  50. #define DBG_SS_TRACE DBG_SS_CERTLIBI
  51. #define DBG_SS_APP DBG_SS_CERTLIB
  52. #else // _XELIBCA_SRC_
  53. //
  54. // 05-Sep-1997 pberkman:
  55. //
  56. // DEBUG_PRINT_MASK settings to turn on sub-system debugs
  57. //
  58. #define DBG_SS_CRYPT32 0x00000001
  59. #define DBG_SS_TRUSTCOMMON 0x00010000
  60. #define DBG_SS_TRUST 0x00020000
  61. #define DBG_SS_TRUSTPROV 0x00040000
  62. #define DBG_SS_SIP 0x00080000
  63. #define DBG_SS_CATALOG 0x00100000
  64. #define DBG_SS_SIGNING 0x00200000
  65. #define DBG_SS_OFFSIGN 0x00400000
  66. #define DBG_SS_CATDBSVC 0x00800000
  67. #define DBG_SS_APP 0x10000000
  68. #define DBG_SS_TRACE DBG_SS_CRYPT32
  69. typedef struct _DBG_SS_TAG
  70. {
  71. DWORD dwSS;
  72. const char *pszTag; // 7 characters!
  73. } DBG_SS_TAG;
  74. #define __DBG_SS_TAGS { \
  75. DBG_SS_CRYPT32, "CRYPT32", \
  76. DBG_SS_TRUSTCOMMON, "PKITRST", \
  77. DBG_SS_TRUST, "WINTRST", \
  78. DBG_SS_TRUSTPROV, "SOFTPUB", \
  79. DBG_SS_CATALOG, "MSCAT32", \
  80. DBG_SS_SIP, "MSSIP32", \
  81. DBG_SS_SIGNING, "MSSGN32", \
  82. DBG_SS_OFFSIGN, "OFFSIGN", \
  83. DBG_SS_APP, "CONAPPL", \
  84. DBG_SS_CATDBSVC, "CATDBSV", \
  85. NULL, NULL \
  86. }
  87. #endif // _XELIBCA_SRC_
  88. //--------------------------------------------------------------------------
  89. // DBG_TRACE
  90. //--------------------------------------------------------------------------
  91. #if DBG
  92. extern int WINAPIV DbgPrintf( DWORD dwSubSysId, LPCSTR lpFmt, ...);
  93. # define DBG_TRACE_EX(argFmt) DbgPrintf argFmt
  94. # define DBG_TRACE(argFmt) DBG_TRACE_EX((DBG_SS_TRACE, argFmt))
  95. # define DBG_PRINTF(args) DbgPrintf args
  96. #else
  97. # define DBG_TRACE_EX(argFmt)
  98. # define DBG_TRACE(argFmt)
  99. # define DBG_PRINTF(args)
  100. #endif // DBG
  101. //--------------------------------------------------------------------------
  102. // Error-handling
  103. //--------------------------------------------------------------------------
  104. #ifndef ERROR_RETURN_LABEL
  105. #define ERROR_RETURN_LABEL ErrorReturn
  106. #endif
  107. #define TRACE_ERROR_EX(id,name) \
  108. name##: \
  109. DBG_TRACE_EX((id,"(" #name ":%s,%d)\n", __FILE__, __LINE__)); \
  110. goto ERROR_RETURN_LABEL;
  111. #define SET_ERROR_EX(id,name,err) \
  112. name##: \
  113. SetLastError( (DWORD)(err)); \
  114. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError " #err "\n", __FILE__, __LINE__)); \
  115. goto ERROR_RETURN_LABEL;
  116. #define SET_ERROR_VAR_EX(id,name,err) \
  117. name##: \
  118. SetLastError( (DWORD)(err)); \
  119. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError(0x%x)\n", __FILE__, __LINE__, (err))); \
  120. goto ERROR_RETURN_LABEL;
  121. #define SET_HRESULT_EX(id,name,err) \
  122. name##: \
  123. hr = (HRESULT) (err); \
  124. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = " #err "\n", __FILE__, __LINE__)); \
  125. goto ERROR_RETURN_LABEL;
  126. #define SET_HRESULT_VAR_EX(id,name,err) \
  127. name##: \
  128. hr = (HRESULT) (err); \
  129. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n" , __FILE__, __LINE__, (hr))); \
  130. goto ERROR_RETURN_LABEL;
  131. #define TRACE_HRESULT_EX(id,name) \
  132. name##: \
  133. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n", __FILE__, __LINE__, (hr))); \
  134. goto ERROR_RETURN_LABEL;
  135. #define TRACE_ERROR(name) TRACE_ERROR_EX(DBG_SS_TRACE, name)
  136. #define SET_ERROR(name, err) SET_ERROR_EX(DBG_SS_TRACE, name, err)
  137. #define SET_ERROR_VAR(name, err) SET_ERROR_VAR_EX(DBG_SS_TRACE, name, err)
  138. #define SET_HRESULT(name, err) SET_HRESULT_EX(DBG_SS_TRACE, name, err)
  139. #define SET_HRESULT_VAR(name, err) SET_HRESULT_VAR_EX(DBG_SS_TRACE, name, err)
  140. #define TRACE_HRESULT(name) TRACE_HRESULT_EX(DBG_SS_TRACE, name)
  141. #ifndef _XELIBCA_SRC_
  142. #ifdef __cplusplus
  143. } // balance of extern "C"
  144. #endif
  145. #endif
  146. #endif // DBGDEF_H