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.

90 lines
2.3 KiB

  1. /*
  2. * ssp_SspDebug.h
  3. * MSUAM
  4. *
  5. * Created by mconrad on Sun Sep 30 2001.
  6. * Copyright (c) 2001 Microsoft Corp. All rights reserved.
  7. *
  8. */
  9. #ifndef __SSPDEBUG__
  10. #define __SSPDEBUG__
  11. #ifdef SSP_TARGET_CARBON
  12. #include <Carbon/Carbon.h>
  13. #endif
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include <macstrsafe.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. char toChar(IN char c);
  22. void spaceIt(IN char* buf, IN ULONG len);
  23. char toHex(IN int c);
  24. void _SspDebugPrintHex(IN const void *buffer, IN LONG len);
  25. void _SspDebugPrintString32(IN STRING32 str32, IN const void* base);
  26. void _SspDebugPrintNegFlags(IN ULONG flags);
  27. void _SspDebugPrintNTLMMsg(IN const void* buffer, IN ULONG len);
  28. void _SspDebugPrintString32TargetInfo(IN STRING32* pTargetInfo, IN const void* buffer);
  29. #ifdef __cplusplus
  30. }
  31. #endif
  32. #ifdef SSP_DEBUG
  33. #define DBUF _buff,sizeof(_buff)
  34. #ifdef SSP_TARGET_CARBON
  35. #define SspDebugPrintHex _SspDebugPrintHex
  36. #define SspDebugPrintString32 _SspDebugPrintString32
  37. #define SspDebugPrintNegFlags _SspDebugPrintNegFlags
  38. #define SspDebugPrintNTLMMsg _SspDebugPrintNTLMMsg
  39. #define SspDebugPrintString32TargetInfo _SspDebugPrintString32TargetInfo
  40. #define SspDebugPrint(x) do { \
  41. char _buff[256]; \
  42. StringCbPrintf x; \
  43. printf("%s%s", _buff, "\n"); \
  44. }while(false)
  45. #else //NOT Carbon
  46. //
  47. //The following debug stuff doesn't work in non-carbon environment.
  48. //
  49. #define SspDebugPrintHex(a,b)
  50. #define SspDebugPrintString32(a,b)
  51. #define SspDebugPrintNegFlags(a)
  52. #define SspDebugPrintNTLMMsg(a,b)
  53. #define SspDebugPrintString32TargetInfo(a,b)
  54. #define SspDebugPrint(x) do { \
  55. char _buff[256]; \
  56. StringCbPrintf x; \
  57. StringCbCat(_buff, sizeof(_buff), ";"); \
  58. StringCbCat(_buff, sizeof(_buff), "g"); \
  59. DebugStr(c2pstr(_buff)); \
  60. }while(false)
  61. #endif //SSP_TARGET_CARBON
  62. #else //no debug
  63. #define SspDebugPrintHex(a,b)
  64. #define SspDebugPrintString32(a,b)
  65. #define SspDebugPrintNegFlags(a)
  66. #define SspDebugPrintNTLMMsg(a,b)
  67. #define SspDebugPrintString32TargetInfo(a,b)
  68. #define SspDebugPrint(x)
  69. #endif //SSP_DEBUG
  70. #endif //__SSPDEBUG__