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.

806 lines
21 KiB

  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. typedef unsigned char BYTE;
  6. typedef BYTE *PBYTE;
  7. //
  8. // These "raw tokens" are the stuff that comes out of the
  9. // base tokenization engine. Special characters are given
  10. // names, a 'special character' being one that is called out
  11. // anywhere in the XML spec as having a meaning other than
  12. // text.
  13. //
  14. typedef enum
  15. {
  16. NTXML_RAWTOKEN_ERROR,
  17. NTXML_RAWTOKEN_DASH,
  18. NTXML_RAWTOKEN_DOT,
  19. NTXML_RAWTOKEN_END_OF_STREAM,
  20. NTXML_RAWTOKEN_EQUALS,
  21. NTXML_RAWTOKEN_FORWARDSLASH,
  22. NTXML_RAWTOKEN_GT,
  23. NTXML_RAWTOKEN_LT,
  24. NTXML_RAWTOKEN_QUESTIONMARK,
  25. NTXML_RAWTOKEN_QUOTE,
  26. NTXML_RAWTOKEN_DOUBLEQUOTE,
  27. NTXML_RAWTOKEN_START_OF_STREAM,
  28. NTXML_RAWTOKEN_TEXT,
  29. NTXML_RAWTOKEN_WHITESPACE,
  30. NTXML_RAWTOKEN_OPENBRACKET,
  31. NTXML_RAWTOKEN_CLOSEBRACKET,
  32. NTXML_RAWTOKEN_BANG,
  33. NTXML_RAWTOKEN_OPENCURLY,
  34. NTXML_RAWTOKEN_CLOSECURLY,
  35. NTXML_RAWTOKEN_COLON,
  36. NTXML_RAWTOKEN_SEMICOLON,
  37. NTXML_RAWTOKEN_UNDERSCORE,
  38. NTXML_RAWTOKEN_AMPERSTAND,
  39. NTXML_RAWTOKEN_POUNDSIGN
  40. } NTXML_RAW_TOKEN;
  41. typedef enum {
  42. XMLEF_UNKNOWN = 0,
  43. XMLEF_UCS_4_LE,
  44. XMLEF_UCS_4_BE,
  45. XMLEF_UTF_16_LE,
  46. XMLEF_UTF_16_BE,
  47. XMLEF_UTF_8_OR_ASCII
  48. } XML_ENCODING_FAMILY;
  49. typedef struct _XML_EXTENT {
  50. PVOID pvData; // Pointer into the original XML document
  51. SIZE_T cbData; // Byte count from the extent base
  52. XML_ENCODING_FAMILY Encoding; // Encoding family for faster decoding
  53. ULONG ulCharacters; // Character count in this extent
  54. }
  55. XML_EXTENT, *PXML_EXTENT;
  56. typedef const struct _XML_EXTENT * PCXML_EXTENT;
  57. //
  58. // Clients of the raw tokenizer should provide a "next character"
  59. // functionality. This way, the tokenization engine doesn't need
  60. // to know anything about how to get the next thing out of a pvoid
  61. // blob of data, allowing for compressed streams, multiple encodings,
  62. // etc.
  63. //
  64. typedef ULONG (__fastcall *NTXMLRAWNEXTCHARACTER)(
  65. struct _XML_RAWTOKENIZATION_STATE* pContext
  66. );
  67. typedef struct _XML_SPECIAL_STRING {
  68. //
  69. // UNICODE representation of the string
  70. //
  71. WCHAR *wszStringText;
  72. SIZE_T cchwszStringText;
  73. }
  74. XML_SPECIAL_STRING, *PXML_SPECIAL_STRING;
  75. typedef const struct _XML_SPECIAL_STRING *PCXML_SPECIAL_STRING;
  76. #define EMPTY_SPECIAL_STRING { NULL, 0 }
  77. #define MAKE_SPECIAL_STRING(str) { L##str, NUMBER_OF(L##str) - 1 }
  78. extern XML_SPECIAL_STRING xss_CDATA;
  79. extern XML_SPECIAL_STRING xss_xml;
  80. extern XML_SPECIAL_STRING xss_encoding;
  81. extern XML_SPECIAL_STRING xss_standalone;
  82. extern XML_SPECIAL_STRING xss_version;
  83. //
  84. // A 'raw' token is more or less a run of bytes in the XML that is given
  85. // a name. The low-level tokenizer returns these as it runs, and assumes
  86. // that the higher-level tokenizer knows how to turn groups of these into
  87. // productions, and from there the lexer knows how to turn groups of the
  88. // real tokens into meaning.
  89. //
  90. typedef struct _XML_RAW_TOKEN
  91. {
  92. //
  93. // This is the 'name' of this token, so that we can easily switch on
  94. // it in upper-level layers.
  95. //
  96. NTXML_RAW_TOKEN TokenName;
  97. //
  98. // Pointer and length of the extent
  99. //
  100. XML_EXTENT Run;
  101. }
  102. XML_RAW_TOKEN, *PXML_RAW_TOKEN;
  103. //
  104. // This is the base tokenization state blob necessary to keep tokenizing
  105. // between calls. See member descriptions for more details.
  106. //
  107. typedef struct _XML_RAWTOKENIZATION_STATE
  108. {
  109. //
  110. // PVOID and length of the original XML document
  111. //
  112. XML_EXTENT OriginalDocument;
  113. //
  114. // Pointer to the 'end' of the document.
  115. //
  116. PVOID pvDocumentEnd;
  117. //
  118. // Pointer into the XML data that represents where we are at the moment
  119. // in tokenization. Will not be moved by the raw tokenizer - you must
  120. // use the NtRawXmlAdvanceCursor (or related) to move the cursor along
  121. // the data stream. Hence, calling the tokenizer twice in a row will
  122. // get you the same token.
  123. //
  124. PVOID pvCursor;
  125. //
  126. // The function that this tokenization run is using for getting the
  127. // next WCHAR out of the PVOID pointed to by pvCursor. If this member
  128. // is NULL, you get a bit of default functionality that knows about
  129. // UNICODE, little-endianness, and UTF8.
  130. //
  131. NTXMLRAWNEXTCHARACTER pfnNextChar;
  132. //
  133. // The encoding family can be detected from the first bytes in the
  134. // incoming stream. They are classified according to the XML spec,
  135. // which defaults to UTF-8.
  136. //
  137. XML_ENCODING_FAMILY EncodingFamily;
  138. //
  139. // When the upper-level tokenizer detects the "encoding" statement
  140. // in the <?xml ...?> declaration, it should set this member to the
  141. // code page that was found. Noticably, this will start out as
  142. // zero on initialization. A smart "next character" function will
  143. // do some default operation to continue working even if this is
  144. // unset.
  145. //
  146. ULONG DetectedCodePage;
  147. XML_RAW_TOKEN LastTokenCache;
  148. PVOID pvLastCursor;
  149. //
  150. // How many bytes were in the last thing?
  151. //
  152. SIZE_T cbBytesInLastRawToken;
  153. //
  154. // Result of the next-character call
  155. //
  156. NTSTATUS NextCharacterResult;
  157. //
  158. // Default character size, set by the initializer that determines the
  159. // encoding.
  160. //
  161. SIZE_T DefaultCharacterSize;
  162. }
  163. XML_RAWTOKENIZATION_STATE, *PXML_RAWTOKENIZATION_STATE;
  164. //
  165. // Simple interface out to the Real World. This allocator should be
  166. // replaced (eventually) with calls directly into the proper
  167. // allocator (HeapAlloc/ExAllocatePoolWithTag) in production code.
  168. //
  169. typedef NTSTATUS (*NTXML_ALLOCATOR)(
  170. SIZE_T ulBytes,
  171. PVOID *ppvAllocated,
  172. PVOID pvAllocationContext);
  173. //
  174. // Frees memory allocated with the corresponding NTXML_ALLOCATOR
  175. // call.
  176. //
  177. typedef NTSTATUS (*NTXML_DEALLOCATOR)(PVOID pvAllocated, PVOID pvContext);
  178. /*++
  179. Normal operation would go like this:
  180. <?xml version="1.0"? encoding="UTF-8" standalone="yes"?>
  181. <!-- commentary -->
  182. <?bonk foo?>
  183. <ham>
  184. <frooby:cheese hot="yes"/>
  185. </ham>
  186. XTLS_STREAM_START
  187. XTLS_XMLDECL {XTSS_XMLDECL_OPEN "<?xml" }
  188. XTLS_XMLDECL {XTSS_XMLDECL_VERSION "version" }
  189. XTLS_XMLDECL {XTSS_XMLDECL_EQUALS "=" }
  190. XTLS_XMLDECL {XTSS_XMLDECL_VALUE "1.0" }
  191. XTLS_XMLDECL {XTSS_XMLDECL_ENCODING "encoding" }
  192. XTLS_XMLDECL {XTSS_XMLDECL_EQUALS "=" }
  193. XTLS_XMLDECL {XTSS_XMLDECL_VALUE "UTF-8" }
  194. XTLS_XMLDECL {XTSS_XMLDECL_STANDALONE "standalone" }
  195. XTLS_XMLDECL {XTSS_XMLDECL_EQUALS "=" }
  196. XTLS_XMLDECL {XTSS_XMLDECL_VALUE "yes" }
  197. XTLS_XMLDECL {XTSS_XMLDECL_CLOSE "?>" }
  198. XTLS_COMMENT {XTSS_COMMENT_OPEN "<!--" }
  199. XTLS_COMMENT {XTSS_COMMENT_CONTENT " commentary " }
  200. XTLS_COMMENT {XTSS_COMMENT_CLOSE "-->" }
  201. XTLS_PROCESSING_INSTRUCTION {XTSS_PI_OPEN "<?" }
  202. XTLS_PROCESSING_INSTRUCTION {XTSS_PI_NAME "bonk" }
  203. XTLS_PROCESSING_INSTRUCTION {XTSS_PI_CONTENT "foo" }
  204. XTLS_PROCESSING_INSTRUCTION {XTSS_PI_CLOSE "?>" }
  205. XTLS_FLOATINGDATA {XTSS_FD_WHITESPACE "\n" }
  206. XTLS_ELEMENT {XTSS_ELEMENT_OPEN "<" }
  207. XTLS_ELEMENT {XTSS_ELEMENT_NAME "ham" }
  208. XTLS_ELEMENT {XTSS_ELEMENT_CLOSE ">" }
  209. XTLS_FLOATINGDATA {XTSS_FLOATINGDATA "\n " }
  210. XTLS_ELEMENT {XTSS_ELEMENT_OPEN "<" }
  211. XTLS_ELEMENT {XTSS_ELEMENT_NAMESPACE "frooby" }
  212. XTLS_ELEMENT {XTSS_ELEMENT_NAME "cheese" }
  213. XTLS_ELEMENT {XTSS_ELEMENT_VALUENAME "hot" }
  214. XTLS_ELEMENT {XTSS_ELEMENT_VALUE "yes" }
  215. XTLS_ELEMENT {XTSS_ELEMENT_EMPTYCLOSE "/>" }
  216. XTLS_FLOATINGDATA {XTSS_FLOATINGDATA "\n" }
  217. XTLS_ELEMENT {XTSS_ELEMENT_CLOSETAG "</" }
  218. XTLS_ELEMENT {XTSS_ELEMENT_NAME "ham" }
  219. XTLS_ELEMENT {XTSS_ELEMENT_CLOSE ">" }
  220. XTLS_STREAM_END
  221. --*/
  222. typedef enum {
  223. XTSS_ERRONEOUS,
  224. //
  225. // In the middle of "nowhere" - the hyperspace between elements
  226. //
  227. XTSS_STREAM_HYPERSPACE,
  228. //
  229. // At the start of the input stream
  230. //
  231. XTSS_STREAM_START,
  232. //
  233. // At the end of the input stream
  234. //
  235. XTSS_STREAM_END,
  236. ////////////////////////////////////////////
  237. //
  238. // ELEMENT STATES
  239. //
  240. ////////////////////////////////////////////
  241. //
  242. // Meaning: An element tag was found.
  243. //
  244. // Rawtoken: NTXML_RAWTOKEN_LT
  245. //
  246. XTSS_ELEMENT_OPEN,
  247. //
  248. // Meaning: A run of text was found that could represent a name.
  249. // This is basically all the text found between the opening
  250. // element tag and some illegal values.
  251. //
  252. // Rawtoken: A run of any of the following:
  253. // NTXML_RAWTOKEN_TEXT
  254. // NTXML_RAWTOKEN_DOT
  255. // NTXML_RAWTOKEN_COLON
  256. // NTXML_RAWTOKEN_UNDERSCORE
  257. // NTXML_RAWTOKEN_DASH
  258. // The name ends when something else appears.
  259. //
  260. XTSS_ELEMENT_NAME,
  261. //
  262. // Found the xmlns part of <foo xmlns:bar=
  263. //
  264. XTSS_ELEMENT_XMLNS,
  265. //
  266. // Found <foo xmlns=
  267. //
  268. XTSS_ELEMENT_XMLNS_DEFAULT,
  269. //
  270. // Found the 'a' in <foo xml:a=
  271. //
  272. XTSS_ELEMENT_XMLNS_ALIAS,
  273. //
  274. // Found the colon between xmlns and the alias
  275. //
  276. XTSS_ELEMENT_XMLNS_COLON,
  277. //
  278. // Found the equals sign between xmlns and the value
  279. //
  280. XTSS_ELEMENT_XMLNS_EQUALS,
  281. XTSS_ELEMENT_XMLNS_VALUE_OPEN,
  282. XTSS_ELEMENT_XMLNS_VALUE_CLOSE,
  283. XTSS_ELEMENT_XMLNS_VALUE,
  284. //
  285. // This is the prefix for an element name, if present
  286. //
  287. XTSS_ELEMENT_NAME_NS_PREFIX,
  288. //
  289. // This is the colon after an element name ns prefix
  290. //
  291. XTSS_ELEMENT_NAME_NS_COLON,
  292. //
  293. // This is the prefix on an attribute name for a namespace
  294. //
  295. XTSS_ELEMENT_ATTRIBUTE_NAME_NS_PREFIX,
  296. //
  297. // This is the colon after an element attribute name namespace prefix
  298. //
  299. XTSS_ELEMENT_ATTRIBUTE_NAME_NS_COLON,
  300. //
  301. // Meaning: A close of a tag (>) was found
  302. //
  303. // Rawtoken: NTXML_RAWTOKEN_GT
  304. //
  305. XTSS_ELEMENT_CLOSE,
  306. //
  307. // Meaning: An empty-tag (/>) was found
  308. //
  309. // Rawtoken: NTXML_RAWTOKEN_FORWARDSLASH NTXML_RAWTOKEN_GT
  310. //
  311. XTSS_ELEMENT_CLOSE_EMPTY,
  312. //
  313. // Meaning: An attribute name was found
  314. //
  315. // Rawtoken: See rules for XTSS_ELEMENT_NAME
  316. //
  317. XTSS_ELEMENT_ATTRIBUTE_NAME,
  318. //
  319. // Meaning: An equals sign was found in an element
  320. //
  321. // Rawtoken: NTXML_RAWTOKEN_EQUALS
  322. //
  323. XTSS_ELEMENT_ATTRIBUTE_EQUALS,
  324. //
  325. // Meaning: The quote (start or end) of an element-attribute value
  326. // was found.
  327. //
  328. // Rawtokne; NTXML_RAWTOKEN_QUOTE
  329. //
  330. XTSS_ELEMENT_ATTRIBUTE_QUOTE,
  331. //
  332. // Meaning: Element attribute value data was found after a
  333. // quote of some variety.
  334. //
  335. // Rawtoken: A run of any thing that's not the following:
  336. // NTXML_RAWTOKEN_LT
  337. // NTXML_RAWTOKEN_QUOTE (unless this quote is not the same
  338. // as the quote in
  339. // XTSS_ELEMENT_ATTRIBUTE_QUOTE)
  340. //
  341. // N.B.: See special rules on handling entities in text.
  342. //
  343. XTSS_ELEMENT_ATTRIBUTE_VALUE,
  344. XTSS_ELEMENT_ATTRIBUTE_OPEN,
  345. XTSS_ELEMENT_ATTRIBUTE_CLOSE,
  346. //
  347. // Meaning: Whitespace was found in the element tag at this point
  348. //
  349. // Rawtoken: NTXML_RAWTOKEN_WHITESPACE
  350. //
  351. XTSS_ELEMENT_WHITESPACE,
  352. ////////////////////////////////////////////
  353. //
  354. // END ELEMENT SPECIFIC STATES
  355. //
  356. ////////////////////////////////////////////
  357. //
  358. // Meaning: The start of an "end element" was found
  359. //
  360. // Rawtoken: NTXML_RAWTOKEN_LT NTXML_RAWTOKEN_FORWARDSLASH
  361. //
  362. XTSS_ENDELEMENT_OPEN,
  363. //
  364. // Meaning: The name of an end element was found
  365. //
  366. // Rawtoken: See rules for XTSS_ELEMENT_NAME
  367. //
  368. XTSS_ENDELEMENT_NAME,
  369. //
  370. // Meaning: We're in the whitespace portion of the end element
  371. //
  372. // Rawtoken: NTXML_RAWTOKEN_WHITESPACE
  373. //
  374. XTSS_ENDELEMENT_WHITESPACE,
  375. //
  376. // Meaning: The close of an endelement tag was found
  377. //
  378. // Rawtoken: NTXML_RAWTOKEN_GT
  379. //
  380. XTSS_ENDELEMENT_CLOSE,
  381. //
  382. // Namespace prefix on the endelement name
  383. //
  384. XTSS_ENDELEMENT_NS_PREFIX,
  385. //
  386. // Colon after the namespace prefix in the endelement tag
  387. //
  388. XTSS_ENDELEMENT_NS_COLON,
  389. ////////////////////////////////////////////
  390. //
  391. // XML PROCESSING INSTRUCTION STATES
  392. //
  393. ////////////////////////////////////////////
  394. //
  395. // Meaning: The start of an xml processing instruction was found
  396. //
  397. // Rawtokens: NTXML_RAWTOKEN_LT NTXML_RAWTOKEN_QUESTIONMARK
  398. //
  399. XTSS_PI_OPEN,
  400. //
  401. // Meaning: The end of an XML processing instruction was found
  402. //
  403. // Rawtokens: NTXML_RAWTOKEN_QUESTIONMARK NTXML_RAWTOKEN_GT
  404. //
  405. XTSS_PI_CLOSE,
  406. //
  407. // Meaning: The processing instruction name was found
  408. //
  409. // Rawtokens: A nonempty stream of tokens identifying a name. See the
  410. // rules for XTSS_ELEMENT_NAME for details.
  411. //
  412. XTSS_PI_TARGET,
  413. //
  414. // Meaning: Some processing instruction metadata was found.
  415. //
  416. // Rawtokens: Anything except the sequence
  417. // NTXML_RAWTOKEN_QUESTIONMARK NTXML_RAWTOKEN_GT
  418. //
  419. XTSS_PI_VALUE,
  420. //
  421. // Meaning: Whitespace between the target and the value was found
  422. //
  423. // Rawtokens: NTXML_RAWTOKEN_WHITESPACE
  424. //
  425. XTSS_PI_WHITESPACE,
  426. ////////////////////////////////////////////
  427. //
  428. // XML PROCESSING INSTRUCTION STATES
  429. //
  430. ////////////////////////////////////////////
  431. //
  432. // Meaning: Start of a comment block
  433. //
  434. // Rawtokens: NTXML_RAWTOKEN_LT NTXML_RAWTOKEN_BANG NTXML_RAWTOKEN_DASH NTXML_RAWTOKEN_DASH
  435. //
  436. XTSS_COMMENT_OPEN,
  437. //
  438. // Meaning: Commentary data, should be ignored by a good processor
  439. //
  440. // Rawtokens: Anything except the sequence:
  441. // NTXML_RAWTOKEN_DASH NTXML_RAWTOKEN_DASH
  442. //
  443. XTSS_COMMENT_COMMENTARY,
  444. //
  445. // Meaning: Comment close tag
  446. //
  447. // Rawtokens: NTXML_RAWTOKEN_DASH NTXML_RAWTOKEN_DASH NTXML_RAWTOKEN_GT
  448. //
  449. XTSS_COMMENT_CLOSE,
  450. ////////////////////////////////////////////
  451. //
  452. // XML PROCESSING INSTRUCTION STATES
  453. //
  454. ////////////////////////////////////////////
  455. //
  456. // Meaning: Opening of a CDATA block
  457. //
  458. // Rawtokens: NTXML_RAWTOKEN_LT
  459. // NTXML_RAWTOKEN_BRACE
  460. // NTXML_RAWTOKEN_BANG
  461. // NTXML_RAWTOKEN_TEXT (CDATA)
  462. // NTXML_RAWTOKEN_BRACE
  463. //
  464. XTSS_CDATA_OPEN,
  465. //
  466. // Meaning: Unparseable CDATA stuff
  467. //
  468. // Rawtokens: Anything except the sequence
  469. // NTXML_RAWTOKEN_BRACE
  470. // NTXML_RAWTOKEN_BRACE
  471. // NTXML_RAWTOKEN_GT
  472. //
  473. XTSS_CDATA_CDATA,
  474. //
  475. // Meaning: End of a CDATA block
  476. //
  477. XTSS_CDATA_CLOSE,
  478. ////////////////////////////////////////////
  479. //
  480. // XMLDECL (<?xml) states
  481. //
  482. ////////////////////////////////////////////
  483. XTSS_XMLDECL_OPEN,
  484. XTSS_XMLDECL_CLOSE,
  485. XTSS_XMLDECL_WHITESPACE,
  486. XTSS_XMLDECL_EQUALS,
  487. XTSS_XMLDECL_ENCODING,
  488. XTSS_XMLDECL_STANDALONE,
  489. XTSS_XMLDECL_VERSION,
  490. XTSS_XMLDECL_VALUE_OPEN,
  491. XTSS_XMLDECL_VALUE,
  492. XTSS_XMLDECL_VALUE_CLOSE,
  493. } XML_TOKENIZATION_SPECIFIC_STATE;
  494. //
  495. // Another, similar XML token structure for the 'cooked' XML bits.
  496. //
  497. typedef struct _XML_TOKEN {
  498. //
  499. // Pointer and length of the data in the token
  500. //
  501. XML_EXTENT Run;
  502. //
  503. // What state are we in at the moment
  504. //
  505. XML_TOKENIZATION_SPECIFIC_STATE State;
  506. //
  507. // Was there an error gathering up this state?
  508. //
  509. BOOLEAN fError;
  510. }
  511. XML_TOKEN, *PXML_TOKEN;
  512. typedef const struct _XML_TOKEN *PCXML_TOKEN;
  513. typedef enum {
  514. XML_STRING_COMPARE_EQUALS = 0,
  515. XML_STRING_COMPARE_GT = 1,
  516. XML_STRING_COMPARE_LT = -1
  517. }
  518. XML_STRING_COMPARE;
  519. //
  520. // This function knows how to compare a pvoid and a length against
  521. // a 7-bit ascii string
  522. //
  523. typedef NTSTATUS (*NTXMLSPECIALSTRINGCOMPARE)(
  524. struct _XML_TOKENIZATION_STATE *pState,
  525. const struct _XML_EXTENT *pRawToken,
  526. const struct _XML_SPECIAL_STRING *pSpecialString,
  527. XML_STRING_COMPARE *pfResult
  528. );
  529. //
  530. // Compare two extents
  531. //
  532. typedef NTSTATUS (*NTXMLCOMPARESTRINGS)(
  533. struct _XML_TOKENIZATION_STATE *TokenizationState,
  534. PXML_EXTENT pLeft,
  535. PXML_EXTENT pRight,
  536. XML_STRING_COMPARE *pfEquivalent);
  537. typedef NTSTATUS (*RTLXMLCALLBACK)(
  538. PVOID pvCallbackContext,
  539. struct _XML_TOKENIZATION_STATE *State,
  540. PCXML_TOKEN Token,
  541. PBOOLEAN StopTokenization
  542. );
  543. //
  544. // Now let's address the 'cooked' tokenization
  545. // methodology.
  546. //
  547. typedef struct _XML_TOKENIZATION_STATE {
  548. //
  549. // Core tokenization state data
  550. //
  551. XML_RAWTOKENIZATION_STATE RawTokenState;
  552. //
  553. // State values
  554. //
  555. XML_TOKENIZATION_SPECIFIC_STATE PreviousState;
  556. //
  557. // Scratch pad for holding tokens
  558. //
  559. XML_RAW_TOKEN RawTokenScratch[20];
  560. //
  561. // Ways to compare two strings
  562. //
  563. NTXMLCOMPARESTRINGS pfnCompareStrings;
  564. //
  565. // Compare an extent against a 'magic' string
  566. //
  567. NTXMLSPECIALSTRINGCOMPARE pfnCompareSpecialString;
  568. //
  569. // Scratch space for the opening quote rawtoken name, if we're in
  570. // a quoted string (ie: attribute value, etc.)
  571. //
  572. NTXML_RAW_TOKEN QuoteTemp;
  573. //
  574. // Callback
  575. //
  576. PVOID prgXmlTokenCallbackContext;
  577. RTLXMLCALLBACK prgXmlTokenCallback;
  578. }
  579. XML_TOKENIZATION_STATE, *PXML_TOKENIZATION_STATE;
  580. NTSTATUS
  581. RtlXmlAdvanceTokenization(
  582. PXML_TOKENIZATION_STATE pState,
  583. PXML_TOKEN pToken
  584. );
  585. NTSTATUS
  586. RtlXmlDetermineStreamEncoding(
  587. PXML_TOKENIZATION_STATE pState,
  588. PSIZE_T pulBytesOfEncoding,
  589. PXML_EXTENT EncodingName
  590. );
  591. NTSTATUS
  592. RtlXmlInitializeTokenization(
  593. PXML_TOKENIZATION_STATE pState,
  594. PVOID pvData,
  595. SIZE_T cbData,
  596. NTXMLRAWNEXTCHARACTER pfnNextCharacter,
  597. NTXMLSPECIALSTRINGCOMPARE pfnSpecialStringComparison,
  598. NTXMLCOMPARESTRINGS pfnNormalStringComparison
  599. );
  600. NTSTATUS
  601. RtlXmlCloneRawTokenizationState(
  602. const PXML_RAWTOKENIZATION_STATE pStartState,
  603. PXML_RAWTOKENIZATION_STATE pTargetState
  604. );
  605. NTSTATUS
  606. RtlXmlCloneTokenizationState(
  607. const PXML_TOKENIZATION_STATE pStartState,
  608. PXML_TOKENIZATION_STATE pTargetState
  609. );
  610. NTSTATUS
  611. RtlXmlNextToken(
  612. PXML_TOKENIZATION_STATE pState,
  613. PXML_TOKEN pToken,
  614. BOOLEAN fAdvanceState
  615. );
  616. NTSTATUS
  617. RtlXmlCopyStringOut(
  618. PXML_TOKENIZATION_STATE pState,
  619. PXML_EXTENT pExtent,
  620. PWSTR pwszTarget,
  621. SIZE_T *pCchResult
  622. );
  623. NTSTATUS
  624. RtlXmlDefaultCompareStrings(
  625. PXML_TOKENIZATION_STATE pState,
  626. PCXML_EXTENT pLeft,
  627. PCXML_EXTENT pRight,
  628. XML_STRING_COMPARE *pfEqual
  629. );
  630. NTSTATUS
  631. RtlXmlIsExtentWhitespace(
  632. PXML_TOKENIZATION_STATE pState,
  633. PCXML_EXTENT Run,
  634. PBOOLEAN pfIsWhitespace
  635. );
  636. NTXML_RAW_TOKEN FORCEINLINE FASTCALL
  637. _RtlpDecodeCharacter(ULONG ulCharacter);
  638. #define STATUS_NTXML_INVALID_FORMAT (0xc0100000)
  639. #ifndef NUMBER_OF
  640. #define NUMBER_OF(q) (sizeof(q)/sizeof((q)[0]))
  641. #endif
  642. #ifdef __cplusplus
  643. };
  644. #endif