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.

143 lines
4.3 KiB

  1. '////////////////////////////////////////////////////////////////////////////
  2. '
  3. ' Copyright (c) 1999-2000 Microsoft Corp. All Rights Reserved.
  4. '
  5. ' File name:
  6. '
  7. ' cmi.vbs
  8. '
  9. ' Abstract:
  10. '
  11. ' Windows Embedded Prototype Script for Printers
  12. '
  13. ' Remarks:
  14. '
  15. ' CMI helper functions and event handlers.
  16. '
  17. ' Author:
  18. '
  19. ' Larry Zhu (lzhu) 12-25-2000
  20. '
  21. '////////////////////////////////////////////////////////////////////////////
  22. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  23. '
  24. ' Cmi helper functions
  25. '
  26. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  27. '////////////////////////////////////////////////////////////////////////////////////
  28. '
  29. ' Function name:
  30. '
  31. ' fillComponentFlagArray
  32. '
  33. ' Function description:
  34. '
  35. ' This function fills componentFlagArray
  36. '
  37. ' Arguments:
  38. '
  39. ' oResouces -- Resouces collection
  40. ' componentFlagArray -- an array of flags that indicate which component
  41. ' is mapped
  42. '
  43. '///////////////////////////////////////////////////////////////////////////////////
  44. Sub fillComponentFlagArray(oResources, componentFlagArray)
  45. Dim oRes
  46. Dim bMapped
  47. Dim strFileName
  48. ' get all the mapped components
  49. For Each oRes In oResources ' For each resource..
  50. If 0 = StrComp(oRes.Type.Name, "File", 1) Then
  51. strFileName = oRes.Properties("DstName")
  52. bMapped = mapIt(strFileName, componentFlagArray)
  53. If (bMapped) Then
  54. TraceState strFileName, " is mapped"
  55. Else
  56. TraceState strFileName, " is not mapped"
  57. End If
  58. End If
  59. Next
  60. End Sub
  61. '////////////////////////////////////////////////////////////////////////////////////
  62. '
  63. ' Function name:
  64. '
  65. ' mapComponents
  66. '
  67. ' Function description:
  68. '
  69. ' This function maps components using componentFlagArray
  70. '
  71. ' Arguments:
  72. '
  73. ' oDependencies -- Dependency collection
  74. ' componentFlagArray -- an array of flags that indicate which component
  75. ' is mapped
  76. '
  77. '///////////////////////////////////////////////////////////////////////////////////
  78. Sub mapComponents(oDependencies, componentFlagArray)
  79. Dim strComponentVIGUID
  80. Dim iclass
  81. Dim iMinRevision
  82. Dim iType
  83. Dim i
  84. ' add the mapped components to the dependencies collection
  85. For i = 0 To (g_nComponents - 1)
  86. If componentFlagArray(i) Then
  87. strComponentVIGUID = g_componentTuples(i).strComponentVIGUID
  88. iclass = g_componentTuples(i).enumClass
  89. iType = g_componentTuples(i).enumType
  90. iMinRevision = g_componentTuples(i).enumMinRevision
  91. TraceState " Add dependency of ", strComponentVIGUID
  92. oDependencies.Add iclass, iType, strComponentVIGUID, iMinRevision
  93. End If
  94. Next
  95. End Sub
  96. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  97. '
  98. ' These are cmi event handlers
  99. '
  100. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  101. Function cmiOnAddInstance()
  102. TraceEnter "PrinterProto::cmiOnAddInstance"
  103. TraceState "PrinterProto::cmiThis.Comment", cmiThis.Comment
  104. ' must call this method to populate the instance
  105. cmiOnAddInstance = cmiSuper.cmiOnAddInstance
  106. initializeTables ' safe to call it more than once
  107. Dim componentFlagArray()
  108. ReDim componentFlagArray(g_nComponents - 1)
  109. ' initialize componentFlagArray
  110. initComponentFlagArray componentFlagArray
  111. If Not isValid(componentFlagArray) Then
  112. cmiOnAddInstance = False
  113. Exit Function
  114. End If
  115. ' fill componentFlagArray
  116. fillComponentFlagArray cmiThis.Resources, componentFlagArray
  117. ' map all the components
  118. mapComponents cmiThis.Dependencies, componentFlagArray
  119. cmiOnAddInstance = True
  120. TraceLeave "PrinterProto::cmiOnAddInstance"
  121. End Function
  122. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''