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.

224 lines
6.6 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: hsplit.h
  3. *
  4. * Copyright (c) 1985-96, Microsoft Corporation
  5. *
  6. * 09/05/96 GerardoB Created
  7. \***************************************************************************/
  8. #include <stdio.h>
  9. #include <stddef.h>
  10. #include <windows.h>
  11. /***************************************************************************\
  12. * Defines
  13. \***************************************************************************/
  14. // hsLogMsg
  15. #define HSLM_DEFAULT 0x0000
  16. #define HSLM_NOLABEL 0x0001
  17. #define HSLM_ERROR 0x0002
  18. #define HSLM_WARNING 0x0004
  19. #define HSLM_API 0x0008
  20. #define HSLM_APIERROR (HSLM_API | HSLM_ERROR)
  21. #define HSLM_NOEOL 0x0010
  22. #define HSLM_APPEND (HSLM_NOLABEL | HSLM_NOEOL)
  23. #define HSLM_NOLINE 0x0020
  24. #define HSLM_UNEXPECTEDEOF 0x0040
  25. #define HSLM_EOFERROR (HSLM_UNEXPECTEDEOF | HSLM_ERROR)
  26. /*
  27. * Tag mask bits.
  28. * IMPORTANT: If you add a tag mask bit,
  29. * update HST_MASKBITCOUNT and HST_NEXTMASK
  30. */
  31. /*
  32. * Types
  33. */
  34. #define HST_DEFAULT 0x00000000
  35. #define HST_ERROR 0x00000001
  36. #define HST_MAPOLD 0x00000002
  37. #define HST_SKIP 0x00000004
  38. #define HST_UNKNOWN 0x00000008
  39. #define HST_IGNORE 0x00000010
  40. /*
  41. * Headers
  42. */
  43. #define HST_PUBLIC 0x00000020
  44. #define HST_INTERNAL 0x00000040
  45. #define HST_BOTH (HST_PUBLIC | HST_INTERNAL)
  46. #define HST_USERINTERNALTAG 0x00000080
  47. #define HST_USERBOTHTAG 0x00000100
  48. #define HST_USERHEADERTAG (HST_USERINTERNALTAG | HST_USERBOTHTAG)
  49. /*
  50. * Blocks
  51. */
  52. #define HST_BEGIN 0x00000200
  53. #define HST_END 0x00000400
  54. #define HST_BLOCK (HST_BEGIN | HST_END)
  55. #define HST_IF 0x00000800
  56. #define HST_USERINTERNALBLOCK 0x00001000
  57. #define HST_USERBOTHBLOCK 0x00002000
  58. #define HST_USERBLOCK (HST_USERINTERNALBLOCK | HST_USERBOTHBLOCK)
  59. #define HST_WINVER 0x00004000
  60. #define HST_INCINTERNAL 0x00008000
  61. #define HST_INTERNALNOTCOMP 0x00010000
  62. #define HST_EXTRACTONLY 0x00020000
  63. #define HST_EXTRACT 0x00040000
  64. /*
  65. * This is the count of HST_ bits; 32 - HST_MASKBITCOUNT is the number
  66. * of tags that can be created from the command line parameters
  67. */
  68. #define HST_LASTMASK 0x00040000
  69. #define HST_USERTAGSMASK 0xFFF80000
  70. #define HST_MAXMASK 0x80000000
  71. #define HST_MASKBITCOUNT 19
  72. /*
  73. * Options
  74. */
  75. #define HSO_APPENDOUTPUT 0x00000001
  76. #define HSO_OLDPROJSW_N 0x00000002
  77. #define HSO_OLDPROJSW_4 0x00000004
  78. #define HSO_OLDPROJSW_E 0x00000008
  79. #define HSO_OLDPROJSW_P 0x00000010
  80. #define HSO_OLDPROJSW (HSO_OLDPROJSW_N | HSO_OLDPROJSW_4 | HSO_OLDPROJSW_E | HSO_OLDPROJSW_P)
  81. #define HSO_SPLITONLY 0x00000020
  82. #define HSO_INCINTERNAL 0x00000040
  83. #define HSO_USERINTERNALBLOCK 0x00000080
  84. #define HSO_USERBOTHBLOCK 0x00000100
  85. #define HSO_USERBLOCK (HSO_USERINTERNALBLOCK | HSO_USERBOTHBLOCK)
  86. #define HSO_USERINTERNALTAG 0x00000200
  87. #define HSO_USERBOTHTAG 0x00000400
  88. #define HSO_USERHEADERTAG (HSO_USERINTERNALTAG | HSO_USERBOTHTAG)
  89. #define HSO_SKIPUNKNOWN 0x00000800
  90. /***************************************************************************\
  91. * Structures
  92. \***************************************************************************/
  93. typedef struct _HSTAG
  94. {
  95. SIZE_T dwLabelSize;
  96. char * pszLabel;
  97. DWORD dwMask;
  98. } HSTAG, * PHSTAG;
  99. typedef struct _HSBLOCK
  100. {
  101. DWORD dwMask;
  102. char * pszifLabel;
  103. DWORD dwLineNumber;
  104. } HSBLOCK, * PHSBLOCK;
  105. typedef struct _HSEXTRACT
  106. {
  107. struct _HSEXTRACT * pNext;
  108. char * pszFile;
  109. HANDLE hfile;
  110. DWORD dwMask;
  111. } HSEXTRACT, * PHSEXTRACT;
  112. /***************************************************************************\
  113. * Macros
  114. \***************************************************************************/
  115. #define HSCSZSIZE(sz) sizeof(sz)-1
  116. #define HSLABEL(sz) HSCSZSIZE(#sz), #sz
  117. /***************************************************************************\
  118. * Globals
  119. \***************************************************************************/
  120. /*
  121. * Files
  122. */
  123. extern char * gpszInputFile;
  124. extern HANDLE ghfileInput;
  125. extern char * gpszPublicFile;
  126. extern HANDLE ghfilePublic;
  127. extern char * gpszInternalFile;
  128. extern HANDLE ghfileInternal;
  129. extern PHSEXTRACT gpExtractFile;
  130. /*
  131. * Map file
  132. */
  133. extern HANDLE ghmap;
  134. extern char * gpmapStart;
  135. extern char * gpmapEnd;
  136. /*
  137. * Switches et al
  138. */
  139. extern DWORD gdwOptions;
  140. extern DWORD gdwVersion;
  141. extern char gszVerifyVersionStr [];
  142. extern DWORD gdwFilterMask;
  143. extern char * gpszTagMarker;
  144. extern DWORD gdwTagMarkerSize;
  145. extern char gszMarkerCharAndEOL [];
  146. extern DWORD gdwLineNumber;
  147. /*
  148. * Compatibility tags.
  149. * Specify size so sizeof operator can be used to calculate strlen at
  150. * compile time
  151. */
  152. extern char gsz35 [3];
  153. extern char gszCairo [6];
  154. extern char gszChicago [8];
  155. extern char gszNashville [10];
  156. extern char gszNT [3];
  157. extern char gszSur [4];
  158. extern char gszSurplus [8];
  159. extern char gszWin40 [6];
  160. extern char gszWin40a [7];
  161. /*
  162. * Tag labels
  163. * Specify size so sizeof operator can be used to calculate table size at
  164. * compile time
  165. */
  166. extern HSTAG ghstPredefined [16];
  167. extern PHSTAG gphst;
  168. extern DWORD gdwLastTagMask;
  169. /*
  170. * Blocks stack
  171. */
  172. #define HSBSTACKSIZE 20
  173. extern HSBLOCK ghsbStack [HSBSTACKSIZE];
  174. #define HSBSTACKLIMIT (ghsbStack + HSBSTACKSIZE - 1)
  175. extern PHSBLOCK gphsbStackTop;
  176. /***************************************************************************\
  177. * Funtion Prototypes
  178. \***************************************************************************/
  179. // hsfile.c
  180. BOOL hsCloseWorkingFiles (void);
  181. BOOL hsOpenWorkingFiles (void);
  182. BOOL hsWriteHeaderFiles (char * pmap, DWORD dwSize, DWORD dwFlags);
  183. // hsparse.c
  184. PHSTAG hsFindTagInList (PHSTAG phst, char * pmapTag, DWORD dwTagSize);
  185. BOOL hsSplit (void);
  186. // hsutil.c
  187. void __cdecl hsLogMsg(DWORD dwFlags, char *pszfmt, ...);
  188. /***************************************************************************\
  189. * Inline functions
  190. \***************************************************************************/
  191. __inline BOOL hsVersionFromString (char * pString, DWORD dwSize, DWORD * pdwVersion)
  192. {
  193. return sscanf(pString, "%x", pdwVersion)
  194. && (dwSize == (DWORD)sprintf(gszVerifyVersionStr, "%x", *pdwVersion));
  195. }