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.

1304 lines
20 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 2000
  5. //
  6. // File: querytable.cpp
  7. //
  8. // Contents: Defines Table For Parser.
  9. //
  10. // History: 24-Sep-2000 Hiteshr Created
  11. //
  12. //
  13. //--------------------------------------------------------------------------
  14. #include "pch.h"
  15. #include "cstrings.h"
  16. #include "querytable.h"
  17. #include "usage.h"
  18. #include "querybld.h"
  19. //+-------------------------------------------------------------------------
  20. // Parser table
  21. //--------------------------------------------------------------------------
  22. ARG_RECORD DSQUERY_COMMON_COMMANDS[] =
  23. {
  24. #ifdef DBG
  25. //
  26. // -debug, -debug
  27. //
  28. 0,(LPWSTR)c_sz_arg1_com_debug,
  29. 0,NULL,
  30. ARG_TYPE_DEBUG, ARG_FLAG_OPTIONAL|ARG_FLAG_HIDDEN,
  31. NULL,
  32. 0, NULL,
  33. #endif
  34. //
  35. // h, ?
  36. //
  37. 0,(LPWSTR)c_sz_arg1_com_help,
  38. 0,(LPWSTR)c_sz_arg2_com_help,
  39. ARG_TYPE_HELP, ARG_FLAG_OPTIONAL,
  40. NULL,
  41. 0, NULL,
  42. //
  43. // s,server
  44. //
  45. 0,(LPWSTR)c_sz_arg1_com_server,
  46. 0,(LPWSTR)c_sz_arg2_com_server,
  47. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  48. NULL,
  49. 0, NULL,
  50. //
  51. // d,domain
  52. //
  53. 0,(LPWSTR)c_sz_arg1_com_domain,
  54. 0,NULL,
  55. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  56. NULL,
  57. 0, NULL,
  58. //
  59. // u, username
  60. //
  61. 0,(LPWSTR)c_sz_arg1_com_username,
  62. 0,(LPWSTR)c_sz_arg2_com_username,
  63. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  64. NULL,
  65. 0, NULL,
  66. //
  67. // w, password
  68. //
  69. 0,(LPWSTR)c_sz_arg1_com_password,
  70. 0,(LPWSTR)c_sz_arg2_com_password,
  71. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  72. NULL,
  73. 0, ValidateAdminPassword,
  74. //
  75. // q,q
  76. //
  77. 0,(LPWSTR)c_sz_arg1_com_quiet,
  78. 0,NULL,
  79. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  80. NULL,
  81. 0, NULL,
  82. //
  83. // objecttype
  84. //
  85. 0,(LPWSTR)c_sz_arg1_com_objecttype,
  86. 0,NULL,
  87. ARG_TYPE_STR, ARG_FLAG_REQUIRED|ARG_FLAG_NOFLAG,
  88. 0,
  89. 0, NULL,
  90. //
  91. // r,r
  92. //
  93. 0,(LPWSTR)c_sz_arg1_com_recurse,
  94. 0,NULL,
  95. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  96. NULL,
  97. 0, NULL,
  98. //
  99. // gc,gc
  100. //
  101. 0,(LPWSTR)c_sz_arg1_com_gc,
  102. 0,NULL,
  103. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  104. NULL,
  105. 0, NULL,
  106. //
  107. // o,outputformat
  108. //
  109. 0,(LPWSTR)c_sz_arg1_com_output,
  110. 0,NULL,
  111. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  112. NULL,
  113. 0, NULL,
  114. //
  115. // startnode,startnode
  116. //
  117. // JonN 4/28/01 256583
  118. // Note that startnode can also be "domainroot" or "forestroot",
  119. // which just happen to be unaffected by the escaping functions.
  120. 0,(LPWSTR)c_sz_arg1_com_startnode,
  121. 0,NULL,
  122. ARG_TYPE_STR, ARG_FLAG_OPTIONAL|ARG_FLAG_DN,
  123. NULL,
  124. 0, NULL,
  125. //
  126. // limit
  127. //
  128. 0,(LPWSTR)c_sz_arg1_com_limit,
  129. 0,NULL,
  130. ARG_TYPE_INT, ARG_FLAG_OPTIONAL,
  131. NULL,
  132. 0, NULL,
  133. ARG_TERMINATOR
  134. };
  135. ARG_RECORD DSQUERY_STAR_COMMANDS[]=
  136. {
  137. //
  138. // scope
  139. //
  140. 0, (PWSTR)g_pszArg1StarScope,
  141. 0, NULL,
  142. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  143. 0,
  144. 0, NULL,
  145. //
  146. // filter
  147. //
  148. 0, (PWSTR)g_pszArg1StarFilter,
  149. 0, NULL,
  150. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  151. 0,
  152. 0, NULL,
  153. //
  154. // attr
  155. //
  156. 0, (PWSTR)g_pszArg1StarAttr,
  157. 0, NULL,
  158. ARG_TYPE_MSZ, ARG_FLAG_OPTIONAL,
  159. 0,
  160. 0, NULL,
  161. //
  162. // attrsonly
  163. //
  164. 0, (PWSTR)g_pszArg1StarAttrsOnly,
  165. 0, NULL,
  166. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  167. 0,
  168. 0, NULL,
  169. //
  170. // l, listoutput
  171. //
  172. 0, (PWSTR)g_pszArg1StarList,
  173. 0, NULL,
  174. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  175. 0,
  176. 0, NULL,
  177. ARG_TERMINATOR
  178. };
  179. ARG_RECORD DSQUERY_USER_COMMANDS[]=
  180. {
  181. //
  182. // scope
  183. //
  184. 0, (PWSTR)g_pszArg1UserScope,
  185. 0, NULL,
  186. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  187. 0,
  188. 0, NULL,
  189. //
  190. // Name
  191. //
  192. 0, (PWSTR)g_pszArg1UserName,
  193. 0, NULL,
  194. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  195. 0,
  196. 0, NULL,
  197. //
  198. // Desc
  199. //
  200. 0, (PWSTR)g_pszArg1UserDesc,
  201. 0, NULL,
  202. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  203. 0,
  204. 0, NULL,
  205. //
  206. // Upn
  207. //
  208. 0, (PWSTR)g_pszArg1UserUpn,
  209. 0, NULL,
  210. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  211. 0,
  212. 0, NULL,
  213. //
  214. // Samid
  215. //
  216. 0, (PWSTR)g_pszArg1UserSamid,
  217. 0, NULL,
  218. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  219. 0,
  220. 0, NULL,
  221. //
  222. // inactive
  223. //
  224. 0, (PWSTR)g_pszArg1UserInactive,
  225. 0, NULL,
  226. ARG_TYPE_INT, ARG_FLAG_OPTIONAL,
  227. 0,
  228. 0, NULL,
  229. //
  230. // stalepwd
  231. //
  232. 0, (PWSTR)g_pszArg1UserStalepwd,
  233. 0, NULL,
  234. ARG_TYPE_INT, ARG_FLAG_OPTIONAL,
  235. 0,
  236. 0, NULL,
  237. //
  238. // -disabled
  239. //
  240. 0, (PWSTR)g_pszArg1UserDisabled,
  241. 0, NULL,
  242. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  243. 0,
  244. 0, NULL,
  245. ARG_TERMINATOR
  246. };
  247. ARG_RECORD DSQUERY_COMPUTER_COMMANDS[]=
  248. {
  249. //
  250. // scope
  251. //
  252. 0, (PWSTR)g_pszArg1ComputerScope,
  253. 0, NULL,
  254. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  255. 0,
  256. 0, ValidateYesNo,
  257. //
  258. //name
  259. //
  260. 0, (PWSTR)g_pszArg1ComputerName,
  261. 0, NULL,
  262. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  263. NULL,
  264. 0, NULL,
  265. //
  266. //desc
  267. //
  268. 0, (PWSTR)g_pszArg1ComputerDesc,
  269. 0, NULL,
  270. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  271. NULL,
  272. 0, NULL,
  273. //
  274. //samid
  275. //
  276. 0, (PWSTR)g_pszArg1ComputerSamid,
  277. 0, NULL,
  278. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  279. NULL,
  280. 0, NULL,
  281. //
  282. //inactive
  283. //
  284. 0, (PWSTR)g_pszArg1ComputerInactive,
  285. 0, NULL,
  286. ARG_TYPE_INT, ARG_FLAG_OPTIONAL,
  287. NULL,
  288. 0, NULL,
  289. //
  290. // stalepwd
  291. //
  292. 0, (PWSTR)g_pszArg1ComputerStalepwd,
  293. 0, NULL,
  294. ARG_TYPE_INT, ARG_FLAG_OPTIONAL,
  295. 0,
  296. 0, NULL,
  297. //
  298. //disabled
  299. //
  300. 0, (PWSTR)g_pszArg1ComputerDisabled,
  301. 0, NULL,
  302. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  303. NULL,
  304. 0, NULL,
  305. ARG_TERMINATOR,
  306. };
  307. ARG_RECORD DSQUERY_GROUP_COMMANDS[]=
  308. {
  309. //
  310. // scope
  311. //
  312. 0, (PWSTR)g_pszArg1GroupScope,
  313. 0, NULL,
  314. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  315. 0,
  316. 0, ValidateYesNo,
  317. //
  318. //name
  319. //
  320. 0, (PWSTR)g_pszArg1GroupName,
  321. 0, NULL,
  322. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  323. NULL,
  324. 0, NULL,
  325. //
  326. //desc
  327. //
  328. 0, (PWSTR)g_pszArg1GroupDesc,
  329. 0, NULL,
  330. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  331. NULL,
  332. 0, NULL,
  333. //
  334. //samid
  335. //
  336. 0, (PWSTR)g_pszArg1GroupSamid,
  337. 0, NULL,
  338. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  339. NULL,
  340. 0, NULL,
  341. ARG_TERMINATOR,
  342. };
  343. ARG_RECORD DSQUERY_OU_COMMANDS[]=
  344. {
  345. //
  346. // scope
  347. //
  348. 0, (PWSTR)g_pszArg1OUScope,
  349. 0, NULL,
  350. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  351. 0,
  352. 0, ValidateYesNo,
  353. //
  354. //name
  355. //
  356. 0, (PWSTR)g_pszArg1OUName,
  357. 0, NULL,
  358. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  359. NULL,
  360. 0, NULL,
  361. //
  362. //desc
  363. //
  364. 0, (PWSTR)g_pszArg1OUDesc,
  365. 0, NULL,
  366. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  367. NULL,
  368. 0, NULL,
  369. ARG_TERMINATOR,
  370. };
  371. ARG_RECORD DSQUERY_CONTACT_COMMANDS[]=
  372. {
  373. //
  374. // scope
  375. //
  376. 0, (PWSTR)g_pszArg1UserScope,
  377. 0, NULL,
  378. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  379. 0,
  380. 0, NULL,
  381. //
  382. // Name
  383. //
  384. 0, (PWSTR)g_pszArg1UserName,
  385. 0, NULL,
  386. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  387. 0,
  388. 0, NULL,
  389. //
  390. // Desc
  391. //
  392. 0, (PWSTR)g_pszArg1UserDesc,
  393. 0, NULL,
  394. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  395. 0,
  396. 0, NULL,
  397. ARG_TERMINATOR,
  398. };
  399. ARG_RECORD DSQUERY_SERVER_COMMANDS[]=
  400. {
  401. //
  402. // forest - Forest
  403. //
  404. 0, (PWSTR)g_pszArg1ServerForest,
  405. 0, NULL,
  406. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  407. 0,
  408. 0, NULL,
  409. //
  410. // domain - Domain
  411. //
  412. 0, (PWSTR)c_sz_arg2_com_domain,
  413. 0, NULL,
  414. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  415. 0,
  416. 0, NULL,
  417. //
  418. // site - Site
  419. //
  420. 0, (PWSTR)g_pszArg1ServerSite,
  421. 0, NULL,
  422. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  423. 0,
  424. 0, NULL,
  425. //
  426. // name - Name
  427. //
  428. 0, (PWSTR)g_pszArg1ServerName,
  429. 0, NULL,
  430. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  431. NULL,
  432. 0, NULL,
  433. //
  434. //desc
  435. //
  436. 0, (PWSTR)g_pszArg1ServerDesc,
  437. 0, NULL,
  438. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  439. NULL,
  440. 0, NULL,
  441. //
  442. // hasfsmo
  443. //
  444. 0, (PWSTR)g_pszArg1ServerHasFSMO,
  445. 0, NULL,
  446. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  447. NULL,
  448. 0, NULL,
  449. //
  450. // isgc
  451. //
  452. 0, (PWSTR)g_pszArg1ServerIsGC,
  453. 0, NULL,
  454. ARG_TYPE_BOOL, ARG_FLAG_OPTIONAL,
  455. NULL,
  456. 0, NULL,
  457. ARG_TERMINATOR,
  458. };
  459. ARG_RECORD DSQUERY_SITE_COMMANDS[]=
  460. {
  461. //
  462. //name
  463. //
  464. 0, (PWSTR)g_pszArg1SiteName,
  465. 0, NULL,
  466. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  467. NULL,
  468. 0, NULL,
  469. //
  470. //desc
  471. //
  472. 0, (PWSTR)g_pszArg1SiteDesc,
  473. 0, NULL,
  474. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  475. NULL,
  476. 0, NULL,
  477. ARG_TERMINATOR,
  478. };
  479. ARG_RECORD DSQUERY_SUBNET_COMMANDS[]=
  480. {
  481. //
  482. //name
  483. //
  484. 0, (PWSTR)g_pszArg1SubnetName,
  485. 0, NULL,
  486. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  487. NULL,
  488. 0, NULL,
  489. //
  490. //desc
  491. //
  492. 0, (PWSTR)g_pszArg1SubnetDesc,
  493. 0, NULL,
  494. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  495. NULL,
  496. 0, NULL,
  497. //
  498. //Location
  499. //
  500. 0, (PWSTR)g_pszArg1SubnetLoc,
  501. 0, NULL,
  502. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  503. NULL,
  504. 0, NULL,
  505. //
  506. //site
  507. //
  508. 0, (PWSTR)g_pszArg1SubnetSite,
  509. 0, NULL,
  510. ARG_TYPE_STR, ARG_FLAG_OPTIONAL,
  511. NULL,
  512. 0, NULL,
  513. ARG_TERMINATOR,
  514. };
  515. //+-------------------------------------------------------------------------
  516. // Attributes
  517. //--------------------------------------------------------------------------
  518. //
  519. // filter, this is no ds attribute, but dummy attribute for commandline filter
  520. // specified in case of dsquery *
  521. //Star Filter
  522. DSQUERY_ATTR_TABLE_ENTRY StarFilterEntry =
  523. {
  524. L"filter",
  525. eStarFilter,
  526. NULL,
  527. StarFilterFunc,
  528. };
  529. //
  530. // name
  531. //
  532. DSATTRIBUTEDESCRIPTION name=
  533. {
  534. {
  535. L"cn",
  536. ADS_ATTR_UPDATE,
  537. ADSTYPE_CASE_IGNORE_STRING,
  538. NULL,
  539. 0
  540. },
  541. 0
  542. };
  543. //User Name
  544. DSQUERY_ATTR_TABLE_ENTRY UserNameEntry =
  545. {
  546. L"cn",
  547. eUserName,
  548. &name,
  549. CommonFilterFunc,
  550. };
  551. //Computer Name
  552. DSQUERY_ATTR_TABLE_ENTRY ComputerNameEntry =
  553. {
  554. L"cn",
  555. eComputerName,
  556. &name,
  557. CommonFilterFunc,
  558. };
  559. //Group Name
  560. DSQUERY_ATTR_TABLE_ENTRY GroupNameEntry =
  561. {
  562. L"cn",
  563. eGroupName,
  564. &name,
  565. CommonFilterFunc,
  566. };
  567. //OU Name
  568. DSQUERY_ATTR_TABLE_ENTRY OUNameEntry =
  569. {
  570. L"ou",
  571. eOUName,
  572. &name,
  573. CommonFilterFunc,
  574. };
  575. // Server Name
  576. DSQUERY_ATTR_TABLE_ENTRY ServerNameEntry =
  577. {
  578. L"cn",
  579. eServerName,
  580. &name,
  581. CommonFilterFunc,
  582. };
  583. // Site Name
  584. DSQUERY_ATTR_TABLE_ENTRY SiteNameEntry =
  585. {
  586. L"cn",
  587. eSiteName,
  588. &name,
  589. CommonFilterFunc,
  590. };
  591. // Contact Name
  592. DSQUERY_ATTR_TABLE_ENTRY ContactNameEntry =
  593. {
  594. L"cn",
  595. eContactName,
  596. &name,
  597. CommonFilterFunc,
  598. };
  599. // Subnet Name
  600. DSQUERY_ATTR_TABLE_ENTRY SubnetNameEntry =
  601. {
  602. L"cn",
  603. eSubnetName,
  604. &name,
  605. CommonFilterFunc,
  606. };
  607. //
  608. // Description
  609. //
  610. DSATTRIBUTEDESCRIPTION description =
  611. {
  612. {
  613. L"description",
  614. ADS_ATTR_UPDATE,
  615. ADSTYPE_CASE_IGNORE_STRING,
  616. NULL,
  617. 0
  618. },
  619. 0
  620. };
  621. //User Description
  622. DSQUERY_ATTR_TABLE_ENTRY UserDescEntry =
  623. {
  624. L"description",
  625. eUserDesc,
  626. &description,
  627. CommonFilterFunc,
  628. };
  629. //Computer Description
  630. DSQUERY_ATTR_TABLE_ENTRY ComputerDescEntry =
  631. {
  632. L"description",
  633. eComputerDesc,
  634. &description,
  635. CommonFilterFunc,
  636. };
  637. //Group Description
  638. DSQUERY_ATTR_TABLE_ENTRY GroupDescEntry =
  639. {
  640. L"description",
  641. eGroupDesc,
  642. &description,
  643. CommonFilterFunc,
  644. };
  645. //OU Description
  646. DSQUERY_ATTR_TABLE_ENTRY OUDescEntry =
  647. {
  648. L"description",
  649. eOUDesc,
  650. &description,
  651. CommonFilterFunc,
  652. };
  653. //Server Description
  654. DSQUERY_ATTR_TABLE_ENTRY ServerDescEntry =
  655. {
  656. L"description",
  657. eServerDesc,
  658. &description,
  659. CommonFilterFunc,
  660. };
  661. //Site Description
  662. DSQUERY_ATTR_TABLE_ENTRY SiteDescEntry =
  663. {
  664. L"description",
  665. eSiteDesc,
  666. &description,
  667. CommonFilterFunc,
  668. };
  669. //Cotnact Description
  670. DSQUERY_ATTR_TABLE_ENTRY ContactDescEntry =
  671. {
  672. L"description",
  673. eContactDesc,
  674. &description,
  675. CommonFilterFunc,
  676. };
  677. //Subnet Description
  678. DSQUERY_ATTR_TABLE_ENTRY SubnetDescEntry =
  679. {
  680. L"description",
  681. eSubnetDesc,
  682. &description,
  683. CommonFilterFunc,
  684. };
  685. //
  686. // UPN
  687. //
  688. DSATTRIBUTEDESCRIPTION upn =
  689. {
  690. {
  691. L"userPrincipalName",
  692. ADS_ATTR_UPDATE,
  693. ADSTYPE_CASE_IGNORE_STRING,
  694. NULL,
  695. 0
  696. },
  697. 0
  698. };
  699. //User Upn
  700. DSQUERY_ATTR_TABLE_ENTRY UserUPNEntry =
  701. {
  702. L"userPrincipalName",
  703. eUserUPN,
  704. &upn,
  705. CommonFilterFunc,
  706. };
  707. //
  708. // SAM Account Name
  709. //
  710. DSATTRIBUTEDESCRIPTION samAccountName =
  711. {
  712. {
  713. L"sAMAccountName",
  714. ADS_ATTR_UPDATE,
  715. ADSTYPE_CASE_IGNORE_STRING,
  716. NULL,
  717. 0
  718. },
  719. 0
  720. };
  721. //User SAM Account
  722. DSQUERY_ATTR_TABLE_ENTRY UserSamidEntry =
  723. {
  724. L"sAMAccountName",
  725. eUserSamid,
  726. &samAccountName,
  727. CommonFilterFunc,
  728. };
  729. //Computer samAccountName
  730. DSQUERY_ATTR_TABLE_ENTRY ComputerSamidEntry =
  731. {
  732. L"sAMAccountName",
  733. eComputerSamid,
  734. &samAccountName,
  735. CommonFilterFunc,
  736. };
  737. //Group samAccountName
  738. DSQUERY_ATTR_TABLE_ENTRY GroupSamidEntry =
  739. {
  740. L"sAMAccountName",
  741. eGroupSamid,
  742. &samAccountName,
  743. CommonFilterFunc,
  744. };
  745. //User Disabled
  746. DSQUERY_ATTR_TABLE_ENTRY UserDisabledEntry =
  747. {
  748. L"disabled",
  749. eUserDisabled,
  750. NULL,
  751. DisabledFilterFunc,
  752. };
  753. //Computer Disabled
  754. DSQUERY_ATTR_TABLE_ENTRY ComputerDisabledEntry =
  755. {
  756. L"disabled",
  757. eComputerDisabled,
  758. NULL,
  759. DisabledFilterFunc,
  760. };
  761. //User Inactive
  762. DSQUERY_ATTR_TABLE_ENTRY UserInactiveEntry =
  763. {
  764. L"inactive",
  765. eUserInactive,
  766. NULL,
  767. InactiveFilterFunc,
  768. };
  769. //Computer Inactive
  770. DSQUERY_ATTR_TABLE_ENTRY ComputerInactiveEntry =
  771. {
  772. L"inactive",
  773. eComputerInactive,
  774. NULL,
  775. InactiveFilterFunc,
  776. };
  777. //User stalepwd
  778. DSQUERY_ATTR_TABLE_ENTRY UserStalepwdEntry =
  779. {
  780. L"stalepwd",
  781. eUserStalepwd,
  782. NULL,
  783. StalepwdFilterFunc,
  784. };
  785. //Computer stalepwd
  786. DSQUERY_ATTR_TABLE_ENTRY ComputerStalepwdEntry =
  787. {
  788. L"stalepwd",
  789. eComputerStalepwd,
  790. NULL,
  791. StalepwdFilterFunc,
  792. };
  793. //
  794. // Locations
  795. //
  796. DSATTRIBUTEDESCRIPTION location =
  797. {
  798. {
  799. L"location",
  800. ADS_ATTR_UPDATE,
  801. ADSTYPE_CASE_IGNORE_STRING,
  802. NULL,
  803. 0
  804. },
  805. 0
  806. };
  807. //Subnet location
  808. DSQUERY_ATTR_TABLE_ENTRY SubnetLocEntry=
  809. {
  810. L"location",
  811. eSubnetLoc,
  812. &location,
  813. CommonFilterFunc,
  814. };
  815. //
  816. // SiteObject
  817. //
  818. DSATTRIBUTEDESCRIPTION siteObject=
  819. {
  820. {
  821. L"siteObject",
  822. ADS_ATTR_UPDATE,
  823. ADSTYPE_CASE_IGNORE_STRING,
  824. NULL,
  825. 0
  826. },
  827. 0
  828. };
  829. //Subnet Site
  830. DSQUERY_ATTR_TABLE_ENTRY SubnetSiteEntry=
  831. {
  832. L"siteObject",
  833. eSubnetSite,
  834. &siteObject,
  835. SubnetSiteFilterFunc,
  836. };
  837. //
  838. //Valid OutputStrings for each objecttype
  839. //
  840. //
  841. DSQUERY_OUTPUT_FORMAT_MAP g_format_dn =
  842. {
  843. g_pszDN,
  844. DSQUERY_OUTPUT_DN
  845. };
  846. DSQUERY_OUTPUT_FORMAT_MAP g_format_rdn =
  847. {
  848. g_pszRDN,
  849. DSQUERY_OUTPUT_RDN
  850. };
  851. DSQUERY_OUTPUT_FORMAT_MAP g_format_upn =
  852. {
  853. g_pszUPN,
  854. DSQUERY_OUTPUT_UPN
  855. };
  856. DSQUERY_OUTPUT_FORMAT_MAP g_format_samid =
  857. {
  858. g_pszSamId,
  859. DSQUERY_OUTPUT_SAMID
  860. };
  861. DSQUERY_OUTPUT_FORMAT_MAP g_format_ntlmid =
  862. {
  863. g_pszNtlmId,
  864. DSQUERY_OUTPUT_NTLMID
  865. };
  866. PDSQUERY_OUTPUT_FORMAT_MAP UserOutputFormatMap[] =
  867. {
  868. &g_format_dn,
  869. &g_format_rdn,
  870. &g_format_upn,
  871. &g_format_samid,
  872. &g_format_ntlmid
  873. };
  874. //Computer
  875. PDSQUERY_OUTPUT_FORMAT_MAP ComputerOutputFormatMap[] =
  876. {
  877. &g_format_dn,
  878. &g_format_rdn,
  879. &g_format_samid,
  880. &g_format_ntlmid
  881. };
  882. //Group
  883. PDSQUERY_OUTPUT_FORMAT_MAP GroupOutputFormatMap[] =
  884. {
  885. &g_format_dn,
  886. &g_format_rdn,
  887. &g_format_samid,
  888. &g_format_ntlmid
  889. };
  890. //OU
  891. PDSQUERY_OUTPUT_FORMAT_MAP OuOutputFormatMap[] =
  892. {
  893. &g_format_dn,
  894. &g_format_rdn
  895. };
  896. //Contact
  897. PDSQUERY_OUTPUT_FORMAT_MAP ContactOutputFormatMap[] =
  898. {
  899. &g_format_dn,
  900. &g_format_rdn
  901. };
  902. //Server
  903. PDSQUERY_OUTPUT_FORMAT_MAP ServerOutputFormatMap[] =
  904. {
  905. &g_format_dn,
  906. &g_format_rdn
  907. };
  908. //Site
  909. PDSQUERY_OUTPUT_FORMAT_MAP SiteOutputFormatMap[] =
  910. {
  911. &g_format_dn,
  912. &g_format_rdn
  913. };
  914. //Subnet
  915. PDSQUERY_OUTPUT_FORMAT_MAP SubnetOutputFormatMap[] =
  916. {
  917. &g_format_dn,
  918. &g_format_rdn
  919. };
  920. //Attribute Table entries and ObjectTableEntries
  921. //
  922. //
  923. //* Star
  924. //
  925. PDSQUERY_ATTR_TABLE_ENTRY StarAttributeTable[] =
  926. {
  927. &StarFilterEntry,
  928. };
  929. DSQueryObjectTableEntry g_StarObjectEntry =
  930. {
  931. L"*",
  932. g_pszStar,
  933. DSQUERY_STAR_COMMANDS,
  934. USAGE_DSQUERY_STAR,
  935. sizeof(StarAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  936. StarAttributeTable,
  937. 0,
  938. NULL,
  939. eStarScope,
  940. g_pszDefStarFilter,
  941. NULL
  942. };
  943. //
  944. // User
  945. //
  946. PDSQUERY_ATTR_TABLE_ENTRY UserAttributeTable[] =
  947. {
  948. &UserNameEntry,
  949. &UserUPNEntry,
  950. &UserDescEntry,
  951. &UserSamidEntry,
  952. &UserDisabledEntry,
  953. &UserInactiveEntry,
  954. &UserStalepwdEntry
  955. };
  956. DSQueryObjectTableEntry g_UserObjectEntry =
  957. {
  958. L"user",
  959. g_pszUser,
  960. DSQUERY_USER_COMMANDS,
  961. USAGE_DSQUERY_USER,
  962. sizeof(UserAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  963. UserAttributeTable,
  964. sizeof(UserOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  965. UserOutputFormatMap,
  966. eUserScope,
  967. g_pszDefUserFilter,
  968. g_pszDefUserFilter
  969. };
  970. //
  971. // Computer
  972. //
  973. PDSQUERY_ATTR_TABLE_ENTRY ComputerAttributeTable[] =
  974. {
  975. &ComputerNameEntry,
  976. &ComputerDescEntry,
  977. &ComputerSamidEntry,
  978. &ComputerDisabledEntry,
  979. &ComputerInactiveEntry,
  980. &ComputerStalepwdEntry
  981. };
  982. DSQueryObjectTableEntry g_ComputerObjectEntry =
  983. {
  984. L"computer",
  985. g_pszComputer,
  986. DSQUERY_COMPUTER_COMMANDS,
  987. USAGE_DSQUERY_COMPUTER,
  988. sizeof(ComputerAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  989. ComputerAttributeTable,
  990. sizeof(ComputerOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  991. ComputerOutputFormatMap,
  992. eComputerScope,
  993. g_pszDefComputerFilter,
  994. g_pszDefComputerFilter
  995. };
  996. //
  997. // Group
  998. //
  999. PDSQUERY_ATTR_TABLE_ENTRY GroupAttributeTable[] =
  1000. {
  1001. &GroupNameEntry,
  1002. &GroupDescEntry,
  1003. &GroupSamidEntry
  1004. };
  1005. DSQueryObjectTableEntry g_GroupObjectEntry =
  1006. {
  1007. L"group",
  1008. g_pszGroup,
  1009. DSQUERY_GROUP_COMMANDS,
  1010. USAGE_DSQUERY_GROUP,
  1011. sizeof(GroupAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1012. GroupAttributeTable,
  1013. sizeof(GroupOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1014. GroupOutputFormatMap,
  1015. eGroupScope,
  1016. g_pszDefGroupFilter,
  1017. g_pszDefGroupFilter
  1018. };
  1019. //
  1020. // OU
  1021. //
  1022. PDSQUERY_ATTR_TABLE_ENTRY OUAttributeTable[] =
  1023. {
  1024. &OUNameEntry,
  1025. &OUDescEntry
  1026. };
  1027. DSQueryObjectTableEntry g_OUObjectEntry =
  1028. {
  1029. L"ou",
  1030. g_pszOU,
  1031. DSQUERY_OU_COMMANDS,
  1032. USAGE_DSQUERY_OU,
  1033. sizeof(OUAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1034. OUAttributeTable,
  1035. sizeof(OuOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1036. OuOutputFormatMap,
  1037. eOUScope,
  1038. g_pszDefOUFilter,
  1039. g_pszDefOUFilter
  1040. };
  1041. //
  1042. // Server
  1043. //
  1044. PDSQUERY_ATTR_TABLE_ENTRY ServerAttributeTable[] =
  1045. {
  1046. &ServerNameEntry,
  1047. &ServerDescEntry
  1048. };
  1049. DSQueryObjectTableEntry g_ServerObjectEntry =
  1050. {
  1051. L"server",
  1052. g_pszServer,
  1053. DSQUERY_SERVER_COMMANDS,
  1054. USAGE_DSQUERY_SERVER,
  1055. sizeof(ServerAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1056. ServerAttributeTable,
  1057. sizeof(ServerOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1058. ServerOutputFormatMap,
  1059. static_cast<UINT>(-1),
  1060. g_pszDefServerFilter,
  1061. g_pszDefServerFilter
  1062. };
  1063. //
  1064. // Site
  1065. //
  1066. PDSQUERY_ATTR_TABLE_ENTRY SiteAttributeTable[] =
  1067. {
  1068. &SiteNameEntry,
  1069. &SiteDescEntry
  1070. };
  1071. DSQueryObjectTableEntry g_SiteObjectEntry =
  1072. {
  1073. L"site",
  1074. g_pszSite,
  1075. DSQUERY_SITE_COMMANDS,
  1076. USAGE_DSQUERY_SITE,
  1077. sizeof(SiteAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1078. SiteAttributeTable,
  1079. sizeof(SiteOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1080. SiteOutputFormatMap,
  1081. static_cast<UINT>(-1),
  1082. g_pszDefSiteFilter,
  1083. g_pszDefSiteFilter
  1084. };
  1085. //
  1086. // Contact
  1087. //
  1088. PDSQUERY_ATTR_TABLE_ENTRY ContactAttributeTable[] =
  1089. {
  1090. &ContactNameEntry,
  1091. &ContactDescEntry,
  1092. };
  1093. DSQueryObjectTableEntry g_ContactObjectEntry =
  1094. {
  1095. L"contact",
  1096. g_pszContact,
  1097. DSQUERY_CONTACT_COMMANDS,
  1098. USAGE_DSQUERY_USER,
  1099. sizeof(ContactAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1100. ContactAttributeTable,
  1101. sizeof(ContactOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1102. ContactOutputFormatMap,
  1103. eContactScope,
  1104. g_pszDefContactFilter,
  1105. g_pszDefContactFilter
  1106. };
  1107. //
  1108. // Subnet
  1109. //
  1110. PDSQUERY_ATTR_TABLE_ENTRY SubnetAttributeTable[] =
  1111. {
  1112. &SubnetNameEntry,
  1113. &SubnetDescEntry,
  1114. &SubnetLocEntry,
  1115. &SubnetSiteEntry,
  1116. };
  1117. DSQueryObjectTableEntry g_SubnetObjectEntry =
  1118. {
  1119. L"subnet",
  1120. g_pszSubnet,
  1121. DSQUERY_SUBNET_COMMANDS,
  1122. USAGE_DSQUERY_SUBNET,
  1123. sizeof(SubnetAttributeTable)/sizeof(PDSATTRIBUTETABLEENTRY),
  1124. SubnetAttributeTable,
  1125. sizeof(SubnetOutputFormatMap)/sizeof(PDSQUERY_OUTPUT_FORMAT_MAP),
  1126. SubnetOutputFormatMap,
  1127. static_cast<UINT>(-1),
  1128. g_pszDefSubnetFilter,
  1129. g_pszDefSubnetFilter
  1130. };
  1131. //+-------------------------------------------------------------------------
  1132. // Object Table
  1133. //--------------------------------------------------------------------------
  1134. PDSQueryObjectTableEntry g_DSObjectTable[] =
  1135. {
  1136. &g_StarObjectEntry,
  1137. &g_OUObjectEntry,
  1138. &g_UserObjectEntry,
  1139. &g_ComputerObjectEntry,
  1140. &g_GroupObjectEntry,
  1141. &g_ServerObjectEntry,
  1142. &g_SiteObjectEntry,
  1143. &g_ContactObjectEntry,
  1144. &g_SubnetObjectEntry,
  1145. NULL
  1146. };