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.

254 lines
7.2 KiB

  1. VERSION 5.00
  2. Begin VB.Form Form1
  3. Caption = "Form1"
  4. ClientHeight = 6180
  5. ClientLeft = 60
  6. ClientTop = 345
  7. ClientWidth = 5160
  8. LinkTopic = "Form1"
  9. ScaleHeight = 6180
  10. ScaleWidth = 5160
  11. StartUpPosition = 3 'Windows Default
  12. Begin VB.Frame Frame3
  13. Caption = "API"
  14. Height = 735
  15. Left = 240
  16. TabIndex = 13
  17. Top = 240
  18. Width = 4335
  19. Begin VB.OptionButton UseADSI
  20. Caption = "ADSI"
  21. Height = 255
  22. Left = 2640
  23. TabIndex = 15
  24. Top = 360
  25. Width = 1455
  26. End
  27. Begin VB.OptionButton UseWMI
  28. Caption = "WMI"
  29. Height = 255
  30. Left = 240
  31. TabIndex = 14
  32. Top = 360
  33. Value = -1 'True
  34. Width = 1335
  35. End
  36. End
  37. Begin VB.Frame Frame2
  38. Caption = "Binding"
  39. Height = 855
  40. Left = 240
  41. TabIndex = 10
  42. Top = 1080
  43. Width = 4335
  44. Begin VB.OptionButton LateBound
  45. Caption = "Late-Bound"
  46. Height = 195
  47. Left = 2640
  48. TabIndex = 12
  49. Top = 360
  50. Value = -1 'True
  51. Width = 1455
  52. End
  53. Begin VB.OptionButton EarlyBound
  54. Caption = "Early-Bound"
  55. Height = 195
  56. Left = 240
  57. TabIndex = 11
  58. Top = 360
  59. Width = 1335
  60. End
  61. End
  62. Begin VB.CommandButton cmdSet
  63. Caption = "Set"
  64. Enabled = 0 'False
  65. Height = 375
  66. Left = 1560
  67. TabIndex = 9
  68. Top = 5640
  69. Width = 1455
  70. End
  71. Begin VB.CommandButton cmdGet
  72. Caption = "Get"
  73. Height = 375
  74. Left = 3720
  75. TabIndex = 2
  76. Top = 2520
  77. Width = 1335
  78. End
  79. Begin VB.Frame Frame1
  80. Caption = "CallBack"
  81. Height = 1695
  82. Left = 120
  83. TabIndex = 4
  84. Top = 3600
  85. Width = 4935
  86. Begin VB.TextBox phoneNumber
  87. Height = 375
  88. Left = 1800
  89. TabIndex = 8
  90. Top = 1080
  91. Width = 1935
  92. End
  93. Begin VB.OptionButton setByAdmin
  94. Caption = "Preset To:"
  95. Height = 255
  96. Left = 240
  97. TabIndex = 7
  98. Top = 1080
  99. Width = 1095
  100. End
  101. Begin VB.OptionButton setByTheCaller
  102. Caption = "Set By The Caller"
  103. Height = 255
  104. Left = 240
  105. TabIndex = 6
  106. Top = 720
  107. Width = 2655
  108. End
  109. Begin VB.OptionButton noCallBack
  110. Caption = "NoCallBack"
  111. Height = 255
  112. Left = 240
  113. TabIndex = 5
  114. Top = 360
  115. Width = 1935
  116. End
  117. End
  118. Begin VB.CheckBox chkDialin
  119. Caption = "Dial-in Permission"
  120. Height = 255
  121. Left = 240
  122. TabIndex = 3
  123. Top = 3120
  124. Width = 2175
  125. End
  126. Begin VB.TextBox adsPath
  127. Height = 375
  128. Left = 240
  129. TabIndex = 1
  130. Text = "umi:///winnt/computer=alanbos4"
  131. Top = 2520
  132. Width = 3375
  133. End
  134. Begin VB.Label Label1
  135. Caption = "User Path"
  136. Height = 255
  137. Left = 240
  138. TabIndex = 0
  139. Top = 2160
  140. Width = 1215
  141. End
  142. End
  143. Attribute VB_Name = "Form1"
  144. Attribute VB_GlobalNameSpace = False
  145. Attribute VB_Creatable = False
  146. Attribute VB_PredeclaredId = True
  147. Attribute VB_Exposed = False
  148. Public wbemObject As SWbemObjectEx
  149. Public lateboundObject
  150. Public ras As ADsRas
  151. Public adsiObject As IADs
  152. Private Sub cmdGet_Click()
  153. origMousePointer = Form1.MousePointer
  154. Form1.MousePointer = vbHourglass
  155. Dim conn As SWbemServicesEx
  156. If UseWMI.Value Then Set conn = GetObject("umi:///winnt/computer=alanbos4")
  157. If EarlyBound.Value Then
  158. If UseWMI.Value Then
  159. Set wbemObject = conn.Get("User=guest")
  160. Set ras = wbemObject
  161. Else
  162. Set adsiObject = GetObject("WinNT://REDMOND/ALANBOS4/Guest")
  163. Set ras = adsiObject
  164. End If
  165. Else
  166. If UseWMI.Value Then
  167. Set lateboundObject = conn.Get("User=guest")
  168. Else
  169. Set lateboundObject = GetObject("WinNT://REDMOND/ALANBOS4/Guest")
  170. End If
  171. End If
  172. If EarlyBound.Value Then
  173. If (ras.DialinPrivilege = True) Then
  174. chkDialin.Value = 1
  175. Else
  176. chkDialin.Value = 0
  177. End If
  178. l = ras.GetRasCallBack
  179. If (l And ADS_RAS_NOCALLBACK) Then
  180. noCallBack = True
  181. ElseIf (l And ADS_RAS_CALLER_SETCALLBACK) Then
  182. setByTheCaller = True
  183. ElseIf (l And ADS_RAS_ADMIN_SETCALLBACK) Then
  184. setByAdmin = True
  185. phoneNumber = ras.GetRasPhoneNumber
  186. End If
  187. Else
  188. If (lateboundObject.DialinPrivilege = True) Then
  189. chkDialin.Value = 1
  190. Else
  191. chkDialin.Value = 0
  192. End If
  193. l = lateboundObject.GetRasCallBack
  194. If (l And ADS_RAS_NOCALLBACK) Then
  195. noCallBack = True
  196. ElseIf (l And ADS_RAS_CALLER_SETCALLBACK) Then
  197. setByTheCaller = True
  198. ElseIf (l And ADS_RAS_ADMIN_SETCALLBACK) Then
  199. setByAdmin = True
  200. phoneNumber = lateboundObject.GetRasPhoneNumber
  201. End If
  202. End If
  203. ' Once we have retrieved we can set
  204. cmdSet.Enabled = True
  205. Form1.MousePointer = origMousePointer
  206. End Sub
  207. Private Sub cmdSet_Click()
  208. If EarlyBound.Value Then
  209. If (chkDialin.Value = 0) Then
  210. ras.DialinPrivilege = False
  211. Else
  212. ras.DialinPrivilege = True
  213. End If
  214. If (noCallBack) Then
  215. ras.SetRasCallBack ADS_RAS_NOCALLBACK
  216. ElseIf (setByTheCaller) Then
  217. ras.SetRasCallBack ADS_RAS_CALLER_SETCALLBACK
  218. ElseIf (setByAdmin) Then
  219. ras.SetRasCallBack ADS_RAS_ADMIN_SETCALLBACK, phoneNumber
  220. End If
  221. Else
  222. If (chkDialin.Value = 0) Then
  223. lateboundObject.DialinPrivilege = False
  224. Else
  225. lateboundObject.DialinPrivilege = True
  226. End If
  227. If (noCallBack) Then
  228. lateboundObject.SetRasCallBack ADS_RAS_NOCALLBACK
  229. ElseIf (setByTheCaller) Then
  230. lateboundObject.SetRasCallBack ADS_RAS_CALLER_SETCALLBACK
  231. ElseIf (setByAdmin) Then
  232. lateboundObject.SetRasCallBack ADS_RAS_ADMIN_SETCALLBACK, phoneNumber
  233. End If
  234. End If
  235. End Sub