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.

914 lines
20 KiB

  1. //---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1995
  5. //
  6. // File: parse.cxx
  7. //
  8. // Contents: NDS Pathname Parser
  9. The Pathname Parser is a key component in ADs providers. It checks for
  10. syntactic validity of an ADs pathname that has been passed to this
  11. provider. If the syntax is valid, then an OBJECTINFO structure is
  12. constructed. This OBJECTINFO structure contains a componentized version
  13. of the ADs pathname for this object.
  14. Note all that is being done is a syntax check. Rather than special-case
  15. every single new nuance to pathnames, all path checking must conform to
  16. the grammar rules laid out by the parser.
  17. //
  18. // History:
  19. //----------------------------------------------------------------------------
  20. #include "nds.hxx"
  21. #pragma hdrstop
  22. // Object -> PathName, Type, eos
  23. // Object -> PathName, eos
  24. //+---------------------------------------------------------------------------
  25. // Function: ADsObject
  26. //
  27. // Synopsis: parses an ADs pathname passed to this provider. This function
  28. // parses the following grammar rules
  29. //
  30. // <ADsObject> -> <ProviderName> <NDSObject>
  31. //
  32. //
  33. // Arguments: [CLexer * pTokenizer] - a lexical analyzer object
  34. // [POBJECTINFO pObjectInfo] - a pointer to an OBJECTINFO structure
  35. //
  36. // Returns: [HRESULT] 0 if successful, error HRESULT if not
  37. //
  38. // Modifies: pTokenizer (consumes the input buffer)
  39. //
  40. // History: 11-3-95 krishnag Created.
  41. //
  42. //----------------------------------------------------------------------------
  43. HRESULT
  44. ADsObject(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  45. {
  46. WCHAR szToken[MAX_TOKEN_LENGTH];
  47. DWORD dwToken;
  48. HRESULT hr;
  49. hr = ProviderName(pTokenizer, pObjectInfo);
  50. BAIL_IF_ERROR(hr);
  51. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  52. BAIL_IF_ERROR(hr);
  53. switch (dwToken) {
  54. case TOKEN_END:
  55. RRETURN(S_OK);
  56. case TOKEN_COMMA:
  57. hr = Type(pTokenizer, pObjectInfo);
  58. BAIL_IF_ERROR(hr);
  59. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  60. BAIL_IF_ERROR(hr);
  61. if (dwToken == TOKEN_END) {
  62. RRETURN(S_OK);
  63. }else {
  64. RRETURN(E_ADS_BAD_PATHNAME);
  65. }
  66. default:
  67. hr = pTokenizer->PushBackToken();
  68. hr = NDSObject(pTokenizer, pObjectInfo);
  69. BAIL_IF_ERROR(hr);
  70. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  71. BAIL_IF_ERROR(hr);
  72. switch (dwToken) {
  73. case TOKEN_END:
  74. RRETURN(S_OK);
  75. case TOKEN_COMMA:
  76. hr = Type(pTokenizer, pObjectInfo);
  77. BAIL_IF_ERROR(hr);
  78. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  79. BAIL_IF_ERROR(hr);
  80. if (dwToken == TOKEN_END) {
  81. RRETURN(S_OK);
  82. }else {
  83. RRETURN(E_ADS_BAD_PATHNAME);
  84. }
  85. default:
  86. RRETURN(E_FAIL);
  87. }
  88. }
  89. cleanup:
  90. RRETURN(hr);
  91. }
  92. //+---------------------------------------------------------------------------
  93. // Function: NDSObject
  94. //
  95. // Synopsis: parses an ADs pathname passed to this provider. This function
  96. // parses the following grammar rules
  97. //
  98. // <NDSObject> -> "\\""identifier""\" <PathName>
  99. //
  100. //
  101. // Arguments: [CLexer * pTokenizer] - a lexical analyzer object
  102. // [POBJECTINFO pObjectInfo] - a pointer to an OBJECTINFO structure
  103. //
  104. // Returns: [HRESULT] 0 if successful, error HRESULT if not
  105. //
  106. // Modifies: pTokenizer (consumes the input buffer)
  107. //
  108. // History: 11-3-95 krishnag Created.
  109. //
  110. //----------------------------------------------------------------------------
  111. HRESULT
  112. NDSObject(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  113. {
  114. WCHAR szToken[MAX_TOKEN_LENGTH];
  115. WCHAR szDisplayToken[MAX_TOKEN_LENGTH];
  116. DWORD dwToken;
  117. HRESULT hr;
  118. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  119. BAIL_IF_ERROR(hr);
  120. if ((dwToken != TOKEN_FSLASH) ) {
  121. RRETURN(E_ADS_BAD_PATHNAME);
  122. }
  123. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  124. BAIL_IF_ERROR(hr);
  125. if ((dwToken != TOKEN_FSLASH) ) {
  126. RRETURN(E_ADS_BAD_PATHNAME);
  127. }
  128. hr = pTokenizer->GetNextToken(szToken, szDisplayToken, &dwToken);
  129. BAIL_IF_ERROR(hr);
  130. if (dwToken != TOKEN_IDENTIFIER) {
  131. RRETURN(E_ADS_BAD_PATHNAME);
  132. }
  133. hr = AddTreeName(pObjectInfo, szToken, szDisplayToken );
  134. BAIL_IF_ERROR(hr);
  135. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  136. BAIL_IF_ERROR(hr);
  137. //
  138. // If we get an TOKEN_END, then we have a tree name only \\<tree_name>
  139. //
  140. if (dwToken == TOKEN_END || dwToken == TOKEN_COMMA) {
  141. hr = pTokenizer->PushBackToken();
  142. RRETURN(S_OK);
  143. }
  144. if ((dwToken != TOKEN_FSLASH) ) {
  145. RRETURN(E_ADS_BAD_PATHNAME);
  146. }
  147. hr = PathName(pTokenizer, pObjectInfo);
  148. BAIL_IF_ERROR(hr);
  149. cleanup:
  150. RRETURN(hr);
  151. }
  152. HRESULT
  153. ProviderName(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  154. {
  155. WCHAR szToken[MAX_TOKEN_LENGTH];
  156. DWORD dwToken;
  157. HRESULT hr;
  158. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  159. BAIL_IF_ERROR(hr);
  160. if (dwToken == TOKEN_ATSIGN) {
  161. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  162. BAIL_IF_ERROR(hr);
  163. if (dwToken != TOKEN_IDENTIFIER) {
  164. RRETURN(E_ADS_BAD_PATHNAME);
  165. }
  166. hr = AddProviderName(pObjectInfo, szToken);
  167. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  168. BAIL_IF_ERROR(hr);
  169. if (dwToken != TOKEN_EXCLAMATION) {
  170. RRETURN(E_ADS_BAD_PATHNAME);
  171. }
  172. }else if (dwToken == TOKEN_IDENTIFIER) {
  173. hr = AddProviderName(pObjectInfo, szToken);
  174. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  175. BAIL_IF_ERROR(hr);
  176. if (dwToken != TOKEN_COLON) {
  177. RRETURN(E_ADS_BAD_PATHNAME);
  178. }
  179. }else {
  180. RRETURN(E_ADS_BAD_PATHNAME);
  181. }
  182. //
  183. // You can now disable the processing for "@" and "!" treat them
  184. // as ordinary characters.
  185. //
  186. pTokenizer->SetAtDisabler(TRUE);
  187. RRETURN(S_OK);
  188. cleanup:
  189. RRETURN(hr);
  190. }
  191. // PathName -> Component \\ PathName
  192. // PathName -> Component
  193. HRESULT
  194. DsPathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  195. {
  196. WCHAR szToken[MAX_TOKEN_LENGTH];
  197. DWORD dwToken;
  198. HRESULT hr;
  199. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  200. BAIL_IF_ERROR(hr);
  201. if ((dwToken != TOKEN_FSLASH) ) {
  202. RRETURN(E_ADS_BAD_PATHNAME);
  203. }
  204. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  205. BAIL_IF_ERROR(hr);
  206. if ((dwToken != TOKEN_FSLASH) ) {
  207. RRETURN(E_ADS_BAD_PATHNAME);
  208. }
  209. hr = PathName(pTokenizer, pObjectInfo);
  210. BAIL_IF_ERROR(hr);
  211. RRETURN(S_OK);
  212. cleanup:
  213. RRETURN(hr);
  214. }
  215. //+---------------------------------------------------------------------------
  216. // Function:
  217. //
  218. // Synopsis:
  219. //
  220. // Arguments:
  221. //
  222. // Returns:
  223. //
  224. // Modifies:
  225. //
  226. // History: 11-3-95 krishnag Created.
  227. //
  228. //----------------------------------------------------------------------------
  229. HRESULT
  230. PathName(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  231. {
  232. HRESULT hr;
  233. WCHAR szToken[MAX_TOKEN_LENGTH];
  234. DWORD dwToken;
  235. hr = Component(pTokenizer, pObjectInfo);
  236. BAIL_IF_ERROR(hr);
  237. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  238. if ((dwToken == TOKEN_FSLASH) ) {
  239. RRETURN (PathName(pTokenizer, pObjectInfo));
  240. }else {
  241. hr = pTokenizer->PushBackToken();
  242. RRETURN (S_OK);
  243. }
  244. cleanup:
  245. RRETURN(hr);
  246. }
  247. //+---------------------------------------------------------------------------
  248. // Function:
  249. //
  250. // Synopsis: Component -> <identifier>
  251. //
  252. // Arguments:
  253. //
  254. // Returns:
  255. //
  256. // Modifies:
  257. //
  258. // History: 11-3-95 krishnag Created.
  259. //
  260. //----------------------------------------------------------------------------
  261. HRESULT
  262. Component(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  263. {
  264. WCHAR szValue[MAX_TOKEN_LENGTH];
  265. WCHAR szDisplayValue[MAX_TOKEN_LENGTH];
  266. WCHAR szEqual[MAX_TOKEN_LENGTH];
  267. WCHAR szComponent[MAX_TOKEN_LENGTH];
  268. WCHAR szDisplayComponent[MAX_TOKEN_LENGTH];
  269. DWORD dwToken;
  270. HRESULT hr;
  271. hr = pTokenizer->GetNextToken(szComponent, szDisplayComponent, &dwToken);
  272. BAIL_IF_ERROR(hr);
  273. if (dwToken != TOKEN_IDENTIFIER) {
  274. RRETURN(E_ADS_BAD_PATHNAME);
  275. }
  276. hr = pTokenizer->GetNextToken(szEqual, &dwToken);
  277. BAIL_IF_ERROR(hr);
  278. if (dwToken == TOKEN_EQUAL) {
  279. hr = pTokenizer->GetNextToken(szValue, szDisplayValue, &dwToken);
  280. BAIL_IF_ERROR(hr);
  281. if (dwToken != TOKEN_IDENTIFIER) {
  282. RRETURN(E_ADS_BAD_PATHNAME);
  283. }
  284. hr = AddComponent(
  285. pObjectInfo,
  286. szComponent,
  287. szValue,
  288. szDisplayComponent,
  289. szDisplayValue
  290. );
  291. BAIL_IF_ERROR(hr);
  292. }else {
  293. hr = AddComponent(pObjectInfo, szComponent, NULL, szDisplayComponent, NULL);
  294. BAIL_IF_ERROR(hr);
  295. hr = pTokenizer->PushBackToken();
  296. BAIL_IF_ERROR(hr);
  297. }
  298. RRETURN(S_OK);
  299. cleanup:
  300. RRETURN(hr);
  301. }
  302. //+---------------------------------------------------------------------------
  303. // Function:
  304. //
  305. // Synopsis:
  306. //
  307. // Arguments:
  308. //
  309. // Returns:
  310. //
  311. // Modifies:
  312. //
  313. // History: 11-3-95 krishnag Created.
  314. //
  315. //----------------------------------------------------------------------------
  316. CLexer::CLexer(LPWSTR szBuffer):
  317. _ptr(NULL),
  318. _Buffer(NULL),
  319. _dwLastTokenLength(0),
  320. _dwLastToken(0),
  321. _dwEndofString(0),
  322. _bAtDisabled(FALSE)
  323. {
  324. if (!szBuffer || !*szBuffer) {
  325. return;
  326. }
  327. _Buffer = AllocADsStr(szBuffer);
  328. _ptr = _Buffer;
  329. }
  330. //+---------------------------------------------------------------------------
  331. // Function:
  332. //
  333. // Synopsis:
  334. //
  335. // Arguments:
  336. //
  337. // Returns:
  338. //
  339. // Modifies:
  340. //
  341. // History: 08-12-96 t-danal Created.
  342. //
  343. //----------------------------------------------------------------------------
  344. CLexer::~CLexer()
  345. {
  346. FreeADsStr(_Buffer);
  347. }
  348. //+---------------------------------------------------------------------------
  349. // Function:
  350. //
  351. // Synopsis:
  352. //
  353. // Arguments:
  354. //
  355. // Returns:
  356. //
  357. // Modifies:
  358. //
  359. // History: 11-3-95 krishnag Created.
  360. //
  361. //----------------------------------------------------------------------------
  362. HRESULT
  363. CLexer::GetNextToken(LPWSTR szToken, LPWSTR szDisplayToken, LPDWORD pdwToken)
  364. {
  365. WCHAR c;
  366. DWORD state = 0;
  367. LPWSTR pch = szToken;
  368. LPWSTR pDisplayCh = szDisplayToken;
  369. BOOL fEscapeOn = FALSE, fQuotingOn = FALSE;
  370. memset(szToken, 0, sizeof(WCHAR) * MAX_TOKEN_LENGTH);
  371. if (szDisplayToken) {
  372. memset(szDisplayToken, 0, sizeof(TCHAR) * MAX_TOKEN_LENGTH);
  373. }
  374. _dwLastTokenLength = 0;
  375. while (1) {
  376. c = NextChar();
  377. switch (state) {
  378. case 0:
  379. *pch++ = c;
  380. _dwLastTokenLength++;
  381. if (c == TEXT('"')) {
  382. //
  383. // Quoting;
  384. //
  385. fQuotingOn = TRUE;
  386. pch--;
  387. state = 1;
  388. }else if (c == TEXT('\\')) {
  389. //
  390. // Escaping; Ignore the '\' in the token and check to make
  391. // sure that the next character exists
  392. //
  393. pch--;
  394. fEscapeOn = TRUE;
  395. state = 1;
  396. }else if (c == L'/') {
  397. *pdwToken = TOKEN_FSLASH;
  398. _dwLastToken = *pdwToken;
  399. RRETURN(S_OK);
  400. }else if (c == L',') {
  401. *pdwToken = TOKEN_COMMA;
  402. _dwLastToken = *pdwToken;
  403. RRETURN(S_OK);
  404. }else if (c == L'='){
  405. *pdwToken = TOKEN_EQUAL;
  406. _dwLastToken = *pdwToken;
  407. RRETURN(S_OK);
  408. /*
  409. }else if (c == L'.'){
  410. *pdwToken = TOKEN_PERIOD;
  411. _dwLastToken = *pdwToken;
  412. RRETURN(S_OK);
  413. */
  414. }else if (c == L':'){
  415. if (!_bAtDisabled) {
  416. *pdwToken = TOKEN_COLON;
  417. _dwLastToken = *pdwToken;
  418. RRETURN(S_OK);
  419. }else {
  420. state = 1;
  421. }
  422. }else if (c == TEXT('<')) {
  423. RRETURN(E_FAIL);
  424. }else if (c == TEXT('>')) {
  425. RRETURN(E_FAIL);
  426. }else if (c == L'\0'){
  427. *pdwToken = TOKEN_END;
  428. _dwLastToken = *pdwToken;
  429. RRETURN(S_OK);
  430. }else if (c == L'@') {
  431. if (!_bAtDisabled) {
  432. *pdwToken = TOKEN_ATSIGN;
  433. _dwLastToken = *pdwToken;
  434. RRETURN(S_OK);
  435. }else {
  436. state = 1;
  437. }
  438. }else if (c == L'!'){
  439. if (!_bAtDisabled) {
  440. *pdwToken = TOKEN_EXCLAMATION;
  441. _dwLastToken = *pdwToken;
  442. RRETURN(S_OK);
  443. }else {
  444. state = 1;
  445. }
  446. }else {
  447. state = 1;
  448. }
  449. break;
  450. case 1:
  451. if ((fEscapeOn || fQuotingOn) && c == TEXT('\0') ) {
  452. RRETURN(E_FAIL);
  453. }
  454. else if (fEscapeOn) {
  455. //
  456. // If escape is on, we check the next character, if it is indeed
  457. // an ADSI special character, we'll ignore the escaping, if not,
  458. // we'll put back the escaped character
  459. //
  460. if (c != '/') {
  461. *pch++ = '\\';
  462. }
  463. fEscapeOn = FALSE;
  464. *pch++ = c;
  465. _dwLastTokenLength++;
  466. state = 1;
  467. break;
  468. }
  469. else if (fQuotingOn) {
  470. if (c == TEXT('"')) {
  471. fQuotingOn = FALSE;
  472. }
  473. else {
  474. *pch++ = c;
  475. }
  476. _dwLastTokenLength++;
  477. break;
  478. }
  479. else if (c == TEXT('\\') ) {
  480. fEscapeOn = TRUE;
  481. _dwLastTokenLength++;
  482. break;
  483. }
  484. else if (c == TEXT('"')) {
  485. fQuotingOn = TRUE;
  486. _dwLastTokenLength++;
  487. break;
  488. }
  489. else if (c == L'\0' || c == L',' ||
  490. c == L'=' || c == L'/') {
  491. PushbackChar();
  492. *pdwToken = TOKEN_IDENTIFIER;
  493. _dwLastToken = *pdwToken;
  494. RRETURN (S_OK);
  495. }else if (c == L'@' || c == L'!' || c == L':' ) {
  496. if (!_bAtDisabled) {
  497. PushbackChar();
  498. *pdwToken = TOKEN_IDENTIFIER;
  499. _dwLastToken = *pdwToken;
  500. RRETURN(S_OK);
  501. }else {
  502. *pch++ = c;
  503. _dwLastTokenLength++;
  504. state = 1;
  505. break;
  506. }
  507. }else {
  508. *pch++ = c;
  509. _dwLastTokenLength++;
  510. state = 1;
  511. break;
  512. }
  513. default:
  514. RRETURN(E_FAIL);
  515. }
  516. if (pDisplayCh) {
  517. *pDisplayCh++ = c;
  518. }
  519. }
  520. }
  521. HRESULT
  522. CLexer::GetNextToken(LPWSTR szToken, LPDWORD pdwToken)
  523. {
  524. RRETURN (GetNextToken(szToken, NULL, pdwToken));
  525. }
  526. //+---------------------------------------------------------------------------
  527. // Function:
  528. //
  529. // Synopsis:
  530. //
  531. // Arguments:
  532. //
  533. // Returns:
  534. //
  535. // Modifies:
  536. //
  537. // History: 11-3-95 krishnag Created.
  538. //
  539. //----------------------------------------------------------------------------
  540. WCHAR
  541. CLexer::NextChar()
  542. {
  543. if (_ptr == NULL || *_ptr == L'\0') {
  544. _dwEndofString = TRUE;
  545. return(L'\0');
  546. }
  547. return(*_ptr++);
  548. }
  549. //+---------------------------------------------------------------------------
  550. // Function:
  551. //
  552. // Synopsis:
  553. //
  554. // Arguments:
  555. //
  556. // Returns:
  557. //
  558. // Modifies:
  559. //
  560. // History: 11-3-95 krishnag Created.
  561. //
  562. //----------------------------------------------------------------------------
  563. HRESULT
  564. CLexer::PushBackToken()
  565. {
  566. if (_dwLastToken == TOKEN_END) {
  567. RRETURN(S_OK);
  568. }
  569. _ptr -= _dwLastTokenLength;
  570. RRETURN(S_OK);
  571. }
  572. //+---------------------------------------------------------------------------
  573. // Function:
  574. //
  575. // Synopsis:
  576. //
  577. // Arguments:
  578. //
  579. // Returns:
  580. //
  581. // Modifies:
  582. //
  583. // History: 11-3-95 krishnag Created.
  584. //
  585. //----------------------------------------------------------------------------
  586. void
  587. CLexer::PushbackChar()
  588. {
  589. if (_dwEndofString) {
  590. return;
  591. }
  592. _ptr--;
  593. }
  594. //+---------------------------------------------------------------------------
  595. // Function:
  596. //
  597. // Synopsis:
  598. //
  599. // Arguments:
  600. //
  601. // Returns:
  602. //
  603. // Modifies:
  604. //
  605. // History: 11-3-95 krishnag Created.
  606. //
  607. //----------------------------------------------------------------------------
  608. BOOL
  609. CLexer::IsKeyword(LPWSTR szToken, LPDWORD pdwToken)
  610. {
  611. DWORD i = 0;
  612. for (i = 0; i < MAX_KEYWORDS; i++) {
  613. if (!_wcsicmp(szToken, KeywordList[i].Keyword)) {
  614. *pdwToken = KeywordList[i].dwTokenId;
  615. return(TRUE);
  616. }
  617. }
  618. *pdwToken = 0;
  619. return(FALSE);
  620. }
  621. //+---------------------------------------------------------------------------
  622. //Function:
  623. //
  624. //Synopsis:
  625. //
  626. //Arguments:
  627. //
  628. //Returns:
  629. //
  630. //Modifies:
  631. //
  632. //History: 11-3-95 krishnag Created.
  633. //
  634. //----------------------------------------------------------------------------
  635. HRESULT
  636. AddComponent(
  637. POBJECTINFO pObjectInfo,
  638. LPWSTR szComponent,
  639. LPWSTR szValue,
  640. LPWSTR szDisplayComponent,
  641. LPWSTR szDisplayValue
  642. )
  643. {
  644. if (!szComponent || !*szComponent || !szDisplayComponent || !*szDisplayComponent) {
  645. RRETURN(E_FAIL);
  646. }
  647. if (pObjectInfo->NumComponents < MAXCOMPONENTS) {
  648. pObjectInfo->ComponentArray[pObjectInfo->NumComponents].szComponent =
  649. AllocADsStr(szComponent);
  650. pObjectInfo->ComponentArray[pObjectInfo->NumComponents].szValue =
  651. AllocADsStr(szValue);
  652. pObjectInfo->DisplayComponentArray[pObjectInfo->NumComponents].szComponent =
  653. AllocADsStr(szDisplayComponent);
  654. pObjectInfo->DisplayComponentArray[pObjectInfo->NumComponents].szValue =
  655. AllocADsStr(szDisplayValue);
  656. pObjectInfo->NumComponents++;
  657. RRETURN(S_OK);
  658. }else {
  659. RRETURN(E_FAIL);
  660. }
  661. }
  662. HRESULT
  663. AddProviderName(POBJECTINFO pObjectInfo, LPWSTR szToken)
  664. {
  665. if (!szToken || !*szToken) {
  666. RRETURN(E_FAIL);
  667. }
  668. pObjectInfo->ProviderName = AllocADsStr(szToken);
  669. RRETURN(S_OK);
  670. }
  671. HRESULT
  672. AddTreeName(POBJECTINFO pObjectInfo, LPWSTR szToken, LPWSTR szDisplayToken)
  673. {
  674. if (!szToken || !*szToken || !szDisplayToken || !*szDisplayToken) {
  675. RRETURN(E_FAIL);
  676. }
  677. pObjectInfo->TreeName = AllocADsStr(szToken);
  678. pObjectInfo->DisplayTreeName = AllocADsStr(szDisplayToken);
  679. RRETURN(S_OK);
  680. }
  681. //+---------------------------------------------------------------------------
  682. // Function:
  683. //
  684. // Synopsis:
  685. //
  686. // Arguments:
  687. //
  688. // Returns:
  689. //
  690. // Modifies:
  691. //
  692. // History: 11-3-95 krishnag Created.
  693. //
  694. //----------------------------------------------------------------------------
  695. HRESULT
  696. SetType(POBJECTINFO pObjectInfo, DWORD dwToken)
  697. {
  698. pObjectInfo->ObjectType = dwToken;
  699. RRETURN(S_OK);
  700. }
  701. // Type -> "user", "group","printer","service", "fileservice"
  702. //+---------------------------------------------------------------------------
  703. // Function: Type
  704. //
  705. // Synopsis: Parses Type-> "user" | "group" etc
  706. //
  707. // Arguments: [CLexer * pTokenizer]
  708. // [POBJECTINFo pObjectInfo]
  709. //
  710. // Returns: HRESULT
  711. //
  712. // Modifies: -
  713. //
  714. // History: 11-3-95 krishnag Created.
  715. //
  716. //----------------------------------------------------------------------------
  717. HRESULT
  718. Type(CLexer * pTokenizer, POBJECTINFO pObjectInfo)
  719. {
  720. WCHAR szToken[MAX_PATH];
  721. DWORD dwToken;
  722. HRESULT hr;
  723. hr = pTokenizer->GetNextToken(szToken, &dwToken);
  724. BAIL_IF_ERROR(hr);
  725. if (dwToken == TOKEN_IDENTIFIER ) {
  726. if (pTokenizer->IsKeyword(szToken, &dwToken)) {
  727. pObjectInfo->ClassName = AllocADsStr(szToken);
  728. }
  729. RRETURN(hr);
  730. }
  731. RRETURN(E_FAIL);
  732. cleanup:
  733. RRETURN(hr);
  734. }
  735. void
  736. CLexer::SetAtDisabler(
  737. BOOL bFlag
  738. )
  739. {
  740. _bAtDisabled = bFlag;
  741. }
  742. BOOL
  743. CLexer::GetAtDisabler()
  744. {
  745. return(_bAtDisabled);
  746. }