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.

231 lines
6.4 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. growbuf.h
  5. Abstract:
  6. Implements the GROWBUFFER data type, a dynamically allocated buffer
  7. that grows (and potentially changes addresses). GROWBUFFERs are
  8. typically used to maintain dynamic sized arrays, or multi-sz lists.
  9. Author:
  10. Jim Schmidt (jimschm) 25-Feb-1997
  11. Revision History:
  12. <alias> <date> <comments>
  13. --*/
  14. typedef struct {
  15. PBYTE Buf;
  16. DWORD Size;
  17. DWORD End;
  18. DWORD GrowSize;
  19. DWORD UserIndex; // Unused by Growbuf. For caller use.
  20. } GROWBUFFER, *PGROWBUFFER;
  21. #define GROWBUF_INIT {NULL,0,0,0,0}
  22. PBYTE
  23. RealGrowBuffer (
  24. IN OUT PGROWBUFFER GrowBuf,
  25. IN DWORD SpaceNeeded
  26. );
  27. #define GrowBuffer(buf,size) SETTRACKCOMMENT(PBYTE,"GrowBuffer",__FILE__,__LINE__)\
  28. RealGrowBuffer(buf,size)\
  29. CLRTRACKCOMMENT
  30. VOID
  31. FreeGrowBuffer (
  32. IN PGROWBUFFER GrowBuf
  33. );
  34. PBYTE
  35. RealGrowBufferReserve (
  36. IN OUT PGROWBUFFER GrowBuf,
  37. IN DWORD SpaceNeeded
  38. );
  39. #define GrowBufferReserve(buf,size) SETTRACKCOMMENT(PBYTE,"GrowBufferReserve",__FILE__,__LINE__)\
  40. RealGrowBufferReserve(buf,size)\
  41. CLRTRACKCOMMENT
  42. BOOL
  43. RealMultiSzAppendA (
  44. PGROWBUFFER GrowBuf,
  45. PCSTR String
  46. );
  47. #define MultiSzAppendA(buf,str) SETTRACKCOMMENT(BOOL,"MultiSzAppendA",__FILE__,__LINE__)\
  48. RealMultiSzAppendA(buf,str)\
  49. CLRTRACKCOMMENT
  50. BOOL
  51. RealMultiSzAppendW (
  52. PGROWBUFFER GrowBuf,
  53. PCWSTR String
  54. );
  55. #define MultiSzAppendW(buf,str) SETTRACKCOMMENT(BOOL,"MultiSzAppendW",__FILE__,__LINE__)\
  56. RealMultiSzAppendW(buf,str)\
  57. CLRTRACKCOMMENT
  58. BOOL
  59. RealMultiSzAppendValA (
  60. PGROWBUFFER GrowBuf,
  61. PCSTR Key,
  62. DWORD Val
  63. );
  64. #define MultiSzAppendValA(buf,k,v) SETTRACKCOMMENT(BOOL,"MultiSzAppendValA",__FILE__,__LINE__)\
  65. RealMultiSzAppendValA(buf,k,v)\
  66. CLRTRACKCOMMENT
  67. BOOL
  68. RealMultiSzAppendValW (
  69. PGROWBUFFER GrowBuf,
  70. PCWSTR Key,
  71. DWORD Val
  72. );
  73. #define MultiSzAppendValW(buf,k,v) SETTRACKCOMMENT(BOOL,"MultiSzAppendValW",__FILE__,__LINE__)\
  74. RealMultiSzAppendValW(buf,k,v)\
  75. CLRTRACKCOMMENT
  76. BOOL
  77. RealMultiSzAppendStringA (
  78. PGROWBUFFER GrowBuf,
  79. PCSTR Key,
  80. PCSTR Val
  81. );
  82. #define MultiSzAppendStringA(buf,k,v) SETTRACKCOMMENT(BOOL,"MultiSzAppendStringA",__FILE__,__LINE__)\
  83. RealMultiSzAppendStringA(buf,k,v)\
  84. CLRTRACKCOMMENT
  85. BOOL
  86. RealMultiSzAppendStringW (
  87. PGROWBUFFER GrowBuf,
  88. PCWSTR Key,
  89. PCWSTR Val
  90. );
  91. #define MultiSzAppendStringW(buf,k,v) SETTRACKCOMMENT(BOOL,"MultiSzAppendStringW",__FILE__,__LINE__)\
  92. RealMultiSzAppendStringW(buf,k,v)\
  93. CLRTRACKCOMMENT
  94. BOOL
  95. RealGrowBufAppendDword (
  96. PGROWBUFFER GrowBuf,
  97. DWORD d
  98. );
  99. #define GrowBufAppendDword(buf,d) SETTRACKCOMMENT(BOOL,"GrowBufAppendDword",__FILE__,__LINE__)\
  100. RealGrowBufAppendDword(buf,d)\
  101. CLRTRACKCOMMENT
  102. BOOL
  103. RealGrowBufAppendUintPtr (
  104. PGROWBUFFER GrowBuf,
  105. UINT_PTR d
  106. );
  107. #define GrowBufAppendUintPtr(buf,d) SETTRACKCOMMENT(BOOL,"GrowBufAppendUintPtr",__FILE__,__LINE__)\
  108. RealGrowBufAppendUintPtr(buf,d)\
  109. CLRTRACKCOMMENT
  110. BOOL
  111. RealGrowBufAppendStringA (
  112. PGROWBUFFER GrowBuf,
  113. PCSTR String
  114. );
  115. #define GrowBufAppendStringA(buf,str) SETTRACKCOMMENT(BOOL,"GrowBufAppendStringA",__FILE__,__LINE__)\
  116. RealGrowBufAppendStringA(buf,str)\
  117. CLRTRACKCOMMENT
  118. BOOL
  119. RealGrowBufAppendStringW (
  120. PGROWBUFFER GrowBuf,
  121. PCWSTR String
  122. );
  123. #define GrowBufAppendStringW(buf,str) SETTRACKCOMMENT(BOOL,"GrowBufAppendStringW",__FILE__,__LINE__)\
  124. RealGrowBufAppendStringW(buf,str)\
  125. CLRTRACKCOMMENT
  126. BOOL
  127. RealGrowBufAppendStringABA (
  128. PGROWBUFFER GrowBuf,
  129. PCSTR Start,
  130. PCSTR EndPlusOne
  131. );
  132. #define GrowBufAppendStringABA(buf,a,b) SETTRACKCOMMENT(BOOL,"GrowBufAppendStringABA",__FILE__,__LINE__)\
  133. RealGrowBufAppendStringABA(buf,a,b)\
  134. CLRTRACKCOMMENT
  135. BOOL
  136. RealGrowBufAppendStringABW (
  137. PGROWBUFFER GrowBuf,
  138. PCWSTR Start,
  139. PCWSTR EndPlusOne
  140. );
  141. #define GrowBufAppendStringABW(buf,a,b) SETTRACKCOMMENT(BOOL,"GrowBufAppendStringABW",__FILE__,__LINE__)\
  142. RealGrowBufAppendStringABW(buf,a,b)\
  143. CLRTRACKCOMMENT
  144. BOOL
  145. RealGrowBufCopyStringA (
  146. PGROWBUFFER GrowBuf,
  147. PCSTR String
  148. );
  149. #define GrowBufCopyStringA(buf,str) SETTRACKCOMMENT(BOOL,"GrowBufCopyStringA",__FILE__,__LINE__)\
  150. RealGrowBufCopyStringA(buf,str)\
  151. CLRTRACKCOMMENT
  152. BOOL
  153. RealGrowBufCopyStringW (
  154. PGROWBUFFER GrowBuf,
  155. PCWSTR String
  156. );
  157. #define GrowBufCopyStringW(buf,str) SETTRACKCOMMENT(BOOL,"GrowBufCopyStringW",__FILE__,__LINE__)\
  158. RealGrowBufCopyStringW(buf,str)\
  159. CLRTRACKCOMMENT
  160. #ifdef UNICODE
  161. #define MultiSzAppend MultiSzAppendW
  162. #define MultiSzAppendVal MultiSzAppendValW
  163. #define MultiSzAppendString MultiSzAppendStringW
  164. #define GrowBufAppendString GrowBufAppendStringW
  165. #define GrowBufAppendStringAB GrowBufAppendStringABW
  166. #define GrowBufCopyString GrowBufCopyStringW
  167. #else
  168. #define MultiSzAppend MultiSzAppendA
  169. #define MultiSzAppendVal MultiSzAppendValA
  170. #define MultiSzAppendString MultiSzAppendStringA
  171. #define GrowBufAppendString GrowBufAppendStringA
  172. #define GrowBufAppendStringAB GrowBufAppendStringABA
  173. #define GrowBufCopyString GrowBufCopyStringA
  174. #endif