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.

127 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. common.h
  5. Abstract:
  6. Private header file for sputils
  7. Author:
  8. Jamie Hunter (JamieHun) Jun-27-2000
  9. Revision History:
  10. --*/
  11. //
  12. // internally we may use some definitions from these files
  13. //
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <windows.h>
  18. #include <windowsx.h>
  19. #include <stddef.h>
  20. #include <regstr.h>
  21. #include <tchar.h>
  22. #include <setupapi.h>
  23. #include <spapip.h>
  24. #include "strtab.h"
  25. #include "locking.h"
  26. //
  27. // if a function is private to this library, we don't want to collide with functions
  28. // in other libraries etc
  29. // since C doesn't have namespaces, either make "static" or prefix _pSpUtils
  30. //
  31. #ifndef ASSERTS_ON
  32. #if DBG
  33. #define ASSERTS_ON 1
  34. #else
  35. #define ASSERTS_ON 0
  36. #endif
  37. #endif
  38. #if DBG
  39. #ifndef MEM_DBG
  40. #define MEM_DBG 1
  41. #endif
  42. #else
  43. #ifndef MEM_DBG
  44. #define MEM_DBG 0
  45. #endif
  46. #endif
  47. VOID
  48. _pSpUtilsAssertFail(
  49. IN PSTR FileName,
  50. IN UINT LineNumber,
  51. IN PSTR Condition
  52. );
  53. #if ASSERTS_ON
  54. #define MYASSERT(x) if(!(x)) { _pSpUtilsAssertFail(__FILE__,__LINE__,#x); }
  55. #define MYVERIFY(x) ((x)? TRUE : _pSpUtilsAssertFail(__FILE__,__LINE__,#x), FALSE)
  56. #else
  57. #define MYASSERT(x)
  58. #define MYVERIFY(x) ((x)? TRUE : FALSE)
  59. #endif
  60. #define ARRAYSIZE(x) (sizeof((x))/sizeof((x)[0]))
  61. #define SIZECHARS(x) ARRAYSIZE(x)
  62. #define CSTRLEN(x) (SIZECHARS(x)-1)
  63. BOOL
  64. _pSpUtilsMemoryInitialize(
  65. VOID
  66. );
  67. BOOL
  68. _pSpUtilsMemoryUninitialize(
  69. VOID
  70. );
  71. VOID
  72. _pSpUtilsDebugPrintEx(
  73. DWORD Level,
  74. PCTSTR format,
  75. ... OPTIONAL
  76. );
  77. //
  78. // internally turn on the extra memory debug code if requested
  79. //
  80. #if MEM_DBG
  81. #undef pSetupCheckedMalloc
  82. #undef pSetupCheckInternalHeap
  83. #undef pSetupMallocWithTag
  84. #define pSetupCheckedMalloc(Size) pSetupDebugMalloc(Size,__FILE__,__LINE__)
  85. #define pSetupCheckInternalHeap() pSetupHeapCheck()
  86. #define pSetupMallocWithTag(Size,Tag) pSetupDebugMallocWithTag(Size,__FILE__,__LINE__,Tag)
  87. #endif
  88. //
  89. // internal tags
  90. //
  91. #ifdef UNICODE
  92. #define MEMTAG_STATICSTRINGTABLE (0x5353484a) // JHSS
  93. #define MEMTAG_STRINGTABLE (0x5453484a) // JHST
  94. #define MEMTAG_STRINGDATA (0x4453484a) // JHSD
  95. #else
  96. #define MEMTAG_STATICSTRINGTABLE (0x7373686a) // jhss
  97. #define MEMTAG_STRINGTABLE (0x7473686a) // jhst
  98. #define MEMTAG_STRINGDATA (0x6473686a) // jhsd
  99. #endif