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.

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