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.

169 lines
6.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1996
  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_APP 0x10000000
  57. typedef struct _DBG_SS_TAG
  58. {
  59. DWORD dwSS;
  60. const char *pszTag; // 7 characters!
  61. } DBG_SS_TAG;
  62. #define __DBG_SS_TAGS { \
  63. DBG_SS_CRYPT32, "CRYPT32", \
  64. DBG_SS_TRUSTCOMMON, "PKITRST", \
  65. DBG_SS_TRUST, "WINTRST", \
  66. DBG_SS_TRUSTPROV, "SOFTPUB", \
  67. DBG_SS_CATALOG, "MSCAT32", \
  68. DBG_SS_SIP, "MSSIP32", \
  69. DBG_SS_SIGNING, "MSSGN32", \
  70. DBG_SS_OFFSIGN, "OFFSIGN", \
  71. DBG_SS_APP, "CONAPPL", \
  72. NULL, NULL \
  73. }
  74. //--------------------------------------------------------------------------
  75. // DBG_TRACE
  76. //--------------------------------------------------------------------------
  77. #if DBG
  78. extern int WINAPIV DbgPrintf( DWORD dwSubSysId, LPCSTR lpFmt, ...);
  79. # define DBG_TRACE_EX(argFmt) DbgPrintf argFmt
  80. # define DBG_TRACE(argFmt) DBG_TRACE_EX((DBG_SS_CRYPT32,argFmt))
  81. # define DBG_PRINTF(args) DbgPrintf args
  82. #else
  83. # define DBG_TRACE_EX(argFmt)
  84. # define DBG_TRACE(argFmt)
  85. # define DBG_PRINTF(args)
  86. #endif // DBG
  87. //--------------------------------------------------------------------------
  88. // Error-handling
  89. //--------------------------------------------------------------------------
  90. #ifndef ERROR_RETURN_LABEL
  91. #define ERROR_RETURN_LABEL ErrorReturn
  92. #endif
  93. #define TRACE_ERROR_EX(id,name) \
  94. name##: \
  95. DBG_TRACE_EX((id,"(" #name ":%s,%d)\n", __FILE__, __LINE__)); \
  96. goto ERROR_RETURN_LABEL;
  97. #define SET_ERROR_EX(id,name,err) \
  98. name##: \
  99. SetLastError( (DWORD)(err)); \
  100. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError " #err "\n", __FILE__, __LINE__)); \
  101. goto ERROR_RETURN_LABEL;
  102. #define SET_ERROR_VAR_EX(id,name,err) \
  103. name##: \
  104. SetLastError( (DWORD)(err)); \
  105. DBG_TRACE_EX((id, "%s, %d\n " #name ": SetLastError(0x%x)\n", __FILE__, __LINE__, (err))); \
  106. goto ERROR_RETURN_LABEL;
  107. #define SET_HRESULT_EX(id,name,err) \
  108. name##: \
  109. hr = (HRESULT) (err); \
  110. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = " #err "\n", __FILE__, __LINE__)); \
  111. goto ERROR_RETURN_LABEL;
  112. #define SET_HRESULT_VAR_EX(id,name,err) \
  113. name##: \
  114. hr = (HRESULT) (err); \
  115. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n" , __FILE__, __LINE__, (hr))); \
  116. goto ERROR_RETURN_LABEL;
  117. #define TRACE_HRESULT_EX(id,name) \
  118. name##: \
  119. DBG_TRACE_EX((id, "%s, %d\n " #name ": hr = 0x%x\n", __FILE__, __LINE__, (hr))); \
  120. goto ERROR_RETURN_LABEL;
  121. #define TRACE_ERROR(name) TRACE_ERROR_EX(DBG_SS_CRYPT32,name)
  122. #define SET_ERROR(name,err) SET_ERROR_EX(DBG_SS_CRYPT32,name,err)
  123. #define SET_ERROR_VAR(name,err) SET_ERROR_VAR_EX(DBG_SS_CRYPT32,name,err)
  124. #define SET_HRESULT(name,err) SET_HRESULT_EX(DBG_SS_CRYPT32,name,err)
  125. #define SET_HRESULT_VAR(name,err) SET_HRESULT_VAR_EX(DBG_SS_CRYPT32,name,err)
  126. #define TRACE_HRESULT(name) TRACE_HRESULT_EX(DBG_SS_CRYPT32,name)
  127. #ifdef __cplusplus
  128. } // balance of extern "C"
  129. #endif
  130. #endif // DBGDEF_H