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.

90 lines
2.5 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. _vstprintf(acsString, pszfmt, va); \
  19. va_end(va);\
  20. OutputDebugString(acsString);\
  21. } \
  22. }\
  23. _inline void \
  24. comp##InlineDebugOut( TCHAR *pszfmt, ...) \
  25. { \
  26. if ( TRUE ) \
  27. { \
  28. TCHAR acsString[1000];\
  29. va_list va; \
  30. va_start(va, pszfmt);\
  31. _vstprintf(acsString, pszfmt, va); \
  32. va_end(va);\
  33. OutputDebugString(acsString);\
  34. } \
  35. }
  36. #else // DEBUG
  37. #define DECLARE_DEBUG(comp)
  38. #define DECLARE_INFOLEVEL(comp)
  39. #endif // DEBUG
  40. DECLARE_DEBUG(dfs);
  41. #ifdef DEBUG
  42. #define dfsDebugOut( x ) dfsInlineDebugOut x
  43. #else // DEBUG
  44. #define dfsDebugOut( x ) ((void)0)
  45. #endif // DEBUG
  46. int
  47. mylstrncmp(
  48. IN LPCTSTR lpString1,
  49. IN LPCTSTR lpString2,
  50. IN UINT cchCount
  51. );
  52. int
  53. mylstrncmpi(
  54. IN LPCTSTR lpString1,
  55. IN LPCTSTR lpString2,
  56. IN UINT cchCount
  57. );
  58. #define PROPSTRNOCHNG(str1, str2) (str1 && str2 && !lstrcmpi(str1, str2) || \
  59. !str1 && str2 && !*str2 || \
  60. str1 && !*str1 && !str2 || \
  61. !str1 && !str2)
  62. #define RETURN_OUTOFMEMORY_IF_NULL(ptr) if (NULL == (ptr)) return E_OUTOFMEMORY
  63. #define BREAK_OUTOFMEMORY_IF_NULL(ptr, phr) if (NULL == (ptr)) { *phr = E_OUTOFMEMORY; break; }
  64. #define RETURN_INVALIDARG_IF_TRUE(bVal) if (bVal) return E_INVALIDARG
  65. #define RETURN_INVALIDARG_IF_NULL(ptr) if (NULL == (ptr)) return E_INVALIDARG
  66. #define RETURN_IF_FAILED(hr) if (FAILED(hr)) return (hr)
  67. #define BREAK_IF_FAILED(hr) if (FAILED(hr)) break
  68. #define RETURN_IF_NOT_S_OK(hr) if (S_OK != hr) return (hr)
  69. #define BREAK_IF_NOT_S_OK(hr) if (S_OK != hr) break
  70. #define GET_BSTR(i_ccombstr, o_pbstr) \
  71. RETURN_INVALIDARG_IF_NULL(o_pbstr); \
  72. *o_pbstr = i_ccombstr.Copy(); \
  73. RETURN_OUTOFMEMORY_IF_NULL(*o_pbstr); \
  74. return S_OK
  75. #endif // _DFSDEBUG_H_