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.

1184 lines
41 KiB

  1. VERSION 5.00
  2. Begin VB.Form Form1
  3. Caption = "WMI Privilege Test Client"
  4. ClientHeight = 9585
  5. ClientLeft = 165
  6. ClientTop = 735
  7. ClientWidth = 12540
  8. BeginProperty Font
  9. Name = "Comic Sans MS"
  10. Size = 8.25
  11. Charset = 0
  12. Weight = 400
  13. Underline = 0 'False
  14. Italic = 0 'False
  15. Strikethrough = 0 'False
  16. EndProperty
  17. Icon = "Form1.frx":0000
  18. LinkTopic = "Form1"
  19. ScaleHeight = 9585
  20. ScaleWidth = 12540
  21. StartUpPosition = 3 'Windows Default
  22. Begin VB.ListBox PrivilegeSetting
  23. BackColor = &H00FFFFFF&
  24. ForeColor = &H00000000&
  25. Height = 735
  26. Index = 6
  27. ItemData = "Form1.frx":0442
  28. Left = 2040
  29. List = "Form1.frx":0444
  30. TabIndex = 39
  31. ToolTipText = "Required to act as part of the operating system"
  32. Top = 5400
  33. Width = 1575
  34. End
  35. Begin VB.ListBox PrivilegeSetting
  36. BackColor = &H00FFFFFF&
  37. ForeColor = &H00000000&
  38. Height = 735
  39. Index = 14
  40. ItemData = "Form1.frx":0446
  41. Left = 6000
  42. List = "Form1.frx":0448
  43. TabIndex = 38
  44. ToolTipText = "Required to create a paging file"
  45. Top = 5365
  46. Width = 1575
  47. End
  48. Begin VB.CommandButton Command1
  49. BackColor = &H00C0C0C0&
  50. Caption = "Execute"
  51. BeginProperty Font
  52. Name = "Comic Sans MS"
  53. Size = 14.25
  54. Charset = 0
  55. Weight = 700
  56. Underline = 0 'False
  57. Italic = 0 'False
  58. Strikethrough = 0 'False
  59. EndProperty
  60. Height = 735
  61. Left = 4800
  62. MaskColor = &H0000FFFF&
  63. Style = 1 'Graphical
  64. TabIndex = 37
  65. Top = 8520
  66. Width = 2775
  67. End
  68. Begin VB.ListBox PrivilegeSetting
  69. BackColor = &H00FFFFFF&
  70. ForeColor = &H00000000&
  71. Height = 735
  72. Index = 23
  73. ItemData = "Form1.frx":044A
  74. Left = 10080
  75. List = "Form1.frx":044C
  76. TabIndex = 20
  77. ToolTipText = "Required to shutdown a local system"
  78. Top = 6360
  79. Width = 1575
  80. End
  81. Begin VB.ListBox PrivilegeSetting
  82. BackColor = &H00FFFFFF&
  83. ForeColor = &H00000000&
  84. Height = 735
  85. Index = 22
  86. ItemData = "Form1.frx":044E
  87. Left = 10080
  88. List = "Form1.frx":0450
  89. TabIndex = 19
  90. ToolTipText = "Required to receive notifications of file or directory changes"
  91. Top = 5400
  92. Width = 1575
  93. End
  94. Begin VB.ListBox PrivilegeSetting
  95. BackColor = &H00FFFFFF&
  96. ForeColor = &H00000000&
  97. Height = 735
  98. Index = 21
  99. ItemData = "Form1.frx":0452
  100. Left = 10080
  101. List = "Form1.frx":0454
  102. TabIndex = 18
  103. ToolTipText = "Required to modify system environment settings"
  104. Top = 4400
  105. Width = 1575
  106. End
  107. Begin VB.ListBox PrivilegeSetting
  108. BackColor = &H00FFFFFF&
  109. ForeColor = &H00000000&
  110. Height = 735
  111. Index = 20
  112. ItemData = "Form1.frx":0456
  113. Left = 10080
  114. List = "Form1.frx":0458
  115. TabIndex = 17
  116. ToolTipText = "Required to generate audit log entries"
  117. Top = 3420
  118. Width = 1575
  119. End
  120. Begin VB.ListBox PrivilegeSetting
  121. BackColor = &H00FFFFFF&
  122. ForeColor = &H00000000&
  123. Height = 735
  124. Index = 19
  125. ItemData = "Form1.frx":045A
  126. Left = 10080
  127. List = "Form1.frx":045C
  128. TabIndex = 16
  129. ToolTipText = "Requred to debug a process"
  130. Top = 2440
  131. Width = 1575
  132. End
  133. Begin VB.ListBox PrivilegeSetting
  134. BackColor = &H00FFFFFF&
  135. ForeColor = &H00000000&
  136. Height = 735
  137. Index = 18
  138. ItemData = "Form1.frx":045E
  139. Left = 10080
  140. List = "Form1.frx":0460
  141. TabIndex = 15
  142. ToolTipText = "Required to shutdown a local system"
  143. Top = 1460
  144. Width = 1575
  145. End
  146. Begin VB.ListBox PrivilegeSetting
  147. BackColor = &H00FFFFFF&
  148. ForeColor = &H00000000&
  149. Height = 735
  150. Index = 17
  151. ItemData = "Form1.frx":0462
  152. Left = 10080
  153. List = "Form1.frx":0464
  154. TabIndex = 14
  155. ToolTipText = "Required to perform restore operations"
  156. Top = 480
  157. Width = 1575
  158. End
  159. Begin VB.ListBox PrivilegeSetting
  160. BackColor = &H00FFFFFF&
  161. ForeColor = &H00000000&
  162. Height = 735
  163. Index = 16
  164. ItemData = "Form1.frx":0466
  165. Left = 6000
  166. List = "Form1.frx":0468
  167. TabIndex = 13
  168. Top = 7320
  169. Width = 1575
  170. End
  171. Begin VB.ListBox PrivilegeSetting
  172. BackColor = &H00FFFFFF&
  173. ForeColor = &H00000000&
  174. Height = 735
  175. Index = 15
  176. ItemData = "Form1.frx":046A
  177. Left = 6000
  178. List = "Form1.frx":046C
  179. TabIndex = 12
  180. ToolTipText = "Required to create a permanent object"
  181. Top = 6360
  182. Width = 1575
  183. End
  184. Begin VB.ListBox PrivilegeSetting
  185. BackColor = &H00FFFFFF&
  186. ForeColor = &H00000000&
  187. Height = 735
  188. Index = 13
  189. ItemData = "Form1.frx":046E
  190. Left = 6000
  191. List = "Form1.frx":0470
  192. TabIndex = 11
  193. ToolTipText = "Required to increase the base priority of a process"
  194. Top = 4388
  195. Width = 1575
  196. End
  197. Begin VB.ListBox PrivilegeSetting
  198. BackColor = &H00FFFFFF&
  199. ForeColor = &H00000000&
  200. Height = 735
  201. Index = 12
  202. ItemData = "Form1.frx":0472
  203. Left = 6000
  204. List = "Form1.frx":0474
  205. TabIndex = 10
  206. ToolTipText = "Required to gather profiing information for a process"
  207. Top = 3411
  208. Width = 1575
  209. End
  210. Begin VB.ListBox PrivilegeSetting
  211. BackColor = &H00FFFFFF&
  212. ForeColor = &H00000000&
  213. Height = 735
  214. Index = 11
  215. ItemData = "Form1.frx":0476
  216. Left = 6000
  217. List = "Form1.frx":0478
  218. TabIndex = 9
  219. ToolTipText = "Required to modify the system time"
  220. Top = 2434
  221. Width = 1575
  222. End
  223. Begin VB.ListBox PrivilegeSetting
  224. BackColor = &H00FFFFFF&
  225. ForeColor = &H00000000&
  226. Height = 735
  227. Index = 10
  228. ItemData = "Form1.frx":047A
  229. Left = 6000
  230. List = "Form1.frx":047C
  231. TabIndex = 8
  232. ToolTipText = "Required to gather profiling information for the system"
  233. Top = 1455
  234. Width = 1575
  235. End
  236. Begin VB.ListBox PrivilegeSetting
  237. BackColor = &H00FFFFFF&
  238. ForeColor = &H00000000&
  239. Height = 735
  240. Index = 9
  241. ItemData = "Form1.frx":047E
  242. Left = 6000
  243. List = "Form1.frx":0480
  244. TabIndex = 7
  245. ToolTipText = "Required to load or unload a device driver"
  246. Top = 480
  247. Width = 1575
  248. End
  249. Begin VB.ListBox PrivilegeSetting
  250. BackColor = &H00FFFFFF&
  251. ForeColor = &H00000000&
  252. Height = 735
  253. Index = 8
  254. ItemData = "Form1.frx":0482
  255. Left = 2040
  256. List = "Form1.frx":0484
  257. TabIndex = 6
  258. ToolTipText = "Required to modify ownership of an object without being granted discretionary access"
  259. Top = 7320
  260. Width = 1575
  261. End
  262. Begin VB.ListBox PrivilegeSetting
  263. BackColor = &H00FFFFFF&
  264. ForeColor = &H00000000&
  265. Height = 735
  266. Index = 7
  267. ItemData = "Form1.frx":0486
  268. Left = 2040
  269. List = "Form1.frx":0488
  270. TabIndex = 5
  271. ToolTipText = "Required to perform some security-related functions"
  272. Top = 6360
  273. Width = 1575
  274. End
  275. Begin VB.ListBox PrivilegeSetting
  276. BackColor = &H00FFFFFF&
  277. ForeColor = &H00000000&
  278. Height = 735
  279. Index = 5
  280. ItemData = "Form1.frx":048A
  281. Left = 2040
  282. List = "Form1.frx":048C
  283. TabIndex = 4
  284. Top = 4380
  285. Width = 1575
  286. End
  287. Begin VB.ListBox PrivilegeSetting
  288. BackColor = &H00FFFFFF&
  289. ForeColor = &H00000000&
  290. Height = 735
  291. Index = 4
  292. ItemData = "Form1.frx":048E
  293. Left = 2040
  294. List = "Form1.frx":0490
  295. TabIndex = 3
  296. Top = 3400
  297. Width = 1575
  298. End
  299. Begin VB.ListBox PrivilegeSetting
  300. BackColor = &H00FFFFFF&
  301. ForeColor = &H00000000&
  302. Height = 735
  303. Index = 3
  304. ItemData = "Form1.frx":0492
  305. Left = 2040
  306. List = "Form1.frx":0494
  307. TabIndex = 2
  308. Top = 2415
  309. Width = 1575
  310. End
  311. Begin VB.ListBox PrivilegeSetting
  312. BackColor = &H00FFFFFF&
  313. ForeColor = &H00000000&
  314. Height = 735
  315. Index = 2
  316. ItemData = "Form1.frx":0496
  317. Left = 2040
  318. List = "Form1.frx":0498
  319. TabIndex = 1
  320. Top = 1440
  321. Width = 1575
  322. End
  323. Begin VB.Frame Frame1
  324. Caption = "Privileges"
  325. BeginProperty Font
  326. Name = "Comic Sans MS"
  327. Size = 8.25
  328. Charset = 0
  329. Weight = 700
  330. Underline = 0 'False
  331. Italic = 0 'False
  332. Strikethrough = 0 'False
  333. EndProperty
  334. Height = 8055
  335. Left = 240
  336. TabIndex = 0
  337. Top = 240
  338. Width = 12015
  339. Begin VB.ListBox PrivilegeSetting
  340. BackColor = &H00FFFFFF&
  341. ForeColor = &H00000000&
  342. Height = 735
  343. Index = 1
  344. ItemData = "Form1.frx":049A
  345. Left = 1800
  346. List = "Form1.frx":049C
  347. TabIndex = 26
  348. Top = 240
  349. Width = 1575
  350. End
  351. Begin VB.Label Label9
  352. Caption = "Load Driver"
  353. BeginProperty Font
  354. Name = "Comic Sans MS"
  355. Size = 9.75
  356. Charset = 0
  357. Weight = 700
  358. Underline = 0 'False
  359. Italic = 0 'False
  360. Strikethrough = 0 'False
  361. EndProperty
  362. ForeColor = &H00000080&
  363. Height = 495
  364. Left = 4080
  365. TabIndex = 47
  366. ToolTipText = "Required to load and unload device drivers"
  367. Top = 360
  368. Width = 1215
  369. End
  370. Begin VB.Label Label17
  371. Caption = "Restore"
  372. BeginProperty Font
  373. Name = "Comic Sans MS"
  374. Size = 9.75
  375. Charset = 0
  376. Weight = 700
  377. Underline = 0 'False
  378. Italic = 0 'False
  379. Strikethrough = 0 'False
  380. EndProperty
  381. ForeColor = &H00000080&
  382. Height = 255
  383. Left = 8280
  384. TabIndex = 46
  385. ToolTipText = "Required to perform restore operations"
  386. Top = 480
  387. Width = 1455
  388. End
  389. Begin VB.Label Label18
  390. Caption = "Shutdown"
  391. BeginProperty Font
  392. Name = "Comic Sans MS"
  393. Size = 9.75
  394. Charset = 0
  395. Weight = 700
  396. Underline = 0 'False
  397. Italic = 0 'False
  398. Strikethrough = 0 'False
  399. EndProperty
  400. ForeColor = &H00000080&
  401. Height = 255
  402. Left = 8280
  403. TabIndex = 45
  404. ToolTipText = "Required to shut down the local system"
  405. Top = 1440
  406. Width = 1455
  407. End
  408. Begin VB.Label Label19
  409. Caption = "Debug"
  410. BeginProperty Font
  411. Name = "Comic Sans MS"
  412. Size = 9.75
  413. Charset = 0
  414. Weight = 700
  415. Underline = 0 'False
  416. Italic = 0 'False
  417. Strikethrough = 0 'False
  418. EndProperty
  419. ForeColor = &H00000080&
  420. Height = 375
  421. Left = 8280
  422. TabIndex = 44
  423. ToolTipText = "Required to debug a process"
  424. Top = 2280
  425. Width = 1335
  426. End
  427. Begin VB.Label Label20
  428. Caption = "Audit"
  429. BeginProperty Font
  430. Name = "Comic Sans MS"
  431. Size = 9.75
  432. Charset = 0
  433. Weight = 700
  434. Underline = 0 'False
  435. Italic = 0 'False
  436. Strikethrough = 0 'False
  437. EndProperty
  438. ForeColor = &H00000080&
  439. Height = 255
  440. Left = 8280
  441. TabIndex = 43
  442. ToolTipText = "Required to generate audit log entries"
  443. Top = 3480
  444. Width = 1455
  445. End
  446. Begin VB.Label Label21
  447. Caption = "System Environment"
  448. BeginProperty Font
  449. Name = "Comic Sans MS"
  450. Size = 9.75
  451. Charset = 0
  452. Weight = 700
  453. Underline = 0 'False
  454. Italic = 0 'False
  455. Strikethrough = 0 'False
  456. EndProperty
  457. ForeColor = &H00000080&
  458. Height = 615
  459. Left = 8280
  460. TabIndex = 42
  461. ToolTipText = "Required to change system environment settings"
  462. Top = 4200
  463. Width = 1575
  464. End
  465. Begin VB.Label Label22
  466. Caption = "Change Notify"
  467. BeginProperty Font
  468. Name = "Comic Sans MS"
  469. Size = 9.75
  470. Charset = 0
  471. Weight = 700
  472. Underline = 0 'False
  473. Italic = 0 'False
  474. Strikethrough = 0 'False
  475. EndProperty
  476. ForeColor = &H00000080&
  477. Height = 375
  478. Left = 8280
  479. TabIndex = 41
  480. ToolTipText = "Required to receive notifications when a file or directory changes"
  481. Top = 5280
  482. Width = 1575
  483. End
  484. Begin VB.Label Label23
  485. Caption = "Remote Shutdown"
  486. BeginProperty Font
  487. Name = "Comic Sans MS"
  488. Size = 9.75
  489. Charset = 0
  490. Weight = 700
  491. Underline = 0 'False
  492. Italic = 0 'False
  493. Strikethrough = 0 'False
  494. EndProperty
  495. ForeColor = &H00000080&
  496. Height = 615
  497. Left = 8280
  498. TabIndex = 40
  499. ToolTipText = "Required to shutdown a remote system"
  500. Top = 6120
  501. Width = 1455
  502. End
  503. Begin VB.Label Label16
  504. Caption = "Backup"
  505. BeginProperty Font
  506. Name = "Comic Sans MS"
  507. Size = 9.75
  508. Charset = 0
  509. Weight = 700
  510. Underline = 0 'False
  511. Italic = 0 'False
  512. Strikethrough = 0 'False
  513. EndProperty
  514. ForeColor = &H00000080&
  515. Height = 375
  516. Left = 4080
  517. TabIndex = 36
  518. ToolTipText = "Required to perform backup operations"
  519. Top = 7200
  520. Width = 975
  521. End
  522. Begin VB.Label Label15
  523. Caption = "Create Permanent"
  524. BeginProperty Font
  525. Name = "Comic Sans MS"
  526. Size = 9.75
  527. Charset = 0
  528. Weight = 700
  529. Underline = 0 'False
  530. Italic = 0 'False
  531. Strikethrough = 0 'False
  532. EndProperty
  533. ForeColor = &H00000080&
  534. Height = 615
  535. Left = 4080
  536. TabIndex = 35
  537. ToolTipText = "Required to create a permanent object"
  538. Top = 6120
  539. Width = 1335
  540. End
  541. Begin VB.Label Label14
  542. Caption = "Create Pagefile"
  543. BeginProperty Font
  544. Name = "Comic Sans MS"
  545. Size = 9.75
  546. Charset = 0
  547. Weight = 700
  548. Underline = 0 'False
  549. Italic = 0 'False
  550. Strikethrough = 0 'False
  551. EndProperty
  552. ForeColor = &H00000080&
  553. Height = 495
  554. Left = 4080
  555. TabIndex = 34
  556. ToolTipText = "Required to create a paging file"
  557. Top = 5280
  558. Width = 1455
  559. End
  560. Begin VB.Label Label13
  561. Caption = "Increase Base Priority"
  562. BeginProperty Font
  563. Name = "Comic Sans MS"
  564. Size = 9.75
  565. Charset = 0
  566. Weight = 700
  567. Underline = 0 'False
  568. Italic = 0 'False
  569. Strikethrough = 0 'False
  570. EndProperty
  571. ForeColor = &H00000080&
  572. Height = 615
  573. Left = 4080
  574. TabIndex = 33
  575. ToolTipText = "Required to increase the base priority of a process"
  576. Top = 4200
  577. Width = 1575
  578. End
  579. Begin VB.Label Label12
  580. Caption = "Profile Single Process"
  581. BeginProperty Font
  582. Name = "Comic Sans MS"
  583. Size = 9.75
  584. Charset = 0
  585. Weight = 700
  586. Underline = 0 'False
  587. Italic = 0 'False
  588. Strikethrough = 0 'False
  589. EndProperty
  590. ForeColor = &H00000080&
  591. Height = 615
  592. Left = 4080
  593. TabIndex = 32
  594. ToolTipText = "Required to profile a single process"
  595. Top = 3240
  596. Width = 1575
  597. End
  598. Begin VB.Label Label11
  599. Caption = "System Time"
  600. BeginProperty Font
  601. Name = "Comic Sans MS"
  602. Size = 9.75
  603. Charset = 0
  604. Weight = 700
  605. Underline = 0 'False
  606. Italic = 0 'False
  607. Strikethrough = 0 'False
  608. EndProperty
  609. ForeColor = &H00000080&
  610. Height = 495
  611. Left = 4080
  612. TabIndex = 31
  613. ToolTipText = "Required to modify the system time"
  614. Top = 2280
  615. Width = 1215
  616. End
  617. Begin VB.Label Label10
  618. Caption = "System Profile"
  619. BeginProperty Font
  620. Name = "Comic Sans MS"
  621. Size = 9.75
  622. Charset = 0
  623. Weight = 700
  624. Underline = 0 'False
  625. Italic = 0 'False
  626. Strikethrough = 0 'False
  627. EndProperty
  628. ForeColor = &H00000080&
  629. Height = 615
  630. Left = 4080
  631. TabIndex = 30
  632. ToolTipText = "Required to profile the system"
  633. Top = 1200
  634. Width = 1215
  635. End
  636. Begin VB.Label Label8
  637. Caption = "Take Ownership"
  638. BeginProperty Font
  639. Name = "Comic Sans MS"
  640. Size = 9.75
  641. Charset = 0
  642. Weight = 700
  643. Underline = 0 'False
  644. Italic = 0 'False
  645. Strikethrough = 0 'False
  646. EndProperty
  647. ForeColor = &H00000080&
  648. Height = 615
  649. Left = 360
  650. TabIndex = 29
  651. ToolTipText = "Required to take ownership of an object without being granted discretionary access rights"
  652. Top = 7080
  653. Width = 1335
  654. End
  655. Begin VB.Label Label7
  656. Caption = "Security"
  657. BeginProperty Font
  658. Name = "Comic Sans MS"
  659. Size = 9.75
  660. Charset = 0
  661. Weight = 700
  662. Underline = 0 'False
  663. Italic = 0 'False
  664. Strikethrough = 0 'False
  665. EndProperty
  666. ForeColor = &H00000080&
  667. Height = 255
  668. Left = 360
  669. TabIndex = 28
  670. ToolTipText = "Required to perform some security operations"
  671. Top = 6240
  672. Width = 1335
  673. End
  674. Begin VB.Label Label1
  675. Caption = "Create Token"
  676. BeginProperty Font
  677. Name = "Comic Sans MS"
  678. Size = 9.75
  679. Charset = 0
  680. Weight = 700
  681. Underline = 0 'False
  682. Italic = 0 'False
  683. Strikethrough = 0 'False
  684. EndProperty
  685. ForeColor = &H00000080&
  686. Height = 615
  687. Index = 0
  688. Left = 360
  689. TabIndex = 27
  690. ToolTipText = "Required to create a primary token"
  691. Top = 360
  692. Width = 1095
  693. End
  694. Begin VB.Label Label6
  695. Caption = "Tcb"
  696. BeginProperty Font
  697. Name = "Comic Sans MS"
  698. Size = 9.75
  699. Charset = 0
  700. Weight = 700
  701. Underline = 0 'False
  702. Italic = 0 'False
  703. Strikethrough = 0 'False
  704. EndProperty
  705. ForeColor = &H00000080&
  706. Height = 255
  707. Left = 360
  708. TabIndex = 25
  709. ToolTipText = "Required to act as part of the operating system"
  710. Top = 5400
  711. Width = 1335
  712. End
  713. Begin VB.Label Label5
  714. Caption = "Machine Account"
  715. BeginProperty Font
  716. Name = "Comic Sans MS"
  717. Size = 9.75
  718. Charset = 0
  719. Weight = 700
  720. Underline = 0 'False
  721. Italic = 0 'False
  722. Strikethrough = 0 'False
  723. EndProperty
  724. ForeColor = &H00000080&
  725. Height = 615
  726. Left = 360
  727. TabIndex = 24
  728. ToolTipText = "Required to add workstations to a domain"
  729. Top = 4200
  730. Width = 1095
  731. End
  732. Begin VB.Label Label4
  733. Caption = "Increase Quota"
  734. BeginProperty Font
  735. Name = "Comic Sans MS"
  736. Size = 9.75
  737. Charset = 0
  738. Weight = 700
  739. Underline = 0 'False
  740. Italic = 0 'False
  741. Strikethrough = 0 'False
  742. EndProperty
  743. ForeColor = &H00000080&
  744. Height = 615
  745. Left = 360
  746. TabIndex = 23
  747. ToolTipText = "Required to increase the quota assigned to a process"
  748. Top = 3240
  749. Width = 1335
  750. End
  751. Begin VB.Label Label3
  752. Caption = "Lock Memory"
  753. BeginProperty Font
  754. Name = "Comic Sans MS"
  755. Size = 9.75
  756. Charset = 0
  757. Weight = 700
  758. Underline = 0 'False
  759. Italic = 0 'False
  760. Strikethrough = 0 'False
  761. EndProperty
  762. ForeColor = &H00000080&
  763. Height = 495
  764. Left = 360
  765. TabIndex = 22
  766. ToolTipText = "Required to lock physical pages in memory"
  767. Top = 2280
  768. Width = 1335
  769. End
  770. Begin VB.Label Label2
  771. Caption = "Primary Token"
  772. BeginProperty Font
  773. Name = "Comic Sans MS"
  774. Size = 9.75
  775. Charset = 0
  776. Weight = 700
  777. Underline = 0 'False
  778. Italic = 0 'False
  779. Strikethrough = 0 'False
  780. EndProperty
  781. ForeColor = &H00000080&
  782. Height = 615
  783. Left = 360
  784. TabIndex = 21
  785. ToolTipText = "Required to assign the primary token of a process"
  786. Top = 1320
  787. Width = 1335
  788. End
  789. End
  790. Begin VB.Menu MenuExit
  791. Caption = "&Exit"
  792. NegotiatePosition= 1 'Left
  793. End
  794. Begin VB.Menu MenuOptions
  795. Caption = "&Options"
  796. Begin VB.Menu MenuDisableAllPrivileges
  797. Caption = "&Disable All Privileges"
  798. End
  799. Begin VB.Menu MenuEnableAllPrivileges
  800. Caption = "&Enable All Privileges"
  801. End
  802. Begin VB.Menu MenuResetPrivileges
  803. Caption = "&Reset Privileges"
  804. End
  805. Begin VB.Menu MenuSeparator
  806. Caption = "-"
  807. End
  808. Begin VB.Menu MenuProviderLogging
  809. Caption = "&Provider Logging"
  810. Checked = -1 'True
  811. End
  812. End
  813. Begin VB.Menu MenuHelp
  814. Caption = "&Help"
  815. Begin VB.Menu MenuHelpAbout
  816. Caption = "&About WMI Privilege Test Client..."
  817. End
  818. End
  819. End
  820. Attribute VB_Name = "Form1"
  821. Attribute VB_GlobalNameSpace = False
  822. Attribute VB_Creatable = False
  823. Attribute VB_PredeclaredId = True
  824. Attribute VB_Exposed = False
  825. Dim Locator As SWbemLocator
  826. Const privilegeEnabled = 0
  827. Const privilegeDisabled = 1
  828. Const privilegeUnchanged = 2
  829. 'Win32 defines
  830. Private Const TokenPrivileges = 3
  831. Private Const SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
  832. Private Const SE_AUDIT_NAME = "SeAuditPrivilege"
  833. Private Const SE_BACKUP_NAME = "SeBackupPrivilege"
  834. Private Const SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
  835. Private Const SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
  836. Private Const SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
  837. Private Const SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
  838. Private Const SE_DEBUG_NAME = "SeDebugPrivilege"
  839. Private Const SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
  840. Private Const SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
  841. Private Const SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
  842. Private Const SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
  843. Private Const SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
  844. Private Const SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
  845. Private Const SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
  846. Private Const SE_RESTORE_NAME = "SeRestorePrivilege"
  847. Private Const SE_SECURITY_NAME = "SeSecurityPrivilege"
  848. Private Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
  849. Private Const SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
  850. Private Const SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
  851. Private Const SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
  852. Private Const SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
  853. Private Const SE_TCB_NAME = "SeTcbPrivilege"
  854. Private Declare Function GetLastError Lib "kernel32" () As Long
  855. Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
  856. Private Declare Function GetTokenInformation Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal TokenInformationClass As Long, TokenInformation As Any, ByVal TokenInformationLength As Long, returnLength As Long) As Long
  857. Private Declare Function LookupPrivilegeName Lib "advapi32.dll" Alias "LookupPrivilegeNameA" (ByVal lpSystemName As String, lpLuid As LARGE_INTEGER, ByVal lpName As String, cbName As Long) As Long
  858. Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
  859. Private Type LARGE_INTEGER
  860. LowPart As Long
  861. HighPart As Long
  862. End Type
  863. Private Type luid
  864. LowPart As Long
  865. HighPart As Long
  866. End Type
  867. Private Type LUID_AND_ATTRIBUTES
  868. pLuid As luid
  869. Attributes As Long
  870. End Type
  871. Private Type TOKEN_PRIVILEGES
  872. PrivilegeCount As Long
  873. Privileges(23) As LUID_AND_ATTRIBUTES
  874. End Type
  875. Private Sub Command1_Click()
  876. Dim numEnabled As Integer
  877. Dim numDisabled As Integer
  878. numEnabled = 0
  879. numDisabled = 0
  880. ' Modify the Locator privileges
  881. For Each individualPrivilegeSetting In PrivilegeSetting
  882. Select Case individualPrivilegeSetting.ListIndex
  883. Case privilegeEnabled
  884. Locator.Security_.Privileges.Add individualPrivilegeSetting.Index
  885. Case privilegeDisabled
  886. Locator.Security_.Privileges.Add individualPrivilegeSetting.Index, False
  887. End Select
  888. Next
  889. 'Create a named value set
  890. Dim nvset As SWbemNamedValueSet
  891. Set nvset = CreateObject("WbemScripting.SWbemNamedValueSet")
  892. For Each privilege In Locator.Security_.Privileges
  893. If privilege.IsEnabled Then
  894. numEnabled = numEnabled + 1
  895. Else
  896. numDisabled = numDisabled + 1
  897. End If
  898. Next
  899. If numEnabled > 0 Then
  900. ReDim enabledarray(0 To numEnabled - 1)
  901. curIndex = 0
  902. For Each privilege In Locator.Security_.Privileges
  903. If privilege.IsEnabled Then
  904. enabledarray(curIndex) = privilege.name
  905. curIndex = curIndex + 1
  906. End If
  907. Next
  908. nvset.Add "EnabledPrivileges", enabledarray
  909. End If
  910. If numDisabled > 0 Then
  911. ReDim disabledArray(0 To numDisabled - 1)
  912. curIndex = 0
  913. For Each privilege In Locator.Security_.Privileges
  914. If privilege.IsEnabled = False Then
  915. disabledArray(curIndex) = privilege.name
  916. curIndex = curIndex + 1
  917. End If
  918. Next
  919. nvset.Add "DisabledPrivileges", disabledArray
  920. End If
  921. 'Set the logging flag
  922. nvset.Add "DetailedLogging", MenuProviderLogging.Checked
  923. 'For grins print out the context info
  924. PrintSettings nvset
  925. 'Now do the biz
  926. Dim service As SWbemServices
  927. Dim obj As SWbemObject
  928. Set service = Locator.ConnectServer(, "root/scenario28")
  929. service.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
  930. On Error Resume Next
  931. Set obj = service.Get("Scenario28.key=""x""", , nvset)
  932. If Err <> 0 Then
  933. Debug.Print Hex(Err.Number), Err.Description
  934. 'Look for error object
  935. Dim providerInfo As SWbemLastError
  936. Set providerInfo = CreateObject("WbemScripting.SWbemLastError")
  937. If providerInfo Is Nothing Then
  938. MsgBox "Did not receive error object", vbCritical, "Error"
  939. Else
  940. Dim resultsDialog As Dialog
  941. Set resultsDialog = New Dialog
  942. resultsDialog.SetData providerInfo
  943. resultsDialog.Show vbModal
  944. End If
  945. End If
  946. End Sub
  947. Private Sub Form_Load()
  948. Set Locator = CreateObject("WbemScripting.SwbemLocator")
  949. ' Set up all the privilege controls, and by default
  950. ' hide every one. We will unhide the ones that
  951. ' correspond to privileges avaiable to the
  952. ' currently logged-in user.
  953. Dim individualPrivilegeSetting As ListBox
  954. For Each individualPrivilegeSetting In PrivilegeSetting
  955. individualPrivilegeSetting.AddItem "Enabled", privilegeEnabled
  956. individualPrivilegeSetting.AddItem "Disabled", privilegeDisabled
  957. individualPrivilegeSetting.AddItem "Not overridden", privilegeUnchanged
  958. individualPrivilegeSetting.ListIndex = privilegeUnchanged
  959. individualPrivilegeSetting.Visible = False
  960. Next
  961. Dim ProcessHandle As Long
  962. Dim ProcessToken As Long
  963. ' Get the process token - this will give us the list
  964. ' privileges that the logged-in user can enable/disable
  965. ProcessHandle = GetCurrentProcess()
  966. res = OpenProcessToken(ProcessHandle, 8, ProcessToken)
  967. Dim PrivilegeInfo As TOKEN_PRIVILEGES
  968. Dim returnLength As Long
  969. res = GetTokenInformation(ProcessToken, TokenPrivileges, PrivilegeInfo, 3000, returnLength)
  970. ' For each privilege available to the user, make visible
  971. ' the corresponding control
  972. For i = 0 To (PrivilegeInfo.PrivilegeCount - 1)
  973. Dim luid As luid
  974. luid = PrivilegeInfo.Privileges(i).pLuid
  975. Dim pLuid As LARGE_INTEGER
  976. pLuid.HighPart = luid.HighPart
  977. pLuid.LowPart = luid.LowPart
  978. Dim name As String
  979. Dim lname As Long
  980. res = LookupPrivilegeName(vbNullString, pLuid, name, lname)
  981. If res = 0 Then
  982. name = String(lname + 1, vbNull)
  983. res = LookupPrivilegeName(vbNullString, pLuid, name, lname)
  984. End If
  985. If res <> 0 Then
  986. ' A valid privilege
  987. Dim name2 As String
  988. name2 = Left(name, lname)
  989. Select Case name2
  990. Case SE_ASSIGNPRIMARYTOKEN_NAME
  991. PrivilegeSetting(wbemPrivilegePrimaryToken).Visible = True
  992. Case SE_AUDIT_NAME
  993. PrivilegeSetting(wbemPrivilegeAudit).Visible = True
  994. Case SE_BACKUP_NAME
  995. PrivilegeSetting(wbemPrivilegeBackup).Visible = True
  996. Case SE_CHANGE_NOTIFY_NAME
  997. PrivilegeSetting(wbemPrivilegeChangeNotify).Visible = True
  998. Case SE_CREATE_PAGEFILE_NAME
  999. PrivilegeSetting(wbemPrivilegeCreatePagefile).Visible = True
  1000. Case SE_CREATE_PERMANENT_NAME
  1001. PrivilegeSetting(wbemPrivilegeCreatePermanent).Visible = True
  1002. Case SE_CREATE_TOKEN_NAME
  1003. PrivilegeSetting(wbemPrivilegeCreateToken).Visible = True
  1004. Case SE_DEBUG_NAME
  1005. PrivilegeSetting(wbemPrivilegeDebug).Visible = True
  1006. Case SE_INC_BASE_PRIORITY_NAME
  1007. PrivilegeSetting(wbemPrivilegeIncreaseBasePriority).Visible = True
  1008. Case SE_INCREASE_QUOTA_NAME
  1009. PrivilegeSetting(wbemPrivilegeIncreaseQuota).Visible = True
  1010. Case SE_LOAD_DRIVER_NAME
  1011. PrivilegeSetting(wbemPrivilegeLoadDriver).Visible = True
  1012. Case SE_LOCK_MEMORY_NAME
  1013. PrivilegeSetting(wbemPrivilegeLockMemory).Visible = True
  1014. Case SE_MACHINE_ACCOUNT_NAME
  1015. PrivilegeSetting(wbemPrivilegeMachineAccount).Visible = True
  1016. Case SE_PROF_SINGLE_PROCESS_NAME
  1017. PrivilegeSetting(wbemPrivilegeProfileSingleProcess).Visible = True
  1018. Case SE_REMOTE_SHUTDOWN_NAME
  1019. PrivilegeSetting(wbemPrivilegeRemoteShutdown).Visible = True
  1020. Case SE_RESTORE_NAME
  1021. PrivilegeSetting(wbemPrivilegeRestore).Visible = True
  1022. Case SE_SECURITY_NAME
  1023. PrivilegeSetting(wbemPrivilegeSecurity).Visible = True
  1024. Case SE_SHUTDOWN_NAME
  1025. PrivilegeSetting(wbemPrivilegeShutdown).Visible = True
  1026. Case SE_SYSTEM_ENVIRONMENT_NAME
  1027. PrivilegeSetting(wbemPrivilegeSystemEnvironment).Visible = True
  1028. Case SE_SYSTEM_PROFILE_NAME
  1029. PrivilegeSetting(wbemPrivilegeSystemProfile).Visible = True
  1030. Case SE_SYSTEMTIME_NAME
  1031. PrivilegeSetting(wbemPrivilegeSystemtime).Visible = True
  1032. Case SE_TAKE_OWNERSHIP_NAME
  1033. PrivilegeSetting(wbemPrivilegeTakeOwnership).Visible = True
  1034. Case SE_TCB_NAME
  1035. PrivilegeSetting(wbemPrivilegeTcb).Visible = True
  1036. End Select
  1037. End If
  1038. Next i
  1039. End Sub
  1040. Sub PrintSettings(nvset As SWbemNamedValueSet)
  1041. On Error Resume Next
  1042. Debug.Print ""
  1043. Debug.Print "Enabled Privileges"
  1044. Debug.Print "=================="
  1045. Debug.Print ""
  1046. ea = nvset("EnabledPrivileges").Value
  1047. If Err = 0 Then
  1048. For i = LBound(ea) To UBound(ea)
  1049. Debug.Print " " & ea(i)
  1050. Next
  1051. Else
  1052. Err.Clear
  1053. End If
  1054. Debug.Print ""
  1055. Debug.Print "Disabled Privileges"
  1056. Debug.Print "==================="
  1057. Debug.Print ""
  1058. ea = nvset("DisabledPrivileges").Value
  1059. If Err = 0 Then
  1060. For i = LBound(ea) To UBound(ea)
  1061. Debug.Print " " & ea(i)
  1062. Next
  1063. Else
  1064. Err.Clear
  1065. End If
  1066. Debug.Print ""
  1067. Debug.Print "Detailed Logging"
  1068. Debug.Print "================="
  1069. Debug.Print ""
  1070. ea = nvset("DetailedLogging").Value
  1071. If ea Then
  1072. Debug.Print " True"
  1073. Else
  1074. Debug.Print " False"
  1075. End If
  1076. Debug.Print ""
  1077. End Sub
  1078. Private Sub MenuDisableAllPrivileges_Click()
  1079. For Each individualPrivilegeSetting In PrivilegeSetting
  1080. If individualPrivilegeSetting.Visible = True Then
  1081. individualPrivilegeSetting.ListIndex = privilegeDisabled
  1082. End If
  1083. Next
  1084. End Sub
  1085. Private Sub MenuEnableAllPrivileges_Click()
  1086. For Each individualPrivilegeSetting In PrivilegeSetting
  1087. If individualPrivilegeSetting.Visible = True Then
  1088. individualPrivilegeSetting.ListIndex = privilegeEnabled
  1089. End If
  1090. Next
  1091. End Sub
  1092. Private Sub MenuExit_Click()
  1093. Unload Me
  1094. End Sub
  1095. Private Sub MenuHelpAbout_Click()
  1096. Set AboutDialog = New frmAbout
  1097. frmAbout.Show vbModal
  1098. End Sub
  1099. Private Sub MenuProviderLogging_Click()
  1100. MenuProviderLogging.Checked = Not MenuProviderLogging.Checked
  1101. End Sub
  1102. Private Sub MenuResetPrivileges_Click()
  1103. For Each individualPrivilegeSetting In PrivilegeSetting
  1104. If individualPrivilegeSetting.Visible = True Then
  1105. individualPrivilegeSetting.ListIndex = privilegeUnchanged
  1106. End If
  1107. Next
  1108. End Sub