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.

274 lines
6.7 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();
  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. __declspec(dllexport)
  135. HRESULT
  136. CLexer::InitializePath(LPTSTR szBuffer);
  137. private:
  138. LPTSTR _ptr;
  139. LPTSTR _Buffer;
  140. DWORD _dwLastTokenLength;
  141. DWORD _dwLastToken;
  142. DWORD _dwEndofString;
  143. BOOL _bAtDisabled;
  144. BOOL _bFSlashDisabled;
  145. BOOL _bExclaimDisabled;
  146. };
  147. HRESULT
  148. ADsObject(
  149. LPWSTR pszADsPathName,
  150. POBJECTINFO pObjectInfo
  151. );
  152. HRESULT
  153. GetNextToken(
  154. CLexer *pTokenizer,
  155. POBJECTINFO pObjectInfo,
  156. LPWSTR *ppszToken,
  157. LPWSTR *ppszDisplayToken,
  158. DWORD *pdwToken
  159. );
  160. HRESULT
  161. GetNextToken(
  162. CLexer *pTokenizer,
  163. POBJECTINFO pObjectInfo,
  164. LPWSTR *ppszToken,
  165. DWORD *pdwToken
  166. );
  167. HRESULT
  168. ADsObjectParse(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  169. HRESULT
  170. LDAPObject(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  171. HRESULT
  172. DsPathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  173. HRESULT
  174. PathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  175. HRESULT
  176. Component(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  177. HRESULT
  178. Type(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  179. HRESULT
  180. ProviderName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  181. HRESULT
  182. AddTreeName(POBJECTINFO pObjectInfo, LPTSTR szToken, LPTSTR szDisplayToken);
  183. HRESULT
  184. AddPortNumber(POBJECTINFO pObjectInfo, DWORD dwPort);
  185. HRESULT
  186. SetType(POBJECTINFO pObjectInfo, DWORD dwToken);
  187. HRESULT
  188. SchemaPathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  189. HRESULT
  190. SchemaComponent(CLexer * pTokenizer, POBJECTINFO pObjectInfo);
  191. VOID
  192. FreeObjectInfo( POBJECTINFO pObjectInfo );
  193. HRESULT
  194. InitObjectInfo(
  195. LPWSTR pszADsPathName,
  196. POBJECTINFO pObjectInfo
  197. );
  198. HRESULT
  199. AddComponent( POBJECTINFO pObjectInfo, LPTSTR szComponent, LPTSTR szValue,
  200. LPTSTR szDisplayComponent, LPTSTR szDisplayValue );
  201. HRESULT
  202. AddProviderName( POBJECTINFO pObjectInfo, LPTSTR szToken );
  203. HRESULT
  204. AddNamespaceName( POBJECTINFO pObjectInfo, LPTSTR szToken );
  205. HRESULT
  206. GetDisplayName(
  207. LPWSTR szName,
  208. LPWSTR *ppszDisplayName
  209. );
  210. HRESULT
  211. GetLDAPTypeName(
  212. LPWSTR szName,
  213. LPWSTR *ppszDisplayName
  214. );