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.

324 lines
12 KiB

  1. VERSION 1.0 CLASS
  2. BEGIN
  3. MultiUse = -1 'True
  4. END
  5. Attribute VB_Name = "Methods"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Option Explicit
  11. 'Private wsoServices As DIWbemServices
  12. Private wsoServices As ISWbemServices
  13. Private Sub Class_Initialize()
  14. frmMain.lstModules.AddItem "Methods"
  15. frmMain.lstModules.Selected(frmMain.lstModules.ListCount - 1) = False
  16. End Sub
  17. Public Function GetModuleInfo() As String
  18. GetModuleInfo = "This module tests all methods of the provider that are not tested by other modules."
  19. End Function
  20. Public Sub RegisterNodes()
  21. frmTest.AddNode "root", "mRoot", "Methods"
  22. frmTest.AddNode "mRoot", "mConnect", "Connect"
  23. frmTest.AddNode "mRoot", "mNAL", "SMS_NAL_Methods"
  24. frmTest.AddNode "mNAL", "mNALPack", "PackNALPath", False
  25. frmTest.AddNode "mNALPack", "mNALPackValid", "Valid", False
  26. frmTest.AddNode "mNALPack", "mNALPackInvalid", "Invalid", False
  27. frmTest.AddNode "mNAL", "mNALUnpack", "UnPackNALPath", False
  28. frmTest.AddNode "mNALUnpack", "mNALUnpackValid", "Valid", False
  29. frmTest.AddNode "mNALUnpack", "mNALUnpackInvalid", "Invalid", False
  30. frmTest.AddNode "mRoot", "mSchedule", "SMS_ScheduleMethods"
  31. frmTest.AddNode "mSchedule", "mScheduleWrite", "WriteToString", False
  32. frmTest.AddNode "mScheduleWrite", "mScheduleWriteValid", "Valid", False
  33. frmTest.AddNode "mScheduleWrite", "mScheduleWriteInvalid", "Invalid", False
  34. frmTest.AddNode "mSchedule", "mScheduleRead", "ReadFromString", False
  35. frmTest.AddNode "mScheduleRead", "mScheduleReadValid", "Valid", False
  36. frmTest.AddNode "mScheduleRead", "mScheduleReadInvalid", "Invalid", False
  37. frmTest.AddNode "mRoot", "mPackage", "SMS_Package"
  38. frmTest.AddNode "mPackage", "mPackageRefresh", "RefreshPkgSource", False
  39. frmTest.AddNode "mRoot", "mPDF", "SMS_PDF_Package"
  40. frmTest.AddNode "mPDF", "mPDFProcess", "ProcessInbox", False
  41. frmTest.AddNode "mPDF", "mPDFLoad", "LoadPDF", False
  42. frmTest.AddNode "mPDF", "mPDFLoadIcon", "LoadIconForPDF", False
  43. frmTest.AddNode "mPDF", "mPDFGet", "GetPDFData", False
  44. frmTest.AddNode "mRoot", "mSite", "SMS_Site"
  45. frmTest.AddNode "mSite", "mSiteVerify", "VerifyNoLoops", False
  46. frmTest.AddNode "mRoot", "mCollection", "SMS_Collection"
  47. frmTest.AddNode "mCollection", "mCollectionAdd", "AddMembershipRule", False
  48. frmTest.AddNode "mCollection", "mCollectionDel", "DeleteMembershipRule", False
  49. frmTest.AddNode "mCollection", "mCollectionRefresh", "RequestRefresh", False
  50. frmTest.AddNode "mRoot", "mResourcemap", "SMS_ResourceMap"
  51. frmTest.AddNode "mResourcemap", "mResourcemapRefresh", "Refresh", False
  52. frmTest.AddNode "mRoot", "mSecured", "SMS_SecuredObject"
  53. frmTest.AddNode "mSecured", "mSecuredUser", "UserHasPermissions", False
  54. frmTest.AddNode "mRoot", "mSIM", "SMS_SiteInstallMap"
  55. frmTest.AddNode "mSIM", "mSIMRefresh", "Refresh", False
  56. frmTest.AddNode "mSIM", "mSIMGet", "GetSessionHandle", False
  57. frmTest.AddNode "mSIM", "mSIMRelease", "ReleaseSessionHandle", False
  58. End Sub
  59. Public Sub RegisterTests()
  60. Tests.Add "Methods", "mConnect"
  61. Tests.Add "Methods", "mNALPackValid"
  62. Tests.Add "Methods", "mNALPackInvalid"
  63. Tests.Add "Methods", "mNALUnpackValid"
  64. Tests.Add "Methods", "mNALUnpackInvalid"
  65. Tests.Add "Methods", "mScheduleWriteValid"
  66. Tests.Add "Methods", "mScheduleWriteInvalid"
  67. Tests.Add "Methods", "mScheduleReadValid"
  68. Tests.Add "Methods", "mScheduleReadInvalid"
  69. Tests.Add "Methods", "mPackageRefresh"
  70. Tests.Add "Methods", "mPDFProcess"
  71. Tests.Add "Methods", "mPDFLoad"
  72. Tests.Add "Methods", "mPDFLoadIcon"
  73. Tests.Add "Methods", "mPDFGet"
  74. Tests.Add "Methods", "mSiteVerify"
  75. Tests.Add "Methods", "mCollectionAdd"
  76. Tests.Add "Methods", "mCollectionDel"
  77. Tests.Add "Methods", "mCollectionRefresh"
  78. Tests.Add "Methods", "mResourcemapRefresh"
  79. Tests.Add "Methods", "mSecuredUser"
  80. Tests.Add "Methods", "mSIMRefresh"
  81. Tests.Add "Methods", "mSIMGet"
  82. Tests.Add "Methods", "mSIMRelease"
  83. End Sub
  84. Public Function Execute(mynode As Node) As Integer
  85. Execute = 0
  86. Select Case mynode.key
  87. Case "mConnect"
  88. Execute = mConnect(mynode)
  89. Case "mNALPackValid"
  90. Execute = mNALPackValid(mynode)
  91. Case "mNALPackInvalid"
  92. mynode.text = mynode.text & " (see bug 21754)"
  93. Execute = 3
  94. Case "mNALUnpackValid"
  95. Execute = mNALUnpackValid(mynode)
  96. Case "mNALUnpackInvalid"
  97. mynode.text = mynode.text & " (see bug 21754)"
  98. Execute = 3
  99. Case Else
  100. Execute = 3
  101. End Select
  102. End Function
  103. 'Private Function xMethod(n As Node, objpath As String, method As String, cin As DWbemClassObject, cout As DWbemClassObject) As Integer
  104. '
  105. 'End Function
  106. Private Function mConnect(n As Node) As Integer
  107. 'Dim wlo As New DWbemLocator
  108. Dim wlo As New SWbemLocator
  109. Dim u As String
  110. Dim p As String
  111. Dim a As String
  112. If frmMain.chkUserid.Value Then
  113. u = vbNullString
  114. Else
  115. u = frmMain.txtUserid.text
  116. End If
  117. If frmMain.chkPassword.Value Then
  118. p = vbNullString
  119. Else
  120. p = frmMain.txtPassword.text
  121. End If
  122. If frmMain.chkAuthority.Value Then
  123. a = vbNullString
  124. Else
  125. a = frmMain.txtAuthority.text
  126. End If
  127. On Error Resume Next
  128. 'wlo.ConnectServer "\\" & frmMain.txtServer.text & "\root\sms\site_" & frmMain.txtSitecode.text, u, p, vbNullString, 0, a, Nothing, wsoServices
  129. Set wsoServices = wlo.ConnectServer(frmMain.txtServer.text, "root\sms\site_" & frmMain.txtSitecode.text, u, p)
  130. If CheckError(Err.Number, n, "Connecting to \\" & frmMain.txtServer.text & "\root\sms\site_" & frmMain.txtSitecode.text) Then Exit Function
  131. mConnect = 1
  132. End Function
  133. Private Function mNALPackValid(n As Node) As Integer
  134. On Error Resume Next
  135. If Not frmTest.AllOfThesePassed("mConnect") Then
  136. mNALPackValid = 2
  137. Else
  138. 'Dim c As DWbemClassObject
  139. Dim c As ISWbemObject
  140. 'Dim o As DWbemClassObject
  141. Dim o As ISWbemObject
  142. Dim a() As String
  143. Dim s As String
  144. Dim v As Variant
  145. 'wsoServices.GetObject "__PARAMETERS", 0, Nothing, c, Nothing
  146. Set c = wsoServices.Get("__PARAMETERS")
  147. If CheckError(Err.Number, n, "Getobject __PARAMETERS") Then Exit Function
  148. 'c.Put "NALType", 0, CVar("NALTYPE"), 0
  149. c.Properties_.Add "NALType", CIM_STRING
  150. c.NALType = CVar("NALTYPE")
  151. If CheckError(Err.Number, n, "Put NALType") Then Exit Function
  152. 'c.Put "NetworkOSPath", 0, CVar("NetworkOSPath"), 0
  153. c.Properties_.Add "NetworkOSPath", CIM_STRING
  154. c.NetworkOSPath = CVar("NetworkOSPath")
  155. If CheckError(Err.Number, n, "Put NetworkOSPath") Then Exit Function
  156. ReDim a(0 To 1)
  157. a(0) = "Qual1"
  158. a(1) = "Qual2"
  159. 'c.Put "DisplayQualifiers", 0, CVar(a), 0
  160. c.Properties_.Add "DisplayQualifiers", CIM_STRING Or CIM_FLAG_ARRAY
  161. c.DisplayQualifiers = CVar(a)
  162. If CheckError(Err.Number, n, "Put DisplayQualifiers") Then Exit Function
  163. a(0) = "Net1"
  164. a(1) = "Net2"
  165. 'c.Put "NetworkConnectionQualifiers", 0, CVar(a), 0
  166. c.Properties_.Add "NetworkConnectionQualifiers", CIM_STRING Or CIM_FLAG_ARRAY
  167. c.NetworkConnectionQualifiers = CVar(a)
  168. If CheckError(Err.Number, n, "Put NetworkConnectionQualifiers") Then Exit Function
  169. 'c.GetObjectText 0, s
  170. s = c.GetObjectText_
  171. n.Tag = n.Tag & "*** IN-PARAMETERS ***" & vbCrLf
  172. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  173. 'wsoServices.ExecMethod "SMS_NAL_Methods", "PackNALPath", 0, Nothing, c, o, Nothing
  174. Set o = wsoServices.ExecMethod("SMS_NAL_Methods", "PackNALPath", c)
  175. If CheckError(Err.Number, n, "ExecMethod PackNALPath") Then Exit Function
  176. 'o.GetObjectText 0, s
  177. s = o.GetObjectText_
  178. n.Tag = n.Tag & "*** OUT-PARAMETERS ***" & vbCrLf
  179. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  180. 'o.Get "NALPath", 0, v, 0, 0
  181. 'If CheckError(Err.Number, n, "Get NALPath") Then Exit Function
  182. If CStr(o.NALPath) = "[""Qual1"",""Qual2""]NALTYPE:[""Net1"",""Net2""]NetworkOSPath\" Then
  183. mNALPackValid = 1
  184. Else
  185. mNALPackValid = 0
  186. End If
  187. End If
  188. End Function
  189. Private Function mNALUnpackValid(n As Node) As Integer
  190. On Error Resume Next
  191. If Not frmTest.AllOfThesePassed("mConnect") Then
  192. mNALUnpackValid = 2
  193. Else
  194. 'Dim c As DWbemClassObject
  195. Dim c As ISWbemObject
  196. 'Dim o As DWbemClassObject
  197. Dim o As ISWbemObject
  198. Dim s As String
  199. Dim v As Variant
  200. 'wsoServices.GetObject "__PARAMETERS", 0, Nothing, c, Nothing
  201. Set c = wsoServices.Get("__PARAMETERS")
  202. If CheckError(Err.Number, n, "Getobject __parameters") Then Exit Function
  203. 'c.Put "NALPath", 0, CVar("[""Qual1"",""Qual2""]NALTYPE:[""Net1"",""Net2""]NetworkOSPath\"), 0
  204. c.Properties_.Add "NALPath", CIM_STRING
  205. c.NALPath = CVar("[""Qual1"",""Qual2""]NALTYPE:[""Net1"",""Net2""]NetworkOSPath\")
  206. If CheckError(Err.Number, n, "Put NALPath") Then Exit Function
  207. 'c.GetObjectText 0, s
  208. s = c.GetObjectText_
  209. n.Tag = n.Tag & "*** IN-PARAMETERS ***" & vbCrLf
  210. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  211. 'wsoServices.ExecMethod "SMS_NAL_Methods", "UnPackNALPath", 0, Nothing, c, o, Nothing
  212. Set o = wsoServices.ExecMethod("SMS_NAL_Methods", "UnPackNALPath", c)
  213. If CheckError(Err.Number, n, "ExecMethod UnPackNALPath") Then Exit Function
  214. 'o.GetObjectText 0, s
  215. s = o.GetObjectText_
  216. n.Tag = n.Tag & "*** OUT-PARAMETERS ***" & vbCrLf
  217. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  218. 'o.Get "NALType", 0, v, 0, 0
  219. 'If CheckError(Err.Number, n, "Get NALType") Then Exit Function
  220. If CStr(o.NALType) <> "NALTYPE" Then
  221. mNALUnpackValid = 0
  222. Exit Function
  223. End If
  224. 'o.Get "NetworkOSPath", 0, v, 0, 0
  225. 'If CheckError(Err.Number, n, "Get NetworkOSPath") Then Exit Function
  226. If CStr(o.NetworkOSPath) <> "NetworkOSPath" Then
  227. mNALUnpackValid = 0
  228. Exit Function
  229. End If
  230. 'o.get "DisplayQualifiers", 0, v, 0, 0
  231. 'If CheckError(Err.Number, n, "Get DisplayQualifiers") Then Exit Function
  232. v = o.Properties_("DisplayQualifiers")
  233. s = CStr(v(0))
  234. If CheckError(Err.Number, n, "Check DisplayQualifier(0)") Then Exit Function
  235. If s <> "Qual1" Then
  236. mNALUnpackValid = 0
  237. Exit Function
  238. End If
  239. s = CStr(v(1))
  240. If CheckError(Err.Number, n, "Check DisplayQualifier(1)") Then Exit Function
  241. If s <> "Qual2" Then
  242. mNALUnpackValid = 0
  243. Exit Function
  244. End If
  245. 'o.Get "NetworkConnectionQualifiers", 0, v, 0, 0
  246. v = o.Properties_("NetworkConnectionQualifiers")
  247. If CheckError(Err.Number, n, "Get NetworkConnectionQualifiers") Then Exit Function
  248. s = CStr(v(0))
  249. If CheckError(Err.Number, n, "Check NetworkConnectionQualifiers(0)") Then Exit Function
  250. If s <> "Net1" Then
  251. mNALUnpackValid = 0
  252. Exit Function
  253. End If
  254. s = CStr(v(1))
  255. If CheckError(Err.Number, n, "Check NetworkConnectionQualifiers(1)") Then Exit Function
  256. If s <> "Net2" Then
  257. mNALUnpackValid = 0
  258. Exit Function
  259. End If
  260. mNALUnpackValid = 1
  261. End If
  262. End Function