joshiieeii Posted September 27, 2007 Share Posted September 27, 2007 Hey guys,So I am working on Vista deployments and Deployment 4 (also BDD 2007) and they do not handle the driver imports very well.Here are here the current issues I am attempting to resolve:Duplicate files/folders are present in the "Out of Box Drivers" folder -CompletedDuplicate entries are present in the "drivers.xml" file -CompletedThere is no way to easily manage the drivers and add them to drivergroupsI have successfully resolved the first two issues already (will post code soon, need to clean it up and make it pretty ), but I am running into a bit of trouble on the last one (mostly looking for ideas on how to deal with all this data, keep reading..). Drivergroups work like this: The GUID of the driver (taken from the drivers.xml file) is placed in DriverGroups.xml file under the respective driver group, right below the <Name>...</Name> tagsThe GUID is placed within <Driver>....</Driver> tags *See the Drivergroups.xml sampleSo for those of us who have not messed with Deployment 4 or the similiar BDD 2007 I will attempt to explain what I am trying to accomplish.Read the Drivergroups.xml and Drivers.xml filesUse the Name, Manufacturer, Version, Type and Platform data from each driver in Drivers.xmlFigure out how many Drivergroups there arePresent the drivers in a way that is easy to manipulate (I am envisioning have a list view and being able to right click multi selected items to groups and having the colors change accordingly.)Once the drivers are selected and added to a drivergroup, all the drivers' GUID's are added to their respective driver groupsKeep in mind that there could be hundreds possibly a thousand or so drivers to possibly sort through. Does anyone have any suggestions on how to effeciently manipulate this data? I am currently looking at using a Listview and enabling the right click to add the drivers to the groups.Here is a sample of the Drivers.xml:CODE<drivers> <driver guid="{302cf53a-719d-4849-a4b3-0fc1751057c6}" enable="True"> <Name>NVIDIA Display nvdm.inf 7.15.10.9746</Name> <Manufacturer>NVIDIA</Manufacturer> <Version>7.15.10.9746</Version> <Source>.\Out-of-box Drivers\Display\nvd 7.15.10.9746\nvdm.inf</Source> <Type>Display</Type> <Platform>x86</Platform> <OSVersion>6.0</OSVersion> <PNPId>PCI\VEN_10DE&DEV_00C8&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00C9&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00CC&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0098&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0099&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0297&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0298&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0299&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029A&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029B&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029D&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01C21028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_20031028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01D71028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01DC&SUBSYS_01C81028</PNPId> </driver> <driver guid="{8e05109c-bf13-40fb-b653-da98547e5e30}" enable="True"> <Name>NVIDIA Display nvdm.inf 7.15.10.9746</Name> <Manufacturer>NVIDIA</Manufacturer> <Version>7.15.10.9746</Version> <Source>.\Out-of-box Drivers\Display\nvd 7.15.10.9746 (1)\nvdm.inf</Source> <Type>Display</Type> <Platform>x86</Platform> <OSVersion>6.0</OSVersion> <PNPId>PCI\VEN_10DE&DEV_00C8&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00C9&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00CC&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0098&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0099&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0297&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0298&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0299&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029A&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029B&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029D&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01C21028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_20031028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01D71028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01DC&SUBSYS_01C81028</PNPId> </driver></drivers>Here is a sample of the DriverGroups.xml:CODE<drivergroups> <drivergroup guid="{23377cce-aea6-4cc9-acd8-cfc6ad6d3e09}"> <Name>All Drivers</Name> </drivergroup> <drivergroup guid="{a87db1a3-6d07-47c7-a9b3-c480a35df4c7}"> <Name>Test</Name> <Driver>{c489e7fe-0ac4-4a63-ab36-2eeb575589f4}</Driver> </drivergroup> <drivergroup guid="{d0f9b120-db45-4a6e-a8fe-8afd0aaae2a9}"> <Name>Test1</Name> <Driver>{c489e7fe-0ac4-4a63-ab36-2eeb575589f4}</Driver> </drivergroup> <drivergroup guid="{1f5b9951-7b7d-4d07-b85d-a7e9bf35e0a3}"> <Name>Test3</Name> <Driver>{1f5b9951-7b7d-4d07-b85d-a7e9bf35e0a3}</Driver> <Driver>{c489e7fe-0ac4-4a63-ab36-2eeb575589f4}</Driver> </drivergroup></drivergroups> Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 27, 2007 Share Posted September 27, 2007 (edited) Sounds like a job for eltorro's _XML_DOMWrapper.au3 UDF. Edit: Sorry, that doesn't really address your question about getting it into a GUI efficiently. Edited September 27, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 28, 2007 Share Posted September 28, 2007 (edited) As a first step, if this is read as a real xml file and not just parsed as text, your DriverGroups.xml file loads as valid XML, but Drivers.xml does not. The ampersands "&" in the PNPId fields must be escaped.expandcollapse popup<drivers> <driver guid="{302cf53a-719d-4849-a4b3-0fc1751057c6}" enable="True"> <Name>NVIDIA Display nvdm.inf 7.15.10.9746</Name> <Manufacturer>NVIDIA</Manufacturer> <Version>7.15.10.9746</Version> <Source>.\Out-of-box Drivers\Display\nvd 7.15.10.9746\nvdm.inf</Source> <Type>Display</Type> <Platform>x86</Platform> <OSVersion>6.0</OSVersion> <PNPId>PCI\VEN_10DE&DEV_00C8&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00C9&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00CC&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0098&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0099&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0297&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0298&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0299&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029A&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029B&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029D&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01C21028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_20031028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01D71028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01DC&SUBSYS_01C81028</PNPId> </driver> <driver guid="{8e05109c-bf13-40fb-b653-da98547e5e30}" enable="True"> <Name>NVIDIA Display nvdm.inf 7.15.10.9746</Name> <Manufacturer>NVIDIA</Manufacturer> <Version>7.15.10.9746</Version> <Source>.\Out-of-box Drivers\Display\nvd 7.15.10.9746 (1)\nvdm.inf</Source> <Type>Display</Type> <Platform>x86</Platform> <OSVersion>6.0</OSVersion> <PNPId>PCI\VEN_10DE&DEV_00C8&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00C9&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_00CC&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0098&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0099&SUBSYS_019C1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0297&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0298&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_0299&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029A&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029B&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_029D&SUBSYS_019B1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01C21028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D7&SUBSYS_20031028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01CC1028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01D8&SUBSYS_01D71028</PNPId> <PNPId>PCI\VEN_10DE&DEV_01DC&SUBSYS_01C81028</PNPId> </driver> </drivers>This will read it:#include <_XMLDOMWrapper.au3> #include <array.au3> $sDrvXml = "C:\Temp\Drivers.xml" $oDrvXml = _XMLFileOpen ($sDrvXml) If Not IsObj($oDrvXml) Then ConsoleWrite("Debug: Error opening file: $oDrvXml = " & $oDrvXml & @LF) Exit EndIf $avFields = _XMLGetValue("/drivers/driver/PNPId") _ArrayDisplay($avFields, "Debug: $avFields") $oDrvXml = "" Edit: Added example with entity references, and sample code to read them. Edited September 28, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
joshiieeii Posted September 28, 2007 Author Share Posted September 28, 2007 Hmm... I will give this a try, but not sure it will do what I need it to do. Thanks for the reply! Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
joshiieeii Posted September 28, 2007 Author Share Posted September 28, 2007 (edited) Thanks PsaltyDS!! This helps immensely when pulling specifics from the xml's. You rock! AutoIT roxors! Now I can easily get arrays with the values I am looking for. It should be easier from this point on, wish me luck. Edit: Question: How would I pull the Driver GUID (it doesn't appear to follow the convention for the others)? <driver guid="{302cf53a-719d-4849-a4b3-0fc1751057c6}" enable="True"> Edited September 28, 2007 by joshiieeii Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 28, 2007 Share Posted September 28, 2007 Thanks PsaltyDS!! This helps immensely when pulling specifics from the xml's. You rock! AutoIT roxors! Now I can easily get arrays with the values I am looking for. It should be easier from this point on, wish me luck. Edit: Question: How would I pull the Driver GUID (it doesn't appear to follow the convention for the others)? <driver guid="{302cf53a-719d-4849-a4b3-0fc1751057c6}" enable="True"> The way those are listed inside driver node's tag means they are 'Attributes'. Look at _XMLGetAttrib() in the _XMLDOMWrapper.au3 UDF. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
joshiieeii Posted September 28, 2007 Author Share Posted September 28, 2007 (edited) So I tried this and it doesn't return an array, it only returns one value if I use a msgbox. $avFields = _XMLGetAttrib ("//drivers/*", "guid") Edit: Found this code and it seems to work: Func Main() Local $szXPath, $aNodeName, $find, $ns, $oXSD,$iNodeCount,$aAttrName[1],$aAttrVal[1],$ret_val $xmlFile = "C:\Documents and Settings\jmascote\My Documents\!!AUTOIT Scripts\BDD2007\Drivers.xml" $ns = "" $oXSD = _XMLFileOpen ($xmlFile, $ns) If @error Or $oXSD < 1 Then MsgBox(0, "Error", "There was an error opening the file " & $xmlFile) $oXSD = 0 Exit EndIf $szXPath = "//drivers" $iNodeCount = _XMLGetNodeCount($szXPath & "/*") MsgBox(0,"Node Count",$iNodeCount) $aNodeName = _XMLGetChildNodes ($szXPath); get a list of node names under this path If $aNodeName <> - 1 Then For $find = 1 To $aNodeName[0] ConsoleWrite($aNodeName[$find]& '[' & $find & ']'&@LF) ;It's better to use node index instead of node name as all node here have same name. _XMLGetAllAttrib($szXPath & "/*" & '[' & $find & ']',$aAttrName,$aAttrVal) _ArrayDisplay($aAttrName,$szXPath & "/*" & '[' & $find & ']') _ArrayDisplay($aAttrVal,$szXPath & "/*" & '[' & $find & ']') Next MsgBox(266288,"_XMLWrapper","Done") Else MsgBox(0, "Error:", "No nodes found for " & $szXPath) EndIf $oXSD = 0 EndFunc;==>Main Edited September 28, 2007 by joshiieeii Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 28, 2007 Share Posted September 28, 2007 Edit:Found this code and it seems to work:Nice. You're right, index makes more sense. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now