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.

982 lines
42 KiB

  1. VERSION 1.0 CLASS
  2. BEGIN
  3. MultiUse = -1 'True
  4. END
  5. Attribute VB_Name = "PDF"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = False
  10. Option Explicit
  11. 'Module globals
  12. Private wsoServices As ISWbemServices
  13. Private CurrentPDFID As Integer
  14. Private CurrentPDFName As String
  15. Dim vaPackagePropertyNames(9) As Variant 'vars to pass to the validation routines
  16. Dim vaProgramPropertyNames(14) As Variant
  17. 'think of these as the values of all the instances of the packages
  18. Dim vaPackage1PropertyValues(9) As Variant
  19. Dim vaProgram11PropertyValues(14) As Variant
  20. Dim vaProgram12PropertyValues(14) As Variant
  21. Private Sub Class_Initialize()
  22. frmMain.lstModules.AddItem "Package Definition Files"
  23. 'this checks/unchecks teh defaults for this mod in the list
  24. frmMain.lstModules.Selected(frmMain.lstModules.ListCount - 1) = False
  25. End Sub
  26. Public Function GetModuleInfo() As String
  27. GetModuleInfo = "See the bugs on the tree nodes for more info." & vbCrLf
  28. End Function
  29. Public Sub RegisterNodes()
  30. frmTest.AddNode "root", "pdfRoot", "Package Definition Files"
  31. frmTest.AddNode "pdfRoot", "pdfConnect", "Connect" 'test
  32. frmTest.AddNode "pdfRoot", "pdfCreatePDFV", "Create and Retrieve a Valid PDF"
  33. frmTest.AddNode "pdfCreatePDFV", "pdfLoadPDF1", "LoadPDF Method" 'test
  34. frmTest.AddNode "pdfCreatePDFV", "pdfLoadIconForPDF1", "LoadIconForPDF Method", False
  35. frmTest.AddNode "pdfLoadIconForPDF1", "pdfLoadIconForPDF1Package", "LoadIconForPDF Method (Package)", False 'test
  36. frmTest.AddNode "pdfLoadIconForPDF1", "pdfLoadIconForPDF1Program1", "LoadIconForPDF Method (Program1)", False 'test
  37. frmTest.AddNode "pdfLoadIconForPDF1", "pdfLoadIconForPDF1Program2", "LoadIconForPDF Method (Program2)", False 'test
  38. frmTest.AddNode "pdfCreatePDFV", "pdfGetObjV", "GetObjects for all", False
  39. frmTest.AddNode "pdfGetObjV", "pdfGetObjPackage", "GetObject SMS_PDF_Package", False 'test
  40. frmTest.AddNode "pdfGetObjV", "pdfGetObjProgram1", "GetObject SMS_PDF_Program1", False 'test
  41. frmTest.AddNode "pdfGetObjV", "pdfGetObjProgram2", "GetObject SMS_PDF_Program2", False 'test
  42. frmTest.AddNode "pdfCreatePDFV", "pdfEnumInstV", "EnumInstances for all", False
  43. frmTest.AddNode "pdfEnumInstV", "pdfEnumInstPackage", "Enum SMS_PDF_Package", False 'test
  44. frmTest.AddNode "pdfEnumInstV", "pdfEnumInstProgram1", "Enum SMS_PDF_Program1", False 'test
  45. frmTest.AddNode "pdfEnumInstV", "pdfEnumInstProgram2", "Enum SMS_Pdf_Program2", False 'test
  46. frmTest.AddNode "pdfCreatePDFV", "pdfWQLV", "WQL Query all instances", False
  47. frmTest.AddNode "pdfWQLV", "pdfWQLPackage", "WQL SMS_PDF_Package", False 'test
  48. frmTest.AddNode "pdfWQLV", "pdfWQLProgram1", "WQL SMS_PDF_Program1", False 'test
  49. frmTest.AddNode "pdfWQLV", "pdfWQLProgram2", "WQL SMS_PDF_Program2", False 'test
  50. frmTest.AddNode "pdfCreatePDFV", "pdfGetPDFData1", "GetPDFData Method", False
  51. End Sub
  52. Public Sub RegisterTests()
  53. Tests.Add "Package Definition Files", "pdfConnect"
  54. Tests.Add "Package Definition Files", "pdfLoadPDF1"
  55. Tests.Add "Package Definition Files", "pdfLoadIconForPDF1Package"
  56. Tests.Add "Package Definition Files", "pdfLoadIconForPDF1Program1"
  57. Tests.Add "Package Definition Files", "pdfLoadIconForPDF1Program2"
  58. Tests.Add "Package Definition Files", "pdfGetObjPackage"
  59. Tests.Add "Package Definition Files", "pdfGetObjProgram1"
  60. Tests.Add "Package Definition Files", "pdfGetObjProgram2"
  61. Tests.Add "Package Definition Files", "pdfEnumInstPackage"
  62. Tests.Add "Package Definition Files", "pdfEnumInstProgram1"
  63. Tests.Add "Package Definition Files", "pdfEnumInstProgram2"
  64. Tests.Add "Package Definition Files", "pdfWQLPackage"
  65. Tests.Add "Package Definition Files", "pdfWQLProgram1"
  66. Tests.Add "Package Definition Files", "pdfWQLProgram2"
  67. Tests.Add "Package Definition Files", "pdfGetPDFData1"
  68. End Sub
  69. Public Function Execute(mynode As Node) As Integer
  70. Dim arrIcon(7) As Byte
  71. arrIcon(0) = 1
  72. arrIcon(1) = 1
  73. arrIcon(2) = 1
  74. arrIcon(3) = 0
  75. arrIcon(4) = 1
  76. arrIcon(5) = 1
  77. arrIcon(6) = 0
  78. arrIcon(7) = 1
  79. 'define the names for sms_pdf_package properties
  80. vaPackagePropertyNames(0) = "Icon"
  81. vaPackagePropertyNames(1) = "IconSize"
  82. vaPackagePropertyNames(2) = "Language"
  83. vaPackagePropertyNames(3) = "Name"
  84. vaPackagePropertyNames(4) = "PDFFileName"
  85. vaPackagePropertyNames(5) = "PDFID"
  86. vaPackagePropertyNames(6) = "Publisher"
  87. vaPackagePropertyNames(7) = "RequiredIconNames"
  88. vaPackagePropertyNames(8) = "Status"
  89. vaPackagePropertyNames(9) = "Version"
  90. 'define the names for sms_pdf_program properties
  91. vaProgramPropertyNames(0) = "CommandLine"
  92. vaProgramPropertyNames(1) = "Comment"
  93. vaProgramPropertyNames(2) = "DependentProgram"
  94. vaProgramPropertyNames(3) = "Description"
  95. vaProgramPropertyNames(4) = "DiskSpaceReq"
  96. vaProgramPropertyNames(5) = "DriveLetter"
  97. vaProgramPropertyNames(6) = "Duration"
  98. vaProgramPropertyNames(7) = "Icon"
  99. vaProgramPropertyNames(8) = "IconSize"
  100. vaProgramPropertyNames(9) = "PDFID"
  101. vaProgramPropertyNames(10) = "ProgramFlags"
  102. vaProgramPropertyNames(11) = "ProgramName"
  103. vaProgramPropertyNames(12) = "Publisher"
  104. vaProgramPropertyNames(13) = "Requirements"
  105. vaProgramPropertyNames(14) = "WorkingDirectory"
  106. 'define the default correct values for the packages and programs we will be using.
  107. 'Valid Package (1)
  108. vaPackage1PropertyValues(0) = arrIcon()
  109. vaPackage1PropertyValues(1) = 8
  110. vaPackage1PropertyValues(2) = "English"
  111. vaPackage1PropertyValues(3) = "Test Package"
  112. vaPackage1PropertyValues(4) = CurrentPDFName
  113. vaPackage1PropertyValues(5) = CurrentPDFID
  114. vaPackage1PropertyValues(6) = "Microsoft"
  115. Dim ReqIconNames(0) As String
  116. ReqIconNames(0) = ""
  117. vaPackage1PropertyValues(7) = ReqIconNames()
  118. vaPackage1PropertyValues(8) = 0
  119. vaPackage1PropertyValues(9) = "1.0"
  120. 'Valid Package 1, Program 1 (eg: 11)
  121. vaProgram11PropertyValues(0) = "Setup.exe / 1"
  122. vaProgram11PropertyValues(1) = "Comment 1"
  123. vaProgram11PropertyValues(2) = ""
  124. vaProgram11PropertyValues(3) = "Program1"
  125. vaProgram11PropertyValues(4) = "Unknown"
  126. vaProgram11PropertyValues(5) = "X:"
  127. vaProgram11PropertyValues(6) = 0
  128. vaProgram11PropertyValues(7) = arrIcon
  129. vaProgram11PropertyValues(8) = 8
  130. vaProgram11PropertyValues(9) = CurrentPDFID
  131. vaProgram11PropertyValues(10) = "20480"
  132. vaProgram11PropertyValues(11) = "One"
  133. vaProgram11PropertyValues(12) = "Microsoft"
  134. vaProgram11PropertyValues(13) = ""
  135. vaProgram11PropertyValues(14) = ""
  136. 'Valid Package 1, Program 2 (eg: 12)
  137. vaProgram12PropertyValues(0) = "Setup.exe / 2"
  138. vaProgram12PropertyValues(1) = "Comment 2"
  139. vaProgram12PropertyValues(2) = ""
  140. vaProgram12PropertyValues(3) = "Program2"
  141. vaProgram12PropertyValues(4) = "Unknown"
  142. vaProgram12PropertyValues(5) = ""
  143. vaProgram12PropertyValues(6) = 0
  144. vaProgram12PropertyValues(7) = arrIcon
  145. vaProgram12PropertyValues(8) = 8
  146. vaProgram12PropertyValues(9) = CurrentPDFID
  147. vaProgram12PropertyValues(10) = 3690496
  148. vaProgram12PropertyValues(11) = "Two"
  149. vaProgram12PropertyValues(12) = "Microsoft"
  150. vaProgram12PropertyValues(13) = ""
  151. vaProgram12PropertyValues(14) = ""
  152. Dim sWQLQuery As String
  153. Dim sOutParms As String
  154. Execute = 0
  155. 'return 0 for fail
  156. 'return 1 for pass
  157. 'return 2 for skip
  158. 'return 3 for not-impl
  159. Select Case mynode.key
  160. Case "pdfConnect"
  161. Execute = pdfConnect(mynode)
  162. Exit Function
  163. Case "pdfLoadPDF1"
  164. If Not frmTest.AllOfThesePassed("pdfConnect") Then
  165. Execute = 2
  166. Else
  167. Execute = pdfLoadPDF1(mynode)
  168. End If
  169. Exit Function
  170. Case "pdfLoadIconForPDF1Package"
  171. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  172. Execute = 2
  173. Else
  174. Execute = pdfLoadIconForPDFMethod(CurrentPDFID, "Package.ico", arrIcon, mynode)
  175. End If
  176. Exit Function
  177. Case "pdfLoadIconForPDF1Program1"
  178. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  179. Execute = 2
  180. Else
  181. Execute = pdfLoadIconForPDFMethod(CurrentPDFID, "Program1.ico", arrIcon, mynode)
  182. End If
  183. Exit Function
  184. Case "pdfLoadIconForPDF1Program2"
  185. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  186. Execute = 2
  187. Else
  188. Execute = pdfLoadIconForPDFMethod(CurrentPDFID, "Program2.ico", arrIcon, mynode)
  189. End If
  190. Exit Function
  191. Case "pdfGetObjPackage"
  192. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  193. Execute = 2
  194. Else
  195. Execute = GenericGetObject("SMS_PDF_Package.PDFID=" & CurrentPDFID, vaPackagePropertyNames, vaPackage1PropertyValues, mynode)
  196. End If
  197. Exit Function
  198. Case "pdfGetObjProgram1"
  199. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  200. Execute = 2
  201. Else
  202. Execute = GenericGetObject("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""One""", vaProgramPropertyNames, vaProgram11PropertyValues, mynode)
  203. End If
  204. Exit Function
  205. Case "pdfGetObjProgram2"
  206. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  207. Execute = 2
  208. Else
  209. Execute = GenericGetObject("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""Two""", vaProgramPropertyNames, vaProgram12PropertyValues, mynode)
  210. End If
  211. Exit Function
  212. Case "pdfEnumInstPackage"
  213. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  214. Execute = 2
  215. Else
  216. Execute = GenericInstanceEnum("SMS_PDF_Package.PDFID=" & CurrentPDFID, vaPackagePropertyNames, vaPackage1PropertyValues, mynode)
  217. 'Execute = 3
  218. End If
  219. Exit Function
  220. Case "pdfEnumInstProgram1"
  221. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  222. Execute = 2
  223. Else
  224. Execute = GenericInstanceEnum("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""One""", vaProgramPropertyNames, vaProgram11PropertyValues, mynode)
  225. 'Execute = 3
  226. End If
  227. Exit Function
  228. Case "pdfEnumInstProgram2"
  229. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  230. Execute = 2
  231. Else
  232. Execute = GenericInstanceEnum("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""Two""", vaProgramPropertyNames, vaProgram12PropertyValues, mynode)
  233. 'Execute = 3 'sometimes it's usefull to rem out the line above and unrem this. for speed work
  234. End If
  235. Exit Function
  236. Case "pdfWQLPackage"
  237. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  238. Execute = 2
  239. Else
  240. sWQLQuery = "Select * from sms_pdf_package where PDFID=" & CurrentPDFID & ""
  241. Execute = GenericInstanceEnum("SMS_PDF_Package.PDFID=" & CurrentPDFID, vaPackagePropertyNames, vaPackage1PropertyValues, mynode, sWQLQuery)
  242. End If
  243. Exit Function
  244. Case "pdfWQLProgram1"
  245. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  246. Execute = 2
  247. Else
  248. sWQLQuery = "Select * from sms_pdf_program where PDFID=" & CurrentPDFID & " AND Programname = ""One"""
  249. Execute = GenericInstanceEnum("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""One""", vaProgramPropertyNames, vaProgram11PropertyValues, mynode, sWQLQuery)
  250. End If
  251. Exit Function
  252. Case "pdfWQLProgram2"
  253. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  254. Execute = 2
  255. Else
  256. sWQLQuery = "Select * from sms_pdf_program where PDFID=" & CurrentPDFID & " AND Programname = ""Two"""
  257. Execute = GenericInstanceEnum("SMS_PDF_Program.PDFID=" & CurrentPDFID & ",ProgramName=""Two""", vaProgramPropertyNames, vaProgram12PropertyValues, mynode, sWQLQuery)
  258. End If
  259. Exit Function
  260. Case "pdfGetPDFData1"
  261. If Not frmTest.AllOfThesePassed("pdfLoadPDF1") Then
  262. Execute = 2
  263. Else
  264. 'yout can't tab this over, there are too many chars
  265. sOutParms = vbCrLf & "instance of __PARAMETERS" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "PackageData = [SecurityVerbs(0)]" & vbCrLf & "instance of SMS_Package" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "Description = ""This is our test package"";" & vbCrLf & "" & Chr(9) & "ForcedDisconnectDelay = 5;" & vbCrLf & "" & Chr(9) & "ForcedDisconnectEnabled = FALSE;" & vbCrLf & "" & Chr(9) & "ForcedDisconnectNumRetries = 2;" & vbCrLf & "" & Chr(9) & "GenericAccess = 0;" & vbCrLf & "" & Chr(9) & "Icon = {1, 1, 1, 0, 1, 1, 0, 1};" & vbCrLf & "" & Chr(9) & "IconSize = 8;" & vbCrLf & "" & Chr(9) & "IgnoreAddressSchedule = TRUE;" & vbCrLf & "" & Chr(9) & "Language = ""English"";" & vbCrLf & "" & Chr(9) & "Manufacturer = ""Microsoft"";" & vbCrLf & "" & Chr(9) & "MIFFilename = """";" & vbCrLf & "" & Chr(9) & "MIFName = """";" & vbCrLf & "" & Chr(9) & "MIFPublisher = """";" & vbCrLf & "" & Chr(9) & "MIFVersion = """";" & vbCrLf & "" & Chr(9) & _
  266. "Name = ""Test Package"";" & vbCrLf & "" & Chr(9) & "PackageID = """";" & vbCrLf & "" & Chr(9) & "PkgFlags = 0;" & vbCrLf & "" & Chr(9) & "PkgSourceFlag = 0;" & vbCrLf & "" & Chr(9) & "PkgSourcePath = """";" & vbCrLf & "" & Chr(9) & "PreferredAddressType = """";" & vbCrLf & "" & Chr(9) & "Priority = 2;" & vbCrLf & "" & Chr(9) & "RefreshSchedule = NULL;" & vbCrLf & "" & Chr(9) & "ShareName = """";" & vbCrLf & "" & Chr(9) & "ShareType = 1;" & vbCrLf & "" & Chr(9) & "SourceSite = """";" & vbCrLf & "" & Chr(9) & "StoredPkgPath = """";" & vbCrLf & "" & Chr(9) & "StoredPkgVersion = 0;" & vbCrLf & "" & Chr(9) & "Version = ""1.0"";" & vbCrLf & "};" & vbCrLf & "" & Chr(9) & "ProgramData = {" & vbCrLf & "instance of SMS_Program" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "ApplicationHierarchy = """";" & vbCrLf & "" & Chr(9) & "CommandLine = ""Setup.exe / 1"";" & vbCrLf & "" & Chr(9) & "Comment = ""Comment 1"";" & vbCrLf & "" & Chr(9) & "DependentProgram = """";" & vbCrLf & _
  267. "" & Chr(9) & "Description = ""Program1"";" & vbCrLf & "" & Chr(9) & "DiskSpaceReq = ""Unknown"";" & vbCrLf & "" & Chr(9) & vbCrLf & _
  268. "" & Chr(9) & "IconSize = 8;" & vbCrLf & "" & Chr(9) & "PackageID = """";" & vbCrLf & "" & Chr(9) & "ProgramFlags = 20480;" & vbCrLf & "" & Chr(9) & "ProgramName = ""One"";" & vbCrLf & "" & Chr(9) & "RemovalKey = """";" & vbCrLf & "" & Chr(9) & "Requirements = """";" & vbCrLf & "" & Chr(9) & "SupportedOperatingSystems = {" & vbCrLf & "instance of SMS_OS_Details" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "MaxVersion = ""9.9.9.9"";" & vbCrLf & "" & Chr(9) & "MinVersion = ""0.0.0.0"";" & vbCrLf & "" & Chr(9) & "Name = ""Win 16"";" & vbCrLf & "" & Chr(9) & "Platform = """";" & vbCrLf & "}};" & vbCrLf & "" & Chr(9) & "WorkingDirectory = """";" & vbCrLf & "}, " & vbCrLf & "instance of SMS_Program" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "ApplicationHierarchy = """";" & vbCrLf & "" & Chr(9) & _
  269. "CommandLine = ""Setup.exe / 2"";" & vbCrLf & "" & Chr(9) & "Comment = ""Comment 2"";" & vbCrLf & "" & Chr(9) & "DependentProgram = """";" & vbCrLf & "" & Chr(9) & "Description = ""Program2"";" & vbCrLf & "" & Chr(9) & "DiskSpaceReq = ""Unknown"";" & vbCrLf & "" & Chr(9) & "DriveLetter = """";" & vbCrLf & "" & Chr(9) & "Duration = 0;" & vbCrLf & "" & Chr(9) & "Icon = {1, 1, 1, 0, 1, 1, 0, 1};" & vbCrLf & "" & Chr(9) & "IconSize = 8;" & vbCrLf & "" & Chr(9) & "PackageID = """";" & vbCrLf & "" & Chr(9) & "ProgramFlags = 3690496;" & vbCrLf & "" & Chr(9) & "ProgramName = ""Two"";" & vbCrLf & "" & Chr(9) & "RemovalKey = """";" & vbCrLf & "" & Chr(9) & "Requirements = """";" & vbCrLf & "" & Chr(9) & "SupportedOperatingSystems = {" & vbCrLf & "instance of SMS_OS_Details" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "MaxVersion = ""9.9.9.9"";" & vbCrLf & "" & Chr(9) & "MinVersion = ""0.0.0.0"";" & vbCrLf & "" & Chr(9) & _
  270. "Name = ""Win 9x"";" & vbCrLf & "" & Chr(9) & "Platform = """";" & vbCrLf & "}, " & vbCrLf & "instance of SMS_OS_Details" & vbCrLf & "{" & vbCrLf & "" & Chr(9) & "MaxVersion = ""9.9.9.9"";" & vbCrLf & "" & Chr(9) & "MinVersion = ""0.0.0.0"";" & vbCrLf & "" & Chr(9) & "Name = ""NT"";" & vbCrLf & "" & Chr(9) & "Platform = ""i386"";" & vbCrLf & "}};" & vbCrLf & "" & Chr(9) & "WorkingDirectory = """";" & vbCrLf & "}};" & vbCrLf & "" & Chr(9) & "ReturnValue = 16;" & vbCrLf & "};" & vbCrLf
  271. 'rem'd out for a bug
  272. ' Execute = GetPDFDataMethod(CurrentPDFID, sOutParms, mynode)
  273. mynode.text = mynode.text & " {Bug 22920}"
  274. Execute = 3
  275. End If
  276. Exit Function
  277. Case Else
  278. Execute = 3
  279. End Select
  280. End Function
  281. '***********************
  282. '*** CONNECT Section ***
  283. '***********************
  284. Private Function pdfConnect(n As Node) As Integer
  285. 'Dim wlo As New DWbemLocator
  286. Dim wlo As New SWbemLocator
  287. Dim u As String
  288. Dim p As String
  289. Dim a As String
  290. If frmMain.chkUserid.Value Then
  291. u = vbNullString
  292. Else
  293. u = frmMain.txtUserid.text
  294. End If
  295. If frmMain.chkPassword.Value Then
  296. p = vbNullString
  297. Else
  298. p = frmMain.txtPassword.text
  299. End If
  300. If frmMain.chkAuthority.Value Then
  301. a = vbNullString
  302. Else
  303. a = frmMain.txtAuthority.text
  304. End If
  305. On Error Resume Next
  306. 'wlo.ConnectServer "\\" & frmMain.txtServer.text & "\root\sms\site_" & frmMain.txtSitecode.text, u, p, vbNullString, 0, a, Nothing, wsoServices
  307. Set wsoServices = wlo.ConnectServer(frmMain.txtServer.text, "root\sms\site_" & frmMain.txtSitecode.text, u, p)
  308. If CheckError(Err.Number, n, "Connecting to \\" & frmMain.txtServer.text & "\root\sms\" & frmMain.txtSitecode.text) Then Exit Function
  309. pdfConnect = 1
  310. End Function
  311. '**************************************
  312. '** Execute a valid LoadPDF Method **
  313. '**************************************
  314. Private Function pdfLoadPDF1(n As Node) As Integer
  315. 'required for checkerror
  316. On Error Resume Next
  317. 'Dim c As DWbemClassObject
  318. Dim c As ISWbemObject
  319. 'Dim o As DWbemClassObject
  320. Dim o As ISWbemObject
  321. Dim a() As String
  322. Dim s As String
  323. Dim v As Variant
  324. Dim p As ISWbemProperty
  325. Dim TempProp As ISWbemProperty
  326. 'get a __Parameters class to fill up for the method
  327. 'wsoServices.GetObject "__PARAMETERS", 0, Nothing, c, Nothing
  328. Set c = wsoServices.Get("__PARAMETERS")
  329. If CheckError(Err.Number, n, "Getobject __PARAMETERS") Then Exit Function
  330. Dim pdffilename As String
  331. Randomize
  332. pdffilename = "SDKBVT_" & CStr(Int(10000 * Rnd))
  333. CurrentPDFName = pdffilename
  334. 'put some properties in for in parms to the method
  335. c.Properties_.Add "pdffilename", CIM_STRING, 0
  336. If CheckError(Err.Number, n, "Make PDFFileName") Then Exit Function
  337. c.pdffilename = CVar(pdffilename)
  338. If CheckError(Err.Number, n, "Put PDFFileName data into property") Then Exit Function
  339. 'c.Put "PDFFile", 0, CVar(MakeValidPDF(Chr(10))), 0
  340. c.Properties_.Add "PDFFile", CIM_STRING, 0
  341. If CheckError(Err.Number, n, "Put PDFFile") Then Exit Function
  342. c.PDFfile = CVar(MakeValidPDF(Chr(10)))
  343. If CheckError(Err.Number, n, "Put PDF File data into property") Then Exit Function
  344. 'c.GetObjectText 0, s
  345. s = c.GetObjectText_
  346. n.Tag = n.Tag & "*** IN-PARAMETERS ***" & vbCrLf
  347. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  348. 'wsoServices.ExecMethod "SMS_PDF_Package", "LoadPDF", 0, Nothing, c, o, Nothing
  349. Set o = wsoServices.ExecMethod("SMS_PDF_Package", "LoadPDF", c)
  350. If CheckError(Err.Number, n, "ExecMethod LoadPDF") Then Exit Function
  351. ' what I should be getting back
  352. '
  353. 'instance of __PARAMETERS
  354. '{
  355. 'PDFID = 3;
  356. 'RequiredIconNames = {"Package.ico", "One.ico", "Two.ico"};
  357. 'ReturnValue = 16;
  358. '};
  359. 'o.GetObjectText 0, s
  360. s = o.GetObjectText_
  361. n.Tag = n.Tag & "*** OUT-PARAMETERS ***" & vbCrLf
  362. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  363. 'get the pdfid from the instance to be sure it's there.
  364. 'o.Get "PDFID", 0, v, 0, 0
  365. v = o.PDFID
  366. If CheckError(Err.Number, n, "Get PDFID") Then Exit Function
  367. CurrentPDFID = v
  368. n.text = n.text & " {PDFID = " & v & "}"
  369. 'I don't validate that we get a number, just that we have the property
  370. 'get the requirediconnames property
  371. 'o.Get "RequiredIconNames", 0, v, 0, 0
  372. v = o.RequiredIconNames
  373. If CheckError(Err.Number, n, "Get RequiredIconNames") Then Exit Function
  374. 'validate that we get back the proper icon names
  375. Dim i As Integer
  376. Dim ShouldBe(3) As String
  377. ShouldBe(0) = "Package.ico"
  378. ShouldBe(1) = "Program1.ico"
  379. ShouldBe(2) = "Program2.ico"
  380. For i = 0 To UBound(ShouldBe) - 1
  381. If CStr(v(i)) = ShouldBe(i) Then
  382. pdfLoadPDF1 = 1
  383. Else
  384. n.Tag = n.Tag & "--OOPS Required Icon Name: " & v(i) & "<>" & ShouldBe(i) & vbCrLf
  385. pdfLoadPDF1 = 0
  386. Exit Function
  387. End If
  388. Next i
  389. 'make sure we didn't get any extra ones back
  390. If CStr(v(UBound(ShouldBe)) = "") Then
  391. pdfLoadPDF1 = 1
  392. Else
  393. n.Tag = n.Tag & "--OOPS got something weird back in requirediconnames" & vbCrLf
  394. pdfLoadPDF1 = 0
  395. Exit Function
  396. End If
  397. 'verify that returnvalue = 0
  398. 'o.Get "ReturnValue", 0, v, 0, 0
  399. v = o.ReturnValue
  400. If CStr(v) = "16" Then
  401. pdfLoadPDF1 = 1
  402. Else
  403. n.Tag = n.Tag & "--OOPS - Got weird ReturnValue it should have been 16 but we got: " & CStr(v) & vbCrLf
  404. pdfLoadPDF1 = 0
  405. Exit Function
  406. End If
  407. End Function
  408. '**************************************
  409. '** Execute the LoadIconForPDF Method **
  410. '**************************************
  411. 'this is a generic function to run the LoadIconForPDF method
  412. Private Function pdfLoadIconForPDFMethod(PDFID As Integer, IconFileName As String, arrIcon() As Byte, n As Node) As Integer
  413. 'required for checkerror
  414. On Error Resume Next
  415. 'Dim c As DWbemClassObject
  416. Dim c As ISWbemObject
  417. 'Dim o As DWbemClassObject
  418. Dim o As ISWbemObject
  419. Dim s As String
  420. Dim v As Variant
  421. 'get a __Parameters class to fill up for the method
  422. 'wsoServices.GetObject "__PARAMETERS", 0, Nothing, c, Nothing
  423. Set c = wsoServices.Get("__PARAMETERS")
  424. If CheckError(Err.Number, n, "Getobject __PARAMETERS") Then Exit Function
  425. 'put some properties in for in parms to the method
  426. 'c.Put "PDFID", 0, CVar(PDFID), 0
  427. c.Properties_.Add "PDFID", CIM_UINT32, 0
  428. If CheckError(Err.Number, n, "ADD PDFID Prop to in parm object") Then Exit Function
  429. c.PDFID = CVar(PDFID)
  430. If CheckError(Err.Number, n, "Put PDFID value into in parm object") Then Exit Function
  431. 'c.Put "IconFileName", 0, CVar(IconFileName), 0
  432. c.Properties_.Add "IconFileName", CIM_STRING, 0
  433. If CheckError(Err.Number, n, "Add IconFileName prop to in parm object") Then Exit Function
  434. c.IconFileName = CVar(IconFileName)
  435. If CheckError(Err.Number, n, "Put IconFileName value into in parm object") Then Exit Function
  436. 'c.Put "Icon", 0, CVar(arrIcon), 0
  437. c.Properties_.Add "Icon", CIM_UINT8 + CIM_FLAG_ARRAY, 0
  438. If CheckError(Err.Number, n, "Add Icon prop to in parm object") Then Exit Function
  439. c.Icon = CVar(arrIcon)
  440. If CheckError(Err.Number, n, "Put Icon value into in parm object") Then Exit Function
  441. 'c.GetObjectText 0, s
  442. s = c.GetObjectText_
  443. n.Tag = n.Tag & "*** IN-PARAMETERS ***" & vbCrLf
  444. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  445. 'wsoServices.ExecMethod "SMS_PDF_Package", "LoadIconForPDF", 0, Nothing, c, o, Nothing
  446. Set o = wsoServices.ExecMethod("SMS_PDF_Package", "LoadIconForPDF", c)
  447. If CheckError(Err.Number, n, "ExecMethod LoadIconForPDF") Then Exit Function
  448. 'o.GetObjectText 0, s
  449. s = o.GetObjectText_
  450. n.Tag = n.Tag & "*** OUT-PARAMETERS ***" & vbCrLf
  451. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  452. '-------------------------------
  453. 'what I should be getting back if it was successfull
  454. '-------------------------------
  455. 'instance of __ExtendedStatus
  456. '{
  457. ' Description = "<No Message>";
  458. ' StatusCode = 0;
  459. '};
  460. '-------------------------------
  461. ' Do some validation to make sure the method ran OK.
  462. 'o.Get "Description", 0, v, 0, 0
  463. v = o.Description
  464. If CheckError(Err.Number, n, "Get Description") Then Exit Function
  465. If CStr(v) = "<No Message>" Then
  466. n.Tag = n.Tag & "--Verified: " & v & " = <No Message>" & vbCrLf
  467. pdfLoadIconForPDFMethod = 1
  468. Else
  469. n.Tag = n.Tag & "--OOPS Description: " & v & "<> <No Message>" & vbCrLf
  470. pdfLoadIconForPDFMethod = 0
  471. Exit Function
  472. End If
  473. 'o.Get "StatusCode", 0, v, 0, 0
  474. v = o.StatusCode
  475. If CheckError(Err.Number, n, "Get RequiredIconNames") Then Exit Function
  476. If CStr(v) = 0 Then
  477. n.Tag = n.Tag & "--Verified: " & v & " = 0" & vbCrLf
  478. pdfLoadIconForPDFMethod = 1
  479. Else
  480. n.Tag = n.Tag & "--OOPS StatusCode: " & v & "<> 0" & vbCrLf
  481. pdfLoadIconForPDFMethod = 0
  482. Exit Function
  483. End If
  484. End Function
  485. '**************************************
  486. '** Generic Validating GETOBJECT
  487. '**************************************
  488. Private Function GenericGetObject(sObjectPath As String, vaPropertyNames() As Variant, vaPropertyValues() As Variant, n As Node) As Integer
  489. 'returns 0 for fail
  490. 'returns 1 for pass
  491. 'Dim o As DWbemClassObject
  492. Dim o As ISWbemObject
  493. Dim v As Variant
  494. GenericGetObject = 0 'default to fail
  495. On Error Resume Next
  496. 'verify that the 2 main input parms look ok.
  497. If UBound(vaPropertyNames) <> UBound(vaPropertyValues) Then
  498. MsgBox "For GenericGetObject to work ok, you must supply an equal amount of propertynames and propertyvalues", vbExclamation
  499. GenericGetObject = 0
  500. Exit Function
  501. End If
  502. 'Dim c As DWbemClassObject
  503. Dim c As ISWbemObject
  504. Dim s As String
  505. 'wsoServices.GetObject sObjectPath, 0, Nothing, c, Nothing
  506. Set c = wsoServices.Get(sObjectPath)
  507. If CheckError(Err.Number, n, "Some Error While Enum'ing: " & sObjectPath & " ") Then Exit Function
  508. 'put the whole instance in the tag
  509. 'c.GetObjectText 0, s
  510. s = c.GetObjectText_
  511. If CheckError(Err.Number, n, "doing getobject text") Then Exit Function
  512. n.Tag = ObjText2Text(s)
  513. 'validate the stuff below
  514. Dim i, j As Integer
  515. For i = 0 To (UBound(vaPropertyNames))
  516. 'c.Get vaPropertyNames(i), 0, v, 0, 0
  517. v = c.Properties_(vaPropertyNames(i)).Value
  518. 'Debug.Print VarType(v)
  519. If VarType(v) > vbArray Then
  520. 'for array properties that are empty the supplied one but be 1 element of ""
  521. If v(i) = "" Then
  522. If vaPropertyValues(i)(0) = "" Then
  523. n.Tag = n.Tag & "Verified: """ & vaPropertyNames(i) & """ = """"""""" & vbCrLf
  524. GenericGetObject = 1
  525. Else
  526. n.Tag = n.Tag & "--GetGenericObject Compare FAILED on property - " & vaPropertyNames(i) & ": """ & v & """ <> "" """" """ & vbCrLf
  527. GenericGetObject = 0
  528. Exit Function
  529. End If
  530. 'for populated arrays
  531. Else
  532. For j = 0 To (UBound(v))
  533. If (v(j)) = vaPropertyValues(i)(j) Then
  534. n.Tag = n.Tag & "Verified: """ & vaPropertyNames(i) & "(" & j & ")" & """ = """ & vaPropertyValues(i)(j) & """" & vbCrLf
  535. GenericGetObject = 1
  536. Else
  537. n.Tag = n.Tag & "--GetGenericObject Compare FAILED on property - " & vaPropertyNames(i) & ": """ & v(j) & """ <> """ & vaPropertyValues(i)(j) & """" & vbCrLf
  538. GenericGetObject = 0
  539. Exit Function
  540. End If
  541. Next j
  542. End If
  543. 'It's not an array, so just treat it like a string
  544. Else
  545. If CStr(v) = vaPropertyValues(i) Then
  546. n.Tag = n.Tag & "Verified: " & vaPropertyNames(i) & "= """ & vaPropertyValues(i) & """" & vbCrLf
  547. GenericGetObject = 1
  548. Else
  549. n.Tag = n.Tag & "--GetGenericObject Compare FAILED on property - " & vaPropertyNames(i) & ": """ & v & """ <> """ & vaPropertyValues(i) & """" & vbCrLf
  550. GenericGetObject = 0
  551. Exit Function
  552. End If
  553. End If
  554. Next i
  555. End Function
  556. '**************************************
  557. '** Generic Validating Enum (lamard 5/14/98)
  558. '**
  559. '** note: this won't work with an array value, it'll pop up a msgbox telling you however.
  560. '
  561. 'Inputs:
  562. ' sRelPth As String - the relpath of the thing you want to enum
  563. ' vaPropertyNames() As Variant - an array (usually of strings) that are the names of all the properties in the class
  564. ' vaPropertyValues() As Variant - an array of whatever the values of the properties are expected to be. values can be arrays
  565. ' sQuery as string - There are two ways to get an enum back, .InstancesOf (ENUM) or ExecQuery. if this is "" then we will used enum
  566. ' else we will use the query provided
  567. ' n As Node - the name of the node you are working on
  568. '
  569. 'Outputs:
  570. ' 0 = failed (eg: something didn't match)
  571. ' 1 = pass, everything matched up ok.
  572. '**************************************
  573. Private Function GenericInstanceEnum(sRelPath As String, vaPropertyNames() As Variant, vaPropertyValues() As Variant, n As Node, Optional sQuery As String = "") As Integer
  574. On Error Resume Next
  575. Dim classname As String
  576. Dim i, j As Integer
  577. Dim bLazy As Boolean
  578. Dim e As ISEnumWbemObject
  579. Dim c As ISWbemObject
  580. Dim cDefinition As ISWbemObject
  581. Dim p As ISWbemProperty
  582. Dim q As ISWbemQualifier
  583. 'default to failed for this fcn
  584. GenericInstanceEnum = 0
  585. 'get the classname from the relpath
  586. classname = Left(sRelPath, (InStr(1, sRelPath, ".", vbTextCompare) - 1))
  587. 'enum the WHOLE CLASS with InstancesOf.
  588. 'This will return all the instances of it.
  589. 'wsoServices.CreateInstanceEnum classname, 0, Nothing, e
  590. If sQuery = "" Then
  591. Set e = wsoServices.InstancesOf(classname)
  592. If CheckError(Err.Number, n, "Error Getting .InstancesOf(" & classname & ")") Then Exit Function
  593. Else
  594. Set e = wsoServices.ExecQuery(sQuery)
  595. If CheckError(Err.Number, n, "Error ExecQuery(" & sQuery & ")") Then Exit Function
  596. End If
  597. 'the lazy qualifier isn't propogated to the instance level
  598. 'so we have to get a copy of the class,
  599. 'so we can ask it if each property is lazy, kind of a pain
  600. Set cDefinition = wsoServices.Get(classname)
  601. 'loop through all the objects that I got back, searching for the one
  602. ' that has a relpath matching the one I'm interested in. Then crack it open
  603. ' and compare it's values to the expected.
  604. For Each c In e
  605. If c.Path_.relpath = sRelPath Then
  606. 'found the object I was looking for, now open it and look at it.
  607. n.Tag = ObjText2Text(c.GetObjectText_) 'put the whole instance in the tag
  608. i = 0
  609. For Each p In cDefinition.Properties_
  610. 'loop through a prop in the class def, see if this prop is lazy
  611. For Each q In p.Qualifiers_
  612. If LCase(q.Name) = "lazy" Then
  613. bLazy = True
  614. Exit For
  615. Else
  616. bLazy = False
  617. End If
  618. Next q
  619. 'if this prop isn't lazy then grab it
  620. If bLazy = False Then
  621. Debug.Print c.Properties_.Item(p.Name)
  622. 'test to see if the property is an array
  623. If p.CIMType > vbArray Then
  624. MsgBox "Sorry this doesn't work with arrays yet... Fix it yourself!", vbCritical
  625. ' 'for array properties that are empty the supplied one must be 1 element of ""
  626. ' If c.Properties_.Item(p.Name) = "" Then
  627. ' If vaPropertyValues(i)(0) = "" Then
  628. ' n.Tag = n.Tag & "Verified: """ & vaPropertyNames(i) & """ = """"""""" & vbCrLf
  629. ' Else
  630. ' n.Tag = n.Tag & "--GenericInstanceEnum Compare FAILED on property - " & vaPropertyNames(i) & ": """ & v & """ <> "" """" """ & vbCrLf
  631. ' Exit Function
  632. ' End If
  633. ' 'for populated arrays
  634. ' Else
  635. ' j = 0
  636. ' For j = 0 To (UBound(v))
  637. ' If (v(j)) = vaPropertyValues(i)(j) Then
  638. ' n.Tag = n.Tag & "Verified: """ & vaPropertyNames(i) & "(" & j & ")" & """ = """ & vaPropertyValues(i)(j) & """" & vbCrLf
  639. ' Else
  640. ' n.Tag = n.Tag & "--GenericInstanceEnum Compare FAILED on property - " & vaPropertyNames(i) & ": """ & v & """ <> """ & vaPropertyValues(i)(j) & """" & vbCrLf
  641. ' Exit Function
  642. ' End If
  643. ' Next j
  644. ' End If
  645. 'It's not an array, so just treat it like a string
  646. Else
  647. If CStr(c.Properties_.Item(p.Name)) = vaPropertyValues(i) Then
  648. n.Tag = n.Tag & "Verified: " & p.Name & "= """ & vaPropertyValues(i) & """" & vbCrLf
  649. Else
  650. n.Tag = n.Tag & "--GenericInstanceEnum Compare FAILED on property - " & p.Name & ": """ & c.Properties_.Item(p.Name) & """ <> """ & vaPropertyValues(i) & """" & vbCrLf
  651. Exit Function
  652. End If
  653. End If
  654. Else
  655. n.Tag = n.Tag & "The """ & p.Name & """ property is qualified as [lazy], so we don't expect to see it returned" & vbCrLf
  656. End If
  657. i = i + 1 'increment the array counter
  658. Next p
  659. GenericInstanceEnum = 1 'anytime there was an error caught above it exit'd fcn. and this value defaults to 0
  660. End If
  661. Next c
  662. Debug.Print "asdoasd"
  663. End Function
  664. '**************************************
  665. '** Execute the GetPDFData Method **
  666. '**************************************
  667. '
  668. ' inputs:
  669. ' pdfid = pdfid of the pdf you want to retrieve info about
  670. ' n = name of node your working on.
  671. '
  672. ' outputs:
  673. '
  674. Private Function GetPDFDataMethod(PDFID As Integer, sExpectedParams As String, n As Node) As Integer
  675. 'required for checkerror
  676. On Error Resume Next
  677. Dim c As ISWbemObject
  678. Dim o As ISEnumWbemObject
  679. Dim s As String
  680. Dim v As Variant
  681. MsgBox "this fcn might not have been converted"
  682. 'get a __Parameters class to fill up for the method
  683. wsoServices.GetObject "__PARAMETERS", 0, Nothing, c, Nothing
  684. If CheckError(Err.Number, n, "Getobject __PARAMETERS") Then Exit Function
  685. 'put some properties in for in parms to the method
  686. c.Put "PDFID", 0, CVar(PDFID), 0
  687. If CheckError(Err.Number, n, "Put PDFID") Then Exit Function
  688. c.GetObjectText 0, s
  689. n.Tag = n.Tag & "*** IN-PARAMETERS ***" & vbCrLf
  690. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  691. wsoServices.ExecMethod_ "SMS_PDF_Package", "GetPDFData", 0, Nothing, c, o, Nothing
  692. If CheckError(Err.Number, n, "ExecMethod LoadIconForPDF") Then Exit Function
  693. o.GetObjectText 0, s
  694. n.Tag = n.Tag & "*** OUT-PARAMETERS ***" & vbCrLf
  695. n.Tag = n.Tag & ObjText2Text(s) & vbCrLf
  696. '------------------
  697. 'dorky little thing to prep an out-parm variable for you.
  698. ' just uncomment it, use a breakpoint and do a ?z in the immediate
  699. ' window. then copy the output to the clipboard, and paste it upabove
  700. ' to use as an inparm. Be sure to verify that it's right!
  701. ' you'll need a little editing at the front and end of the string
  702. '------------------
  703. ' Dim e As Integer
  704. ' Dim z As String
  705. ' For e = 1 To Len(s)
  706. '
  707. ' If Mid(s, e, 1) = Chr(10) Then
  708. ' z = z & """ & vbCrLf & """
  709. ' ElseIf Mid(s, e, 1) = """" Then
  710. ' z = z & """"""
  711. ' ElseIf Mid(s, e, 1) = Chr(9) Then
  712. ' z = z & """ & Chr(9) & """
  713. ' Else
  714. ' z = z & Mid(s, e, 1)
  715. ' End If
  716. ' 'If e > Len(s) - 2 Then
  717. ' 'Debug.Print z
  718. ' 'Debug.Print ">> """ & Mid(s, e, 1) & """"
  719. ' 'End If
  720. '
  721. ' Next e
  722. '
  723. '
  724. Dim i As Integer
  725. For i = 1 To Len(s) Step 100
  726. If (StrComp(Mid(sExpectedParams, i, 100), Mid(ObjText2Text(s), i, 100), vbTextCompare) = 0) Then
  727. n.Tag = n.Tag & "*** PASSED *** i=" & i & "->" & i + 100 & vbCrLf
  728. GetPDFDataMethod = 1
  729. Else
  730. n.Tag = n.Tag & "*** Failed ***" & vbCrLf & "The above did not match what was expected." & vbCrLf
  731. n.Tag = n.Tag & "*** Failed ***" & vbCrLf & "Something in this 100 char chunk was different:" & vbCrLf
  732. n.Tag = n.Tag & "------------------------------------------" & vbCrLf
  733. n.Tag = n.Tag & Mid(sExpectedParams, i, 100) & vbCrLf
  734. n.Tag = n.Tag & "---------------------------------------" & vbCrLf
  735. n.Tag = n.Tag & Mid(ObjText2Text(s), i, 100) & vbCrLf
  736. n.Tag = n.Tag & "------------------------------------------" & vbCrLf & vbCrLf
  737. n.Tag = n.Tag & "*** Failed ***" & vbCrLf & "This is the complete text of what I expected:" & vbCrLf
  738. n.Tag = n.Tag & sExpectedParams & vbCrLf & vbCrLf
  739. 'Debug.Print sExpectedParams
  740. 'Debug.Print "------------------------"
  741. 'Debug.Print Mid(sExpectedParams, i, 100)
  742. 'Debug.Print "------------------------"
  743. 'Debug.Print Mid(ObjText2Text(s), i, 100)
  744. GetPDFDataMethod = 0
  745. n.text = n.text & " {Bug 22920 & Bug 22922}"
  746. Exit Function
  747. End If
  748. Next i
  749. '-------------------------------
  750. 'what I should be getting back if it was successfull
  751. '-------------------------------
  752. 'instance of __ExtendedStatus
  753. '{
  754. ' Description = "<No Message>";
  755. ' StatusCode = 0;
  756. '};
  757. '-------------------------------
  758. ' Do some validation to make sure the method ran OK.
  759. o.Get "Description", 0, v, 0, 0
  760. If CheckError(Err.Number, n, "Get Description") Then Exit Function
  761. If CStr(v) = "<No Message>" Then
  762. n.Tag = n.Tag & "--Verified: " & v & " = <No Message>" & vbCrLf
  763. GetPDFDataMethod = 1
  764. Else
  765. n.Tag = n.Tag & "--OOPS Description: " & v & "<> <No Message>" & vbCrLf
  766. GetPDFDataMethod = 0
  767. Exit Function
  768. End If
  769. o.Get "StatusCode", 0, v, 0, 0
  770. If CheckError(Err.Number, n, "Get RequiredIconNames") Then Exit Function
  771. If CStr(v) = 0 Then
  772. n.Tag = n.Tag & "--Verified: " & v & " = 0" & vbCrLf
  773. GetPDFDataMethod = 1
  774. Else
  775. n.Tag = n.Tag & "--OOPS StatusCode: " & v & "<> 0" & vbCrLf
  776. GetPDFDataMethod = 0
  777. Exit Function
  778. End If
  779. End Function
  780. '**************************************
  781. '** Make a Valid PDF here ***********
  782. '**************************************
  783. Private Function MakeValidPDF(linefeed As String) As String
  784. ' this fcn will return a pdf, with any linefeed chars that you want
  785. Dim ValidPDF As String
  786. ValidPDF = "[PDF]" & linefeed
  787. ValidPDF = ValidPDF & "Version = 2.0" & linefeed
  788. ValidPDF = ValidPDF & "" & linefeed
  789. ValidPDF = ValidPDF & "[Package Definition]" & linefeed
  790. ValidPDF = ValidPDF & "Name=Test Package" & linefeed
  791. ValidPDF = ValidPDF & "Version = 1.0" & linefeed
  792. ValidPDF = ValidPDF & "Publisher = Microsoft" & linefeed
  793. ValidPDF = ValidPDF & "Language = English" & linefeed
  794. ValidPDF = ValidPDF & "Comment=This is our test package" & linefeed
  795. ValidPDF = ValidPDF & "Icon = Package.ico" & linefeed
  796. ValidPDF = ValidPDF & "Programs=One, Two" & linefeed
  797. ValidPDF = ValidPDF & "Permission=UserRead,GuestRead" & linefeed
  798. ValidPDF = ValidPDF & "" & linefeed
  799. ValidPDF = ValidPDF & "[One]" & linefeed
  800. ValidPDF = ValidPDF & "Name = Program1" & linefeed
  801. ValidPDF = ValidPDF & "Comment=Comment 1" & linefeed
  802. ValidPDF = ValidPDF & "Icon = Program1.ico" & linefeed
  803. ValidPDF = ValidPDF & "CommandLine = Setup.exe / 1" & linefeed
  804. ValidPDF = ValidPDF & "SupportedClients=Win 16" & linefeed
  805. ValidPDF = ValidPDF & "DriveLetterConnection = True" & linefeed
  806. ValidPDF = ValidPDF & "SpecifyDrive = x" & linefeed
  807. ValidPDF = ValidPDF & "ReconnectDriveAtLogon = True" & linefeed
  808. ValidPDF = ValidPDF & "" & linefeed
  809. ValidPDF = ValidPDF & "[Two]" & linefeed
  810. ValidPDF = ValidPDF & "Name = Program2" & linefeed
  811. ValidPDF = ValidPDF & "Comment=Comment 2" & linefeed
  812. ValidPDF = ValidPDF & "Icon = Program2.ico" & linefeed
  813. ValidPDF = ValidPDF & "CommandLine = Setup.exe / 2" & linefeed
  814. ValidPDF = ValidPDF & "SupportedClients=Win 9x,NT (i386)" & linefeed
  815. ValidPDF = ValidPDF & "AfterRunning = SMSRestart" & linefeed
  816. ValidPDF = ValidPDF & "DependentProgram = Three" & linefeed
  817. 'Debug.Print ValidPDF
  818. 'Clipboard.SetText ValidPDF
  819. MakeValidPDF = ValidPDF
  820. End Function