<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[DriverPacks.net Forum - Script to create the MSD section for a given extracted MassStorage DP]]></title>
		<link>http://forum.driverpacks.net/viewtopic.php?id=3819</link>
		<description><![CDATA[The most recent posts in Script to create the MSD section for a given extracted MassStorage DP.]]></description>
		<lastBuildDate>Sat, 20 Jun 2009 12:05:51 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Script to create the MSD section for a given extracted MassStorage DP]]></title>
			<link>http://forum.driverpacks.net/viewtopic.php?pid=31929#p31929</link>
			<description><![CDATA[<p>Carsten Giese, Lead Technical Architect at Symantec, sent me the following script via <a href="http://driverpacks.net/contacturl">the contact form</a>. I hope some of you can use it <img src="http://forum.driverpacks.net/img/smilies/smile.png" width="15" height="15" alt="smile" /> Thanks Carsten!</p><div class="quotebox"><cite>Carsten Giese wrote:</cite><blockquote><p>Hello, driverpack-team,<br />I have written a nice sysprep.inf-creator to create the MSD-section with a given extracted MSD-driverpack.<br />You may distribute the script &quot;as it is&quot; on your download-area.</p><p>The script does not need a sysprep-environment.<br />You just have to run on top of an extracted DriverPack MassStorage and it will create the output file.</p><p>Here is the code of <strong>indexMSDs.vbs</strong>:<br /></p><div class="codebox"><pre><code>&#039;24.03.2009, carsten_giese@symantec.com
&#039;This script creates an index of all supported devices found in a driver-library and writes it into &quot;sysprep_MSD.inf&quot;
&#039;The inf-file can be used to add the required lines into sysprep.inf of the master-Image

Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set WsShell = Wscript.CreateObject(&quot;WScript.Shell&quot;)
scriptpath = fso.GetFile(wscript.ScriptFullName).ParentFolder

&#039;Create busy-file
set handle = fso.OpenTextFile(scriptpath &amp; &quot;\busy&quot;,2,true)
handle.WriteLine input
handle.Close

dim line
set inf = fso.OpenTextFile(scriptpath &amp; &quot;\sysprep_MSD.inf&quot;,2,true)
rootfolder=scriptpath &amp; &quot;\&quot;
getFolderContent (rootfolder)
inf.close

fso.DeleteFile(scriptpath &amp; &quot;\busy&quot;)

&#039;--------------------------------------------
Function GetFolderContent(Directory)
	&#039;on error resume next &#039;if permission denied
	Dim fso, folder, filename,section,component,section2,component2
	dim pnpcache,pnpid,typ,ven,dev,sys,rev,oempath
	Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set folder = fso.GetFolder(Directory)
	oempath=lcase(right(directory,len(directory)-len(rootfolder)))
	For Each file In folder.Files
		filename = lcase(file.name)
		if right(filename,4)=&quot;.inf&quot; then
			line=getFileContent(directory &amp; file.name)
			manufacturer=&quot;&quot;
			lastdevice=&quot;&quot;
			pnpsection=0
			pnpcache=&quot;,&quot;
			for i=0 to ubound(line)
				comment=instr(line(i),&quot;;&quot;)
				if comment&gt;0 then line(i)=left(line(i),comment-1)
				if manufacturer=&quot;&quot; then
					if instr(line(i),&quot;[manufacturer]&quot;)&gt;0 then
						i=i+1
						section=split(line(i),&quot;=&quot;)
						component=split(section(1),&quot;,&quot;)
						manufacturer=trim(component(0))
						m1=&quot;[&quot; &amp; manufacturer &amp; &quot;]&quot;
						m2=&quot;[&quot; &amp; manufacturer &amp; &quot;.&quot;
					end if
				else &#039;manufacturer &lt;&gt; &quot;&quot;
					if left(line(i),1)=&quot;[&quot; then &#039;new inf-section
						pnpsection=instr(line(i),m1) + instr(line(i),m2) &#039;PNP-section found
					elseif pnpsection&gt;0 then
						&#039;get PnPID from this line
						if instr(line(i),&quot;=&quot;)&gt;0 then
							section2=split(line(i),&quot;=&quot;)
							component2=split(section2(1),&quot;,&quot;)
							for device=1 to ubound(component2)
								pnpid=ucase(component2(device))
								pnpid=trim(replace(pnpid,vbTab,&quot;&quot;))
								if instr(pnpcache,&quot;,&quot; &amp; pnpid &amp; &quot;,&quot;)=0 then
									devicename = getDeviceName(section2(0))
									inf.writeline pnpid &amp; &quot;=c:\drv\&quot; &amp; oempath &amp; filename &amp; devicename
									pnpcache = pnpcache &amp; pnpid &amp; &quot;,&quot;
								end if
							next
						end if
					end if
				end if
			next
			inf.writeline
		end if
	Next

	For Each foldername in folder.SubFolders
		GetFoldercontent(Directory &amp; foldername.name &amp; &quot;\&quot;)
	Next

	Set fso = nothing
	Set folder = nothing
End Function

function getFileContent(file)
	dim f,stream,cache
	set f = fso.GetFile(file)
	set stream = f.OpenAsTextStream(1,0)
	cache = stream.Read(f.Size)
	stream.close
	if instr(cache,&quot;[Manufacturer]&quot;)=0 then cache=&quot;&quot;
	getFileContent = split(lcase(cache),vbCrLf)
	set f = nothing
	set stream = nothing
end function

function getDeviceName(str)
	dim i,l,s1,s2,stringsection
	str=trim(replace(str,vbTab,&quot;&quot;))
	if instr(str,&quot;%&quot;)&gt;0 then
		str=replace(str,&quot;%&quot;,&quot;&quot;)
		s1=&quot;[strings]&quot;
		s2=&quot;[strings.&quot;
		for i=0 to ubound(line)
			if left(line(i),1)=&quot;[&quot; then
				stringsection=instr(line(i),s1) + instr(line(i),s2)
			elseif stringsection&gt;0 then
				if instr(line(i),str)&gt;0 then
					l=line(i)
					str=trim(split(l,&quot;=&quot;)(1))
				end if
			end if
		next
	end if
	getDeviceName=&quot; ; &quot; &amp; replace(ucase(str),&quot;&quot;&quot;&quot;,&quot;&quot;)
end function</code></pre></div><p>Which results in an output file (<strong>sysprep_MSD.inf</strong>) like this:</p><div class="codebox"><pre><code>PCI\VEN_13C1&amp;DEV_1002&amp;SUBSYS_100213C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9500S SATA RAID CONTROLLER
PCI\VEN_13C1&amp;DEV_1003&amp;SUBSYS_100313C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9550SX/9590SE SATA RAID CONTROLLER
PCI\VEN_13C1&amp;DEV_1004&amp;SUBSYS_100413C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9650SE SATA RAID CONTROLLER
PCI\VEN_13C1&amp;DEV_1004&amp;SUBSYS_100513C1=c:\drv\m\3\3waredrv.inf ; AMCC 3WARE 9690SE SATA/SAS RAID CONTROLLER
SCSI\PROCESSOR__AMCC__SATA_RAID_9500S_=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9500S MANAGER
SCSI\PROCESSOR__AMCC__SATA_RAID_9550SX=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9550SX/9590SE MANAGER
SCSI\PROCESSOR__AMCC__SATA_RAID_9650SE=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9650SE MANAGER
SCSI\PROCESSOR__AMCC__SATA_RAID_9690SA=c:\drv\m\3\3wmanage.inf ; AMCC SATA RAID 9690SA MANAGER
&lt;snip&gt;
PCI\VEN_1106&amp;DEV_3164&amp;CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 3164
PCI\VEN_1106&amp;DEV_0581&amp;CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 0581	
PCI\VEN_1106&amp;DEV_5324&amp;CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - 5324
PCI\VEN_1106&amp;DEV_C409&amp;CC_0101=c:\drv\m\v3\vminiide.inf ; VIA BUS MASTER IDE CONTROLLER - C409
PCI\VEN_104B&amp;DEV_1040=c:\drv\m\vm\vmscsi.inf ; VMWARE SCSI CONTROLLER</code></pre></div></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (Wim Leers)]]></author>
			<pubDate>Sat, 20 Jun 2009 12:05:51 +0000</pubDate>
			<guid>http://forum.driverpacks.net/viewtopic.php?pid=31929#p31929</guid>
		</item>
	</channel>
</rss>
