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.

92 lines
2.7 KiB

  1. #ifndef _DFSDEBUG_H_
  2. #define _DFSDEBUG_H_
  3. #ifdef DEBUG
  4. #include <stdio.h>
  5. #include <stdarg.h>
  6. #define DECLARE_INFOLEVEL(comp) \
  7. extern unsigned long comp##InfoLevel = DEF_INFOLEVEL;
  8. #define DECLARE_DEBUG(comp) \
  9. extern unsigned long comp##InfoLevel; \
  10. _inline void \
  11. comp##InlineDebugOut(unsigned long fDebugMask, TCHAR *pszfmt, ...) \
  12. { \
  13. if (comp##InfoLevel & fDebugMask) \
  14. { \
  15. TCHAR acsString[1000];\
  16. va_list va; \
  17. va_start(va, pszfmt);\
  18. _vsntprintf(acsString, 999, pszfmt, va); \
  19. acsString[999] = _T('\0'); \
  20. va_end(va);\
  21. OutputDebugString(acsString);\
  22. } \
  23. }\
  24. _inline void \
  25. comp##InlineDebugOut( TCHAR *pszfmt, ...) \
  26. { \
  27. if ( TRUE ) \
  28. { \
  29. TCHAR acsString[1000];\
  30. va_list va; \
  31. va_start(va, pszfmt);\
  32. _vsntprintf(acsString, 999, pszfmt, va); \
  33. acsString[999] = _T('\0'); \
  34. va_end(va);\
  35. OutputDebugString(acsString);\
  36. } \
  37. }
  38. #else // DEBUG
  39. #define DECLARE_DEBUG(comp)
  40. #define DECLARE_INFOLEVEL(comp)
  41. #endif // DEBUG
  42. DECLARE_DEBUG(dfs);
  43. #ifdef DEBUG
  44. #define dfsDebugOut( x ) dfsInlineDebugOut x
  45. #else // DEBUG
  46. #define dfsDebugOut( x ) ((void)0)
  47. #endif // DEBUG
  48. int
  49. mylstrncmp(
  50. IN LPCTSTR lpString1,
  51. IN LPCTSTR lpString2,
  52. IN UINT cchCount
  53. );
  54. int
  55. mylstrncmpi(
  56. IN LPCTSTR lpString1,
  57. IN LPCTSTR lpString2,
  58. IN UINT cchCount
  59. );
  60. #define PROPSTRNOCHNG(str1, str2) (str1 && str2 && !lstrcmp(str1, str2) || \
  61. !str1 && str2 && !*str2 || \
  62. str1 && !*str1 && !str2 || \
  63. !str1 && !str2)
  64. #define RETURN_OUTOFMEMORY_IF_NULL(ptr) if (NULL == (ptr)) return E_OUTOFMEMORY
  65. #define BREAK_OUTOFMEMORY_IF_NULL(ptr, phr) if (NULL == (ptr)) { *phr = E_OUTOFMEMORY; break; }
  66. #define RETURN_INVALIDARG_IF_TRUE(bVal) if (bVal) return E_INVALIDARG
  67. #define RETURN_INVALIDARG_IF_NULL(ptr) if (NULL == (ptr)) return E_INVALIDARG
  68. #define RETURN_IF_FAILED(hr) if (FAILED(hr)) return (hr)
  69. #define BREAK_IF_FAILED(hr) if (FAILED(hr)) break
  70. #define RETURN_IF_NOT_S_OK(hr) if (S_OK != hr) return (hr)
  71. #define BREAK_IF_NOT_S_OK(hr) if (S_OK != hr) break
  72. #define GET_BSTR(i_ccombstr, o_pbstr) \
  73. RETURN_INVALIDARG_IF_NULL(o_pbstr); \
  74. *o_pbstr = i_ccombstr.Copy(); \
  75. RETURN_OUTOFMEMORY_IF_NULL(*o_pbstr); \
  76. return S_OK
  77. #endif // _DFSDEBUG_H_