dlevens Posted January 3, 2005 Posted January 3, 2005 I am in the process of adding the feature to copy i386 from my unattended CD to my hard drive. I read all the posts on the topic and found two solutions that seem the best to try. Gosh Method is to use an xcopy script to copy the filesJazkal Method is to put a second copy of i386 in the $OEM$\$1 folder and use the -o switch with cdimage so as not to suffer from duplicates on your CD.My problem is adding the source location in the registry so that Windows knows where to go when it needs source files. Currently this registry file works great but it is not very flexible since I am forced to C: instead of using variables. I tried replacing the C: with %SystemDrive% but then the registy shows exactly that "%SystemDrive%" and when I try to install anything that needs the CD you get the prompt asking for the CD and the default location is %SystemDrive%. How can I get this to work?WORKINGWindows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]"Installation Sources"=hex(7):43,00,3a,00,5c,00,49,00,33,00,38,00,36,00,00,00,\ 00,00"SourcePath"="C:""ServicePackSourcePath"="C:"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]"SourcePath"="C:\\I386"NOT WORKINGWindows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]"Installation Sources"=hex(7):43,00,3a,00,5c,00,49,00,33,00,38,00,36,00,00,00,\ 00,00"SourcePath"="%SystemDrive%""ServicePackSourcePath"="%SystemDrive%"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]"SourcePath"="%SystemDrive%\\I386"
Bâshrat the Sneaky Posted January 3, 2005 Posted January 3, 2005 It's impossible to use system variables in the registry or in inf/hive files. That's a common known fact. It's just if you don't know it The solution to fix this is in most cases to run a batch file that adds the specific settings to the registry, using these system variables in the command. The commandline interpreter will replace it by the 'real' value.
pinout Posted January 3, 2005 Posted January 3, 2005 You actually can use environment variables in the registry. Make the registry value have a type of REG_EXPAND_SZ. Can't do that with REGEDIT.EXE but you can with REGEDT32.EXE. As far as doing it with REG or INF files, you can do it with REG files but its less than desirable considering it shows up as hex and isn't exactly human readable. That's why I prefer to use INF's if I have to use an environment variable.Example:HKCR,"CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}","LocalizedString",0x00020000,"%USERNAME% / %COMPUTERNAME%"0x00020000 is REG_EXPAND_SZThis will store, literally, "%USERNAME%" and "%COMPUTERNAME%" and won't expand them until they are actually used.And if you were wondering, that entry I used as an example will display the current username and computername as the text for the "My Computer" icon rather than just saying "My Computer"Hope this helps.
Yzöwl Posted January 3, 2005 Posted January 3, 2005 You can achieve what you are after in a couple of ways:Add this to your .cmd file (as Bâshrat the Sneaky stated):REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" /t REG_MULTI_SZ /d "%SystemDrive%\I386" /fREG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v SourcePath /t REG_SZ /d "%SystemDrive%" /fREG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v ServicePackSourcePath /t REG_SZ /d "%SystemDrive%" /fREG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v SourcePath /t REG_SZ /d "%SystemDrive%\I386" /fAlternatively, (contrary to what Bâshrat the Sneaky said), use an inf:[Version]Signature=$CHICAGO$[DefaultInstall]AddReg = Reg.Settings[Reg.Settings]HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,"Installation Sources",0x10000,"%24%\I386"HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,SourcePath,,"%24%"HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,ServicePackSourcePath,,"%24%"HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion,SourcePath,,"%24%\I386"I suppose for the Installation Sources key, you could forget about the "%SysyemDrive%\I386" bit, and because it's a MULTI_SZ value, put something like this in instead "C:\I386,D:\I386,E:\I386,F:\I386,G:\I386,H:\I386", you would then cover your hard disk and optical drives too!
dlevens Posted January 3, 2005 Author Posted January 3, 2005 Great info guys,You both beat me back to this post, after the command line suggestion I worked out the same code pretty much. Here is what I was about to post as using in my cmd filereg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" /t REG_MULTI_SZ /d "%SystemDrive%\Support\i386" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v SourcePath /d %SystemDrive%\Support /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup" /v ServicePackSourcePath /d %SystemDrive%\Support /freg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v SourcePath /d %SystemDrive%\Support\I386 /fGood to know also about REG_EXPAND_SZ, I was not aware that you could use variables as long as you use REG_EXPAND_SZSo if I wanted to use REG_EXPAND_SZ in my reg file I would not be able to import it using regedit /s ? How would I do an expandable multi value like Installation Sources?It does seem the simplest method is the 4 reg add lines pasted above and just add them to the install.cmd that kicks off all my stuff. EDITdid a test by creating registry entries using REG_EXPAND_SZ with a value of %SystemDrive%\Support but this did not work. I was asked for the CD and the path still was looking for %SystemDrive%\Support so it was never converted.Not that I need to learn this method since adding the 4 lines to cmd file works but I must be doing something wrong getting the REG_EXPAND_SZ working.Dennis
Yzöwl Posted January 3, 2005 Posted January 3, 2005 In a reg file, if you were wanting to use the REG_EXPAND_SZ method, your reg would start to look something like this:Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]"Installation Sources"=hex(7):43,00,3a,00,5c,00,49,00,33,00,38,00,36,00,00,00,\00,00;REG_MULTI_SZ (C:\I386)"SourcePath"=hex(2):25,53,79,73,74,65,6d,44,72,69,76,65,25,00;REG_EXPAND_SZ (%SystemDrive%)"ServicePackSourcePath"=hex(2):25,53,79,73,74,65,6d,44,72,69,76,65,25,00;REG_EXPAND_SZ (%SystemDrive%)i.e you would need your variables in hex format....
Bâshrat the Sneaky Posted January 4, 2005 Posted January 4, 2005 Thank you guys! You can see it's been a while... I only had very limited time so I focused on the Device Drivers forum only...Thanks again! Really didn't know these things...
dlevens Posted January 5, 2005 Author Posted January 5, 2005 I made this reg file using binary data but it still wont work. The paths are correct in the registry (I think?)reg fileWindows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]"Installation Sources"=hex(7):43,00,3a,00,5c,00,53,00,75,00,70,00,70,00,6f,00,\ 72,00,74,00,5c,00,69,00,33,00,38,00,36,00,00,00,00,00"SourcePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,44,00,72,00,69,\ 00,76,00,65,00,25,00,5c,00,53,00,75,00,70,00,70,00,6f,00,72,00,74,00,00,00"ServicePackSourcePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,44,00,\ 72,00,69,00,76,00,65,00,25,00,5c,00,53,00,75,00,70,00,70,00,6f,00,72,00,74,\ 00,00,00Here is what the reg looks likeDennis
Yzöwl Posted January 5, 2005 Posted January 5, 2005 Did you create the keys in the registry editor, and export them out, then find that the reg wouldn't import?or are you telling us that a REG_EXPAND_SZ key is not working for the SourcePath entries.I doubt that you can just blindly change all REG_SZ entries for REG_EXPAND_SZ and expect them to work!Stick with the CMD or INF methodsThis would be the INF to match your CMD[Version]Signature=$CHICAGO$[DefaultInstall]AddReg = Reg.Settings[Reg.Settings]HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,"Installation Sources",0x10000,"%24%\Support\i386"HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,SourcePath,,"%24%\Support"HKLM,SOFTWARE\Microsoft\Windows\CurrentVersion\Setup,ServicePackSourcePath,,"%24%\Support"HKLM,SOFTWARE\Microsoft\Windows NT\CurrentVersion,SourcePath,,"%24%\Support\i386"
dlevens Posted January 5, 2005 Author Posted January 5, 2005 Thanks,Your right, it already works easily this way and much easier to read in the reg. The info worked perfectly. I will use cmd for cmd importing from my runonce.cmd file and use the inf for quick fixes. Is there a way to use an inf from the command line and have it install or import?Dennis
Yzöwl Posted January 5, 2005 Posted January 5, 2005 example from cmdlines.txt when inf is in same folder as it[Commands]"rundll32.exe setupapi,InstallHinfSection DefaultInstall 128 .\whatever.inf"example from a cmdECHO Applying Whatever.infrundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 132 "Drive\Path\whatever.inf"
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now