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.

270 lines
6.4 KiB

  1. #define MAX_TOKEN_LENGTH 1024
  2. #define MAXCOMPONENTS 64
  3. #define TOKEN_IDENTIFIER 1
  4. #define TOKEN_COMMA 2
  5. // This no longer exists
  6. // #define TOKEN_BSLASH 3
  7. #define TOKEN_END 4
  8. #define TOKEN_DOMAIN 5
  9. #define TOKEN_USER 6
  10. #define TOKEN_GROUP 7
  11. #define TOKEN_PRINTER 8
  12. #define TOKEN_COMPUTER 9
  13. #define TOKEN_SERVICE 10
  14. #define TOKEN_ATSIGN 11
  15. #define TOKEN_EXCLAMATION 12
  16. #define TOKEN_COLON 13
  17. #define TOKEN_FSLASH 14
  18. #define TOKEN_PROVIDER 15
  19. #define TOKEN_FILESERVICE 16
  20. #define TOKEN_SCHEMA 17
  21. #define TOKEN_CLASS 18
  22. #define TOKEN_FUNCTIONALSET 19
  23. #define TOKEN_FUNCTIONALSETALIAS 20
  24. #define TOKEN_PROPERTY 21
  25. #define TOKEN_SYNTAX 22
  26. #define TOKEN_FILESHARE 23
  27. #define TOKEN_PERIOD 24
  28. #define TOKEN_EQUAL 25
  29. #define TOKEN_NAMESPACE 26
  30. #define TOKEN_TREE 27
  31. #define TOKEN_LDAPOBJECT 28
  32. #define TOKEN_LOCALITY 29
  33. #define TOKEN_ORGANIZATION 30
  34. #define TOKEN_ORGANIZATIONUNIT 31
  35. #define TOKEN_COUNTRY 32
  36. #define TOKEN_ROOTDSE 33
  37. #define TOKEN_SEMICOLON 34
  38. #define TOKEN_OPENBRACKET 40
  39. #define TOKEN_CLOSEBRACKET 41
  40. #define TOKEN_QUOTE 42
  41. #define TOKEN_DOLLAR 43
  42. #define TOKEN_NAME 44
  43. #define TOKEN_DESC 45
  44. #define TOKEN_OBSOLETE 46
  45. #define TOKEN_SUP 47
  46. #define TOKEN_EQUALITY 48
  47. #define TOKEN_ORDERING 49
  48. #define TOKEN_SUBSTR 50
  49. #define TOKEN_SINGLE_VALUE 52
  50. #define TOKEN_COLLECTIVE 53
  51. #define TOKEN_DYNAMIC 54
  52. #define TOKEN_NO_USER_MODIFICATION 55
  53. #define TOKEN_USAGE 56
  54. #define TOKEN_ABSTRACT 57
  55. #define TOKEN_STRUCTURAL 58
  56. #define TOKEN_AUXILIARY 59
  57. #define TOKEN_MUST 60
  58. #define TOKEN_MAY 61
  59. #define TOKEN_AUX 62
  60. #define TOKEN_NOT 63
  61. #define TOKEN_FORM 64
  62. #define TOKEN_OPEN_CURLY 65
  63. #define TOKEN_CLOSE_CURLY 66
  64. //
  65. // Token X is used for terms like X- in the schema.
  66. // These are provider specific and need to be ignored.
  67. //
  68. #define TOKEN_X 67
  69. #define PATHTYPE_WINDOWS 1
  70. #define PATHTYPE_X500 2
  71. typedef struct _component {
  72. LPTSTR szComponent;
  73. LPTSTR szValue;
  74. }COMPONENT, *PCOMPONENT;
  75. typedef struct _objectinfo {
  76. LPTSTR ProviderName;
  77. LPTSTR NamespaceName;
  78. LPTSTR TreeName;
  79. LPTSTR DisplayTreeName;
  80. DWORD ObjectType;
  81. LPTSTR ObjectClass;
  82. DWORD dwServerPresent;
  83. DWORD dwPathType;
  84. DWORD NumComponents;
  85. COMPONENT ComponentArray[MAXCOMPONENTS];
  86. COMPONENT DisplayComponentArray[MAXCOMPONENTS];
  87. DWORD PortNumber;
  88. LPWSTR szStrBuf;
  89. LPWSTR szDisplayStrBuf;
  90. LPWSTR szStrBufPtr;
  91. LPWSTR szDisplayStrBufPtr;
  92. } OBJECTINFO, *POBJECTINFO;
  93. typedef struct _kwdlist {
  94. DWORD dwTokenId;
  95. LPTSTR Keyword;
  96. } KWDLIST, *PKWDLIST;
  97. extern KWDLIST KeywordList[];
  98. extern DWORD gdwKeywordListSize;
  99. class FAR CLexer
  100. {
  101. public:
  102. __declspec(dllexport)
  103. CLexer(LPTSTR szBuffer);
  104. __declspec(dllexport)
  105. ~CLexer();
  106. BOOL
  107. CLexer::IsKeyword(LPTSTR szToken, LPDWORD pdwToken);
  108. TCHAR
  109. CLexer::NextChar();
  110. void
  111. CLexer::PushbackChar();
  112. __declspec(dllexport)
  113. HRESULT
  114. CLexer::GetNextToken(LPTSTR szToken, LPDWORD pdwToken);
  115. HRESULT
  116. CLexer::GetNextToken(LPTSTR szToken, LPTSTR szDisplayToken, LPDWORD pdwToken);
  117. HRESULT
  118. CLexer::PushBackToken();
  119. __declspec(dllexport)
  120. void
  121. CLexer::SetAtDisabler(BOOL bFlag);
  122. BOOL
  123. CLexer::GetAtDisabler();
  124. __declspec(dllexport)
  125. void
  126. CLexer::SetFSlashDisabler(BOOL bFlag);
  127. BOOL
  128. CLexer::GetFSlashDisabler();
  129. __declspec(dllexport)
  130. void
  131. CLexer::SetExclaimnationDisabler(BOOL bFlag);
  132. BOOL
  133. CLexer::GetExclaimnationDisabler();
  134. private:
  135. LPTSTR _ptr;
  136. LPTSTR _Buffer;
  137. DWORD _dwLastTokenLength;
  138. DWORD _dwLastToken;
  139. DWORD _dwEndofString;
  140. BOOL _bAtDisabled;
  141. BOOL _bFSlashDisabled;
  142. BOOL _bExclaimDisabled;
  143. };
  144. HRESULT
  145. ADsObject(
  146. LPWSTR pszADsPathName,
  147. POBJECTINFO pObjectInfo
  148. );
  149. HRESULT
  150. GetNextToken(
  151. CLexer *pTokenizer,
  152. POBJECTINFO pObjectInfo,
  153. LPWSTR *ppszToken,
  154. LPWSTR *ppszDisplayToken,
  155. DWORD *pdwToken
  156. );
  157. HRESULT
  158. GetNextToken(
  159. CLexer *pTokenizer,
  160. POBJECTINFO pObjectInfo,
  161. LPWSTR *ppszToken,
  162. DWORD *pdwToken
  163. );
  164. HRESULT
  165. ADsObjectParse(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  166. HRESULT
  167. LDAPObject(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  168. HRESULT
  169. DsPathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  170. HRESULT
  171. PathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  172. HRESULT
  173. Component(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  174. HRESULT
  175. Type(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  176. HRESULT
  177. ProviderName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  178. HRESULT
  179. AddTreeName(POBJECTINFO pObjectInfo, LPTSTR szToken, LPTSTR szDisplayToken);
  180. HRESULT
  181. AddPortNumber(POBJECTINFO pObjectInfo, DWORD dwPort);
  182. HRESULT
  183. SetType(POBJECTINFO pObjectInfo, DWORD dwToken);
  184. HRESULT
  185. SchemaPathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  186. HRESULT
  187. SchemaComponent(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  188. VOID
  189. FreeObjectInfo( POBJECTINFO pObjectInfo );
  190. HRESULT
  191. InitObjectInfo(
  192. LPWSTR pszADsPathName,
  193. POBJECTINFO pObjectInfo
  194. );
  195. HRESULT
  196. AddComponent( POBJECTINFO pObjectInfo, LPTSTR szComponent, LPTSTR szValue,
  197. LPTSTR szDisplayComponent, LPTSTR szDisplayValue );
  198. HRESULT
  199. AddProviderName( POBJECTINFO pObjectInfo, LPTSTR szToken );
  200. HRESULT
  201. AddNamespaceName( POBJECTINFO pObjectInfo, LPTSTR szToken );
  202. HRESULT
  203. GetDisplayName(
  204. LPWSTR szName,
  205. LPWSTR *ppszDisplayName
  206. );
  207. HRESULT
  208. GetLDAPTypeName(
  209. LPWSTR szName,
  210. LPWSTR *ppszDisplayName
  211. );