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.

585 lines
38 KiB

  1. ��<?xml version="1.0"?>
  2. <!--//////////////////////////////////////////////////////////////////////-->
  3. <!-- $Header:$ -->
  4. <!-- Printer Device Class Prototype SLD File -->
  5. <!-- Version: 1.20 -->
  6. <!-- Author: sjang -->
  7. <!-- Copyright (c) 1999-2000 Microsoft Corp. All Rights Reserved. -->
  8. <!--//////////////////////////////////////////////////////////////////////-->
  9. <!DOCTYPE DCARRIER SYSTEM "mantis.dtd"
  10. [
  11. <!-- RegKey registry types (map to REG_SZ etc) -->
  12. <!ENTITY RegTypeNone "0" >
  13. <!ENTITY RegTypeSz "1" >
  14. <!ENTITY RegTypeExpandSz "2" >
  15. <!ENTITY RegTypeBinary "3" >
  16. <!ENTITY RegTypeDword "4" >
  17. <!ENTITY RegTypeDwordBigEndian "5" >
  18. <!ENTITY RegTypeLink "6" >
  19. <!ENTITY RegTypeMultiSz "7" >
  20. <!ENTITY RegTypeResourceList "8" >
  21. <!ENTITY RegTypeFullResourceDescriptor "9" >
  22. <!ENTITY RegTypeResourceRequirementsList "10" >
  23. <!ENTITY RegTypeQword "11" >
  24. <!-- RegKey registry operations -->
  25. <!ENTITY RegOpWrite "1" >
  26. <!ENTITY RegOpDelete "2" >
  27. <!ENTITY RegOpEdit "3" >
  28. <!-- RegKey registry conditionals -->
  29. <!ENTITY RegCondAlways "1" >
  30. <!ENTITY RegCondIfExists "2" >
  31. <!ENTITY RegCondIfNotExists "3" >
  32. <!-- Build types (single bit integer) -->
  33. <!ENTITY BuildFree "16" >
  34. <!ENTITY BuildChecked "256" >
  35. <!-- Miscellaneous -->
  36. <!ENTITY ZeroGUID "{00000000-0000-0000-0000-000000000000}" >
  37. <!ENTITY DevClassRev "1" >
  38. <!ENTITY Win2000eVer "5.01" >
  39. ]>
  40. <DCARRIER CarrierRevision="1">
  41. <!--//////////////////////////////////////////////////////////////////////-->
  42. <!-- Printer device class prototype component -->
  43. <!-- -->
  44. <!-- All Printer device components inherit from this prototype -->
  45. <!-- component. You can have common functionalities for a specific -->
  46. <!-- device install class in this SLD, such as configuration DHTML -->
  47. <!-- script or a special build script for the device class. -->
  48. <!-- -->
  49. <COMPONENT
  50. ComponentVSGUID="{FC86EC6B-3790-4774-B22B-F53FB654BD23}"
  51. ComponentVIGUID="{4816DA36-46A5-477e-9B9A-BE020527DB31}"
  52. PlatformGUID="{B784E719-C196-4DDB-B358-D9254426C38D}"
  53. RepositoryVSGUID="{8E0BE9ED-7649-47f3-810B-232D36C430B4}"
  54. Revision="&DevClassRev;"
  55. Visibility="1000"
  56. MultiInstance="True"
  57. Released="True"
  58. Editable="True"
  59. HTMLFinal="False"
  60. >
  61. <SCRIPTTEXT language="vbscript" src="Win2000ePlatform.vbs">
  62. <![CDATA[
  63. '////////////////////////////////////////////////////////////////////////////
  64. '
  65. ' Copyright (c) 1999-2000 Microsoft Corp. All Rights Reserved.
  66. '
  67. ' File name:
  68. '
  69. ' lib.vbs
  70. '
  71. ' Abstract:
  72. '
  73. ' Windows Embedded Prototype Script for Printers
  74. '
  75. ' Remarks:
  76. '
  77. ' This file encapsulates dependency mapping functionality. When a target
  78. ' designer user adds a printer driver component, this script examines the
  79. ' resource in the printer driver component and maps it to another component.
  80. ' For example, if a driver uses pscript5.dll, it must be a postscript
  81. ' printer, and it shall have the dependency for core postscript driver
  82. ' component.
  83. '
  84. ' In order to do this, we have the mapIt function. mapIt needs an array of
  85. ' booleans that indicate whether a component is mapped or not. It works this
  86. ' way, first the client should go through all the resources and populate the
  87. ' componentFlagArray and then it should add the dependencies according to
  88. ' this array. To do it this way we remove the duplicate dependencies and we
  89. ' decouple the logic of selecting mapped dependent components and the logic
  90. ' of adding dependencies.
  91. '
  92. ' Right now we have only three components, aka Core PostScript, Core Unidrv,
  93. ' and Core Plotter. Eventually we going to expand it so that every section
  94. ' in ntprint.inf, such as section [CNBJ], should be a separate component and
  95. ' should be mapped in this script.
  96. '
  97. ' Author:
  98. '
  99. ' Larry Zhu (lzhu) 11-29-2000
  100. '
  101. '////////////////////////////////////////////////////////////////////////////
  102. Option Explicit
  103. ' define a component type
  104. Class ComponentType
  105. Public nComponentID ' This is a zero based index and id
  106. Public strComponentVIGUID ' VI GUID of this component
  107. Public enumClass
  108. Public enumType
  109. Public enumMinRevision
  110. End Class
  111. ' define a tuple that maps a file to a component
  112. Class PrinterFilesMappingTuple
  113. Public strFileName
  114. Public nComponentID
  115. End Class
  116. '//////////////////////////////////////////////////////////////////////////////////
  117. '
  118. ' define the tables to store the mapping relations
  119. '
  120. '/////////////////////////////////////////////////////////////////////////////////
  121. ' define the table of components
  122. Public g_componentTuples()
  123. ReDim g_componentTuples(10) ' No need to increase this number
  124. Public g_nComponents: g_nComponents = 0 ' Num of components
  125. ' define the table of mappings
  126. Public g_printerFilesMappingTuples()
  127. ReDim g_printerFilesMappingTuples(20) ' No need to increase this number
  128. Public g_nTableEntries: g_nTableEntries = 0 ' Num of table entries
  129. ' whether the tables above are initialized
  130. Public g_bAreTablesInitialized: g_bAreTablesInitialized = False
  131. '////////////////////////////////////////////////////////////////////////////////////
  132. '
  133. ' Function name:
  134. '
  135. ' addTuple
  136. '
  137. ' Function description:
  138. '
  139. ' This subroutine adds one mapping tuple at a time and updates the mapping
  140. ' table in g_printerFilesMappingTuples
  141. '
  142. ' Arguments:
  143. '
  144. ' strFileName -- the file to be mapped
  145. ' nComponent -- the component ID
  146. '
  147. '//////////////////////////////////////////////////////////////////////////////////
  148. Sub addTuple(strFileName, nComponentID)
  149. '
  150. ' ReDim is expensive, to avoid excessive redim we double the array size when
  151. ' the table is not large enough
  152. '
  153. If (UBound(g_printerFilesMappingTuples) < g_nTableEntries) Then
  154. ReDim Preserve g_printerFilesMappingTuples(2*UBound(g_printerFilesMappingTuples))
  155. End If
  156. Set g_printerFilesMappingTuples(g_nTableEntries) = New PrinterFilesMappingTuple
  157. g_printerFilesMappingTuples(g_nTableEntries).strFileName = strFileName
  158. g_printerFilesMappingTuples(g_nTableEntries).nComponentID = nComponentID
  159. g_nTableEntries = g_nTableEntries + 1
  160. End Sub
  161. '////////////////////////////////////////////////////////////////////////////////////
  162. '
  163. ' Function name:
  164. '
  165. ' addComponent
  166. '
  167. ' Function description:
  168. '
  169. ' This sub adds one component at a time to the component table
  170. ' g_componentTuples and it increments the number of component
  171. ' g_nComponents.
  172. '
  173. ' Arguments:
  174. '
  175. ' enumClass -- the component class
  176. ' enumType -- the component type
  177. ' strComponentVIGUID -- the VI GUID for the component
  178. ' enumMinRevision -- the minimum revision for the component
  179. '
  180. ' Return value:
  181. '
  182. ' The component ID for the component just added
  183. '
  184. '//////////////////////////////////////////////////////////////////////////////////
  185. Function addComponent(enumClass, enumType, strComponentVIGUID, enumMinRevision)
  186. Dim oneComponent: Set oneComponent = New ComponentType
  187. oneComponent.nComponentID = g_nComponents
  188. oneComponent.enumClass = enumClass
  189. oneComponent.enumType = enumType
  190. oneComponent.strComponentVIGUID = strComponentVIGUID
  191. oneComponent.enumMinRevision = enumMinRevision
  192. '
  193. ' add one more element into component table
  194. '
  195. '
  196. ' ReDim is expensive, to avoid excessive redim we double the array size
  197. ' when the table is not large enough
  198. '
  199. If (UBound(g_componentTuples) < g_nComponents) Then
  200. ReDim Preserve g_componentTuples(2*UBound(g_componentTuples))
  201. End If
  202. Set g_componentTuples(g_nComponents) = oneComponent
  203. g_nComponents = g_nComponents + 1
  204. addComponent = oneComponent.nComponentID
  205. End Function
  206. '////////////////////////////////////////////////////////////////////////////////////
  207. '
  208. ' Function name:
  209. '
  210. ' InitializeTables
  211. '
  212. ' Function description:
  213. '
  214. ' This function initializes the tables of mapping tuples and the table of
  215. ' components which are stored in g_printerFilesMappingTuples and
  216. ' g_componentTuples respectively. It is safe to call this sub more than
  217. ' once.
  218. '
  219. ' Arguments:
  220. '
  221. ' None
  222. '
  223. '//////////////////////////////////////////////////////////////////////////////////
  224. Sub InitializeTables()
  225. ' make sure this routine is executed only once
  226. If g_bAreTablesInitialized Then Exit Sub
  227. g_bAreTablesInitialized = True
  228. Dim strComponentVIGUID, enumMinRevision
  229. '////////////////////////////////////////////////////////////////////////////
  230. '
  231. ' Printer Components
  232. '
  233. ' Remark: This part needs to be manually updated
  234. '
  235. '////////////////////////////////////////////////////////////////////////////
  236. ' Core PostScript Component
  237. Dim corePS_ID
  238. strComponentVIGUID = "{C32DA828-9D90-4311-8FC5-AEFC65FAE2D3}"
  239. enumMinRevision = 1
  240. corePS_ID = addComponent(cmiInclude, cmiExactlyOne, strComponentVIGUID, enumMinRevision)
  241. ' Core Unidrv Component
  242. Dim coreUnidrv_ID
  243. strComponentVIGUID = "{7EC3F69D-1DA9-4C8C-8F76-FA28E5531454}"
  244. enumMinRevision = 1
  245. coreUnidrv_ID = addComponent(cmiInclude, cmiExactlyOne, strComponentVIGUID, enumMinRevision)
  246. ' Core Plotter Component
  247. Dim corePlotter_ID
  248. strComponentVIGUID = "{6DC05E80-59AF-4557-9904-79112273CE27}"
  249. enumMinRevision = 1
  250. corePlotter_ID = addComponent(cmiInclude, cmiExactlyOne, strComponentVIGUID, enumMinRevision)
  251. '////////////////////////////////////////////////////////////////////////////
  252. '
  253. ' Add the mapping table
  254. '
  255. '////////////////////////////////////////////////////////////////////////////
  256. ' mapping for PostScript
  257. addTuple "pscript5.dll", corePS_ID
  258. addTuple "ps5ui.dll", corePS_ID
  259. ' mapping for UniDrv
  260. addTuple "unidrvui.dll", coreUnidrv_ID
  261. addTuple "unidrv.dll", coreUnidrv_ID
  262. ' mapping for plotter
  263. addTuple "plotter.dll", corePlotter_ID
  264. addTuple "plotui.dll", corePlotter_ID
  265. End Sub
  266. '////////////////////////////////////////////////////////////////////////////////////
  267. '
  268. ' Function name:
  269. '
  270. ' isValid
  271. '
  272. ' Function description:
  273. '
  274. ' This function checks whether the componentFlagArray has exactly one elment for each
  275. ' compenent.
  276. '
  277. ' Arguments:
  278. '
  279. ' componentFlagArray -- an array of flags that indicate which component
  280. ' is mapped
  281. '
  282. ' Return value
  283. '
  284. ' True if componentFlagArray has exactly one element for each component
  285. '
  286. '///////////////////////////////////////////////////////////////////////////////////
  287. Function isValid(componentFlagArray)
  288. If (Not UBound(componentFlagArray) = (g_nComponents - 1)) Or (Not g_bAreTablesInitialized) Then
  289. isValid = False
  290. Exit Function
  291. End If
  292. isValid = True
  293. End Function
  294. '////////////////////////////////////////////////////////////////////////////////////
  295. '
  296. ' Function name:
  297. '
  298. ' mapIt
  299. '
  300. ' Function description:
  301. '
  302. ' This function fills the componentFlagArry, which must be an array of
  303. ' booleans in componentFlagArry with number of elements equal to the number of components
  304. ' in componentTuples
  305. '
  306. ' Example usage:
  307. '
  308. ' Dim componentFlagArray()
  309. ' Dim componentFlagArray(g_nComponentIndex)
  310. '
  311. ' ' initialize this array to have all vlaues False if you prefer to
  312. '
  313. ' If Not isValid(componentFlagArray) Then
  314. ' < your function name > = False
  315. ' Exit Function
  316. ' End If
  317. '
  318. ' call mapIt(strFileName, componentFlagArray)
  319. '
  320. ' Arguments:
  321. '
  322. ' strFileName -- the name of dependent file
  323. ' componentFlagArray -- an array of flags that indicate which component
  324. ' is mapped
  325. '
  326. ' Return value
  327. '
  328. ' True if strFileName is mapped to a component, False otherwise
  329. '
  330. '///////////////////////////////////////////////////////////////////////////////////
  331. Function mapIt(strFileName, componentFlagArray())
  332. mapIt = False
  333. Dim i
  334. For i = 0 To (g_nTableEntries - 1)
  335. If 0 = StrComp(strFileName, g_printerFilesMappingTuples(i).strFileName, 1) Then
  336. componentFlagArray(g_printerFilesMappingTuples(i).nComponentID) = True
  337. mapIt = True
  338. Exit Function
  339. End If
  340. Next
  341. End Function
  342. '////////////////////////////////////////////////////////////////////////////////////
  343. '
  344. ' Function name:
  345. '
  346. ' initComponentFlagArray
  347. '
  348. ' Function description:
  349. '
  350. ' This function initializes componentFlagArray
  351. '
  352. ' Arguments:
  353. '
  354. ' componentFlagArray -- an array of flags that indicate which component
  355. ' is mapped
  356. '
  357. '///////////////////////////////////////////////////////////////////////////////////
  358. Sub initComponentFlagArray(componentFlagArray)
  359. Dim i
  360. For i = 0 To UBound(componentFlagArray)
  361. componentFlagArray(i) = False
  362. Next
  363. End Sub
  364. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  365. '////////////////////////////////////////////////////////////////////////////
  366. '
  367. ' Copyright (c) 1999-2000 Microsoft Corp. All Rights Reserved.
  368. '
  369. ' File name:
  370. '
  371. ' cmi.vbs
  372. '
  373. ' Abstract:
  374. '
  375. ' Windows Embedded Prototype Script for Printers
  376. '
  377. ' Remarks:
  378. '
  379. ' CMI helper functions and event handlers.
  380. '
  381. ' Author:
  382. '
  383. ' Larry Zhu (lzhu) 12-25-2000
  384. '
  385. '////////////////////////////////////////////////////////////////////////////
  386. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  387. '
  388. ' Cmi helper functions
  389. '
  390. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  391. '////////////////////////////////////////////////////////////////////////////////////
  392. '
  393. ' Function name:
  394. '
  395. ' fillComponentFlagArray
  396. '
  397. ' Function description:
  398. '
  399. ' This function fills componentFlagArray
  400. '
  401. ' Arguments:
  402. '
  403. ' oResouces -- Resouces collection
  404. ' componentFlagArray -- an array of flags that indicate which component
  405. ' is mapped
  406. '
  407. '///////////////////////////////////////////////////////////////////////////////////
  408. Sub fillComponentFlagArray(oResources, componentFlagArray)
  409. Dim oRes
  410. Dim bMapped
  411. Dim strFileName
  412. ' get all the mapped components
  413. For Each oRes In oResources ' For each resource..
  414. If 0 = StrComp(oRes.Type.Name, "File", 1) Then
  415. strFileName = oRes.Properties("DstName")
  416. bMapped = mapIt(strFileName, componentFlagArray)
  417. If (bMapped) Then
  418. TraceState strFileName, " is mapped"
  419. Else
  420. TraceState strFileName, " is not mapped"
  421. End If
  422. End If
  423. Next
  424. End Sub
  425. '////////////////////////////////////////////////////////////////////////////////////
  426. '
  427. ' Function name:
  428. '
  429. ' mapComponents
  430. '
  431. ' Function description:
  432. '
  433. ' This function maps components using componentFlagArray
  434. '
  435. ' Arguments:
  436. '
  437. ' oDependencies -- Dependency collection
  438. ' componentFlagArray -- an array of flags that indicate which component
  439. ' is mapped
  440. '
  441. '///////////////////////////////////////////////////////////////////////////////////
  442. Sub mapComponents(oDependencies, componentFlagArray)
  443. Dim strComponentVIGUID
  444. Dim iclass
  445. Dim iMinRevision
  446. Dim iType
  447. Dim i
  448. ' add the mapped components to the dependencies collection
  449. For i = 0 To (g_nComponents - 1)
  450. If componentFlagArray(i) Then
  451. strComponentVIGUID = g_componentTuples(i).strComponentVIGUID
  452. iclass = g_componentTuples(i).enumClass
  453. iType = g_componentTuples(i).enumType
  454. iMinRevision = g_componentTuples(i).enumMinRevision
  455. TraceState " Add dependency of ", strComponentVIGUID
  456. oDependencies.Add iclass, iType, strComponentVIGUID, iMinRevision
  457. End If
  458. Next
  459. End Sub
  460. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  461. '
  462. ' These are cmi event handlers
  463. '
  464. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  465. Function cmiOnAddInstance()
  466. TraceEnter "PrinterProto::cmiOnAddInstance"
  467. TraceState "PrinterProto::cmiThis.Comment", cmiThis.Comment
  468. ' must call this method to populate the instance
  469. cmiOnAddInstance = cmiSuper.cmiOnAddInstance
  470. initializeTables ' safe to call it more than once
  471. Dim componentFlagArray()
  472. ReDim componentFlagArray(g_nComponents - 1)
  473. ' initialize componentFlagArray
  474. initComponentFlagArray componentFlagArray
  475. If Not isValid(componentFlagArray) Then
  476. cmiOnAddInstance = False
  477. Exit Function
  478. End If
  479. ' fill componentFlagArray
  480. fillComponentFlagArray cmiThis.Resources, componentFlagArray
  481. ' map all the components
  482. mapComponents cmiThis.Dependencies, componentFlagArray
  483. cmiOnAddInstance = True
  484. TraceLeave "PrinterProto::cmiOnAddInstance"
  485. End Function
  486. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  487. ]]>
  488. </SCRIPTTEXT>
  489. <!-- Standard Properties -->
  490. <DISPLAYNAME>Printer device class prototype component</DISPLAYNAME>
  491. <VERSION>&Win2000eVer;</VERSION>
  492. <DESCRIPTION>Printer device class prototype component</DESCRIPTION>
  493. <COPYRIGHT>Copyright (c) 2000 Microsoft Corp. All Rights Reserved.</COPYRIGHT>
  494. <VENDOR>Microsoft</VENDOR>
  495. <OWNERS>sjang</OWNERS>
  496. <AUTHORS>sjang</AUTHORS>
  497. <DATECREATED>10/17/2000</DATECREATED>
  498. <DATEREVISED>10/17/2000</DATEREVISED>
  499. <GROUPMEMBER GroupVSGUID="{D7523171-4196-45c3-BA4A-46ECD881D49B}"/>
  500. <GROUPMEMBER GroupVSGUID="{E01B4103-3883-4fe8-992F-10566E7B796C}"/>
  501. </COMPONENT>
  502. </DCARRIER>