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.

113 lines
3.5 KiB

  1. #define NL '\n'
  2. #define CR '\r'
  3. /*
  4. The following equate is used starting with the earliest preprocessing
  5. to handle the case of two lines with quoted strings that are joined
  6. by a line continuation character. The result is something like
  7. "abc""def" -- which evaluates to abc"def. So DQUOTE is used to start and
  8. end a quoted string, and the " character is used where a " character is
  9. actually part of the string.
  10. */
  11. #define DQUOTE 1
  12. #define NUL 0
  13. #define EOL NUL
  14. #define IS_SEPARATOR(x) (((x) == ' ') || ((x) == ','))
  15. /*
  16. Structure used to describe a preparsed line. Array of
  17. these is set up at load time and used at run time.
  18. The union is used because at preparse time, the offset of the
  19. line is stored instead of a pointer to the line's text. This is
  20. because the buffer is reallocated as it grows and thus may move.
  21. When preparsing is complete the offsets are converted to pointers.
  22. */
  23. typedef struct _tagINFLINE {
  24. USHORT flags;
  25. union {
  26. LPSTR addr;
  27. UINT offset;
  28. } text;
  29. } INFLINE, *PINFLINE;
  30. #define INFLINE_NORMAL 0x00
  31. #define INFLINE_SECTION 0x01
  32. #define INFLINE_KEY 0x02
  33. /*
  34. Token and token-related constants
  35. */
  36. #define TOKEN_VARIABLE 10
  37. #define TOKEN_LIST_FROM_SECTION_NTH_ITEM 11
  38. #define TOKEN_FIELD_ADDRESSOR 12
  39. #define TOKEN_APPEND_ITEM_TO_LIST 13
  40. #define TOKEN_NTH_ITEM_FROM_LIST 14
  41. #define TOKEN_LOCATE_ITEM_IN_LIST 15
  42. #define TOKEN_OPERATOR_FIRST TOKEN_VARIABLE
  43. #define TOKEN_OPERATOR_LAST TOKEN_LOCATE_ITEM_IN_LIST
  44. #define IS_OPERATOR_TOKEN(x) (((x) >= TOKEN_OPERATOR_FIRST) && \
  45. ((x) <= TOKEN_OPERATOR_LAST ))
  46. #define TOKEN_LIST_START 20
  47. #define TOKEN_LIST_END 21
  48. #define TOKEN_SPACE 40
  49. #define TOKEN_COMMA 41
  50. #define TOKEN_RIGHT_PAREN 50
  51. #define TOKEN_KEY 60
  52. /*
  53. a short string is one whose length is 0-99. This is the most
  54. common case, so the length is encoded into the token. A short
  55. string can really therefore be any token from 100-199.
  56. A string is one whose length is 100-355. Its length fits into
  57. one byte after subtracting 100.
  58. A long string is > 355. Its length takes two bytes to represent
  59. and is not specially modified with an add or subtract like a string.
  60. */
  61. #define TOKEN_SHORT_STRING 100
  62. #define TOKEN_STRING 200
  63. #define TOKEN_LONG_STRING 201
  64. #define IS_STRING_TOKEN(x) (((x) >= TOKEN_SHORT_STRING) && \
  65. ((x) <= TOKEN_LONG_STRING ))
  66. #define TOKEN_EOL 253
  67. #define TOKEN_ERROR 254
  68. #define TOKEN_UNKNOWN 255
  69. /*
  70. Function prototypes
  71. */
  72. GRC
  73. PreprocessINFFile(
  74. LPSTR FileName,
  75. PBYTE *ResultBuffer,
  76. UINT *ResultBufferSize
  77. );
  78. GRC
  79. PreparseINFFile(
  80. PUCHAR INFFile,
  81. UINT INFFileSize,
  82. PUCHAR *PreparsedINFFile,
  83. UINT *PreparsedINFFileBufferSize,
  84. PINFLINE *LineArray,
  85. UINT *LineCount
  86. );