Jump to content

RunOnceEx.inf


Recommended Posts

I am using an .inf file to install my applications but I would like to install them from the CD without copying the files to the Hard Drive using the RunOnceEx.inf.

How can I implement this: SET CDROM=%~d0 or something similar to set the %CDROM% variable from the .INF file

Thanks in advance

Edited by Anikan
Link to comment
Share on other sites


Have you tried to use the SourceDisksNames Section with a DiskID Description and Tag-file?

No but I will look into tonight.

I found the solution here:Installing Apps Using Runonceex

[strings]

cdname = "Windows XP Professional CD-ROM"

productname = "Windows XP Professional"

cdtagfile = "\win51ip"

RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

[sourceDisksNames]

1 = %cdname%,%cdtagfile%,,""

The line, 1 = %cdname%,%cdtagfile%,,"" , finds the install CD for me. My APPS directory is in the root of the CD. The [strings] section identifies %cdname% and %cdtagfile%. The tag file is the common tag file found on the XP Pro CD-ROM.

Edited by Anikan
Link to comment
Share on other sites

  • 7 months later...

I've come across a problem whilst using this method.

I'm installing Windows XP from a multi-boot disc.

I have an inf that uses runonceex to finalise the BTS Driverpacks then execute WPI from %CDROM%\WPI\WPI.hta.

My setup source/boot folder is %CDROM%\IXPP\.

When runonceex is finally run at logon it fails to find WPI because it's looking in %CDROM%\IXPP\WPI\WPI.hta.

Is there any way to force it to look at the root of the disc instead of the boot folder?

Heres my existing inf:

[Version]
Signature=$CHICAGO$

[Optional Components]
Presetup

[Presetup]
OptionDesc = "Presetup"
Tip = "Presetup"
Modes = 0,1,2,3
AddReg = Presetup.AddReg

[Setup]
OptionDesc = "Setup"
Tip = "Setup"
Modes = 0,1,2,3
AddReg = Setup.AddReg

[SourceDisksNames]
1 = %cdname%,%cdtagfile%,,""

[Presetup.AddReg]
HKLM,"%RunOnceEx%",,0x00000012
HKLM,"%RunOnceEx%",Flags,0x00010001,0x00000080
HKLM,"%RunOnceEx%\Presetup_1",1,,"rundll32 setupapi,InstallHinfSection Setup 128 %17%\Roex.inf"

[Setup.AddReg]
HKLM,"%RunOnceEx%",,0x00000012
HKLM,"%RunOnceEx%",Title,0x00000000,"Windows Update"
HKLM,"%RunOnceEx%",Flags,0x00010001,0x00000020
HKLM,"%RunOnceEx%\Setup_1",,,"BTS DriverPacks"
HKLM,"%RunOnceEx%\Setup_1",1,,"%24%\DPsFnshr.exe"
HKLM,"%RunOnceEx%\Setup_2",,,"Windows Post-Install Wizard"
HKLM,"%RunOnceEx%\Setup_2",1,,"%1%\WPI\WPI.hta"

[strings]
cdname = "AIO"
cdtagfile = "\AIO.ICO"
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

Thanks.

Edited by kof94
Link to comment
Share on other sites

Did you tried to replace :

HKLM,"%RunOnceEx%\Setup_2",1,,"%1%\WPI\WPI.hta"

by

HKLM,"%RunOnceEx%\Setup_2",1,,"%01%\..\WPI\WPI.hta"

The "magic numbers" you can define in [sourceDisksNames] are to be used only in [sourceDisksFiles].

The "magic numbers" enclosed in percent signs are windows' directory identifiers, so %1% (or %01%) always refers to the directory the .INF file is in.

You can't redefine %...% numbers ; but you can define new ones by reading a "custom" value in the registry via "CustomDestination" sections. (i don't know precisely how to use such sections, and they're "unsafe" in this case since you need to provide a default value)

++

Link to comment
Share on other sites

I think Delprat answered your question already, but I use an inf to install my applications from a CD/DVD without copying them to the harddrive. Here is how I do it.

D:\

D:\$OEM$\

D:\$OEM$\setup.inf <-- the file my cmdlines.txt calls

D:\$OEM$\Installs\common\

D:\$OEM$\Installs\common\TTPack\TTPack2202.exe

Inf looks like this:

HKLM,"%RunOnceEx%\0080",,,"titou2k TTPack 2.2.0.2"
HKLM,"%RunOnceEx%\0080",1,,"%01%\installs\common\TTPack\TTPack2202.exe"

Where %RunOnceEx% is defined like this:

[Strings]
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

as the last section in my INF

Hope that helps.

]Bonkers[

Here is something that I have at the top of my inf file. I got it from a member a while ago... I don't think he is active anymore, but he was incredibly smart :D.

; Format:

; MainRegistryKey,RegistryKey,Name,Type,Data

;

; MainRegistryKey values can be HKLM,HKCU,HKCR,HKU

; RegistryKey is the main registry key (folder looking icon)

; Name is the section on the right hand side in regedit under the section Name.

; Type is the type of registry data.

;

; Registry Data Types

; types with NCLOB don't overwrite existing values

;

; REG_SZ = 0x00000000 (or 0)

; REG_BINARY = 0x00000001 (or 1)

; Reg_SZ_NOCLOBBER = 0x00000002 (or 2)

; REG_BINARY_NOCLOBBER = 0x00000003 (or 3)

; REG_MULTI_SZ_APPEND = 0x0001000A

; REG_MULTI_SZ = 0x00010000

; REG_DWORD = 0x00010001

; REG_MULTI_SZ_NOCLOBBER = 0x00010002

; REG_DWORD_NOCLOBBER = 0x00010003

; REG_MULTI_SZ_DELVAL = 0x00010006

; REG_ADDREG_APPEND = 0x00010008

; REG_EXPAND_SZ = 0x00020000

; REG_EXPAND_SZ_NOCLOBBER = 0x00020002

;

; To make a default value, use ,,, For example see iesearch settings

;

; A DIRID can be one of the following values: -01,

;

; Value Destination Directory

;

; 01 SourceDrive:\pathname (the directory from which the INF file was installed)

; 10 Windows directory (This is equivalent to %windir%.)

; 11 System directory (This is equivalent to %windir%\system32 for NT-based systems,and to %windir%\system for Windows 9x/Me.)

; 12 Drivers directory (This is equivalent to %windir%\system32\drivers for NT-based platforms,and to %windir%\system\IoSubsys on Windows 9x/Me platforms.

; 17 INF file directory

; 18 Help directory

; 20 Fonts directory

; 21 Viewers directory

; 23 Color directory (ICM) (not used for installing printer drivers)

; 24 Root directory of the system disk. (This is the root directory of the disk on which Windows files are installed. For example, if dirid 10 is "C:\winnt", then dirid 24 is "C:\".)

; 25 Shared directory

; 30 Root directory of the boot disk, also known as "ARC system partition," for NT-based systems. (This might or might not be the same directory as the one represented by dirid 24.)

; 50 System directory for NT-based operating systems (This is equivalent to %windir%\system (NT-based systems only).)

; 51 Spool directory (not used for installing printer drivers see Printer Dirids)

; 52 Spool drivers directory (not used for installing printer drivers)

; 53 User profile directory

; 54 Directory where ntldr.exe and osloader.exe are located (NT-based systems only)

; 55 Print processors directory (not used for installing printer drivers)

; -1 Absolute path

;

; Value Shell Special Folder

;

; 16406 All Users\Start Menu

; 16407 All Users\Start Menu\Programs

; 16408 All Users\Start Menu\Programs\Startup

; 16409 All Users\Desktop

; 16415 All Users\Favorites

; 16419 All Users\Application Data

; 16422 Program Files

; 16427 Program Files\Common

; 16429 All Users\Templates

; 16430 All Users\Documents

Link to comment
Share on other sites

Bonkers[' date=Oct 5 2006, 09:27 AM' post='568969]D:\$OEM$\

D:\$OEM$\setup.inf <-- the file my cmdlines.txt calls

D:\$OEM$\Installs\common\

D:\$OEM$\Installs\common\TTPack\TTPack2202.exe

Inf looks like this:

HKLM,"%RunOnceEx%\0080",,,"titou2k TTPack 2.2.0.2"
HKLM,"%RunOnceEx%\0080",1,,"%01%\installs\common\TTPack\TTPack2202.exe"

Where %RunOnceEx% is defined like this:

[Strings]
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

as the last section in my INF

Neat job! :thumbup

So, your cmdlines.txt may look like this?

[COMMANDS]

"rundll32 advpack.dll,LaunchINFSection setup.inf,DefaultInstall"

Link to comment
Share on other sites

Update: No this doesn't work.

I'm testing a workaround, if it works I'll post it.

Also, if you hate $OEM$ folders like me, just add your inf to sysoc.inf to run during setup. I use an addon to do this but you could do it manually.

Link to comment
Share on other sites

Ok, this was my work around idea, that also doesn't work.

Being that my runonceex commands were initiated at at about T-24 (sysoc.inf) I gathered that this must have been my problem. I thought this because setup thinks at this point that %CDROM%\IXPP\ is the root of the disc (like a normal Windows disc)

To over come this I thought of running my final commands at logon:

Heres my inf now:

[Version]
Signature=$CHICAGO$

[Optional Components]
Sysoc

[Sysoc]
OptionDesc = "Sysoc"
Tip = "Sysoc"
Modes = 0,1,2,3
AddReg = Sysoc.AddReg

[Logon]
OptionDesc = "Logon"
Tip = "Logon"
Modes = 0,1,2,3
AddReg = Logon.AddReg

[Postlogon]
OptionDesc = "Postlogon"
Tip = "Postlogon"
Modes = 0,1,2,3
AddReg = Postlogon.AddReg
RunPostSetupCommands = Postlogon.Run

[SourceDisksNames]
222 = %cdname%,%cdtagfile%,,""

[Sysoc.AddReg]
HKLM,"%RunOnceEx%",,0x00000012
HKLM,"%RunOnceEx%",Flags,0x00010001,0x00000080
HKLM,"%RunOnceEx%\Sysoc_1",1,,"rundll32 setupapi,InstallHinfSection Logon 128 %17%\Roex.inf"

[Logon.AddReg]
HKLM,"%RunOnceEx%",,0x00000012
HKLM,"%RunOnceEx%",Flags,0x00010001,0x00000080
HKLM,"%RunOnceEx%\Logon_1",1,,"rundll32 advpack,LaunchINFSection %17%\Roex.inf,Postlogon"

[Postlogon.AddReg]
HKLM,"%RunOnceEx%",,0x00000012
HKLM,"%RunOnceEx%",Title,0x00000000,"Windows Update"
HKLM,"%RunOnceEx%",Flags,0x00010001,0x00000020
HKLM,"%RunOnceEx%\Post_1",,,"BTS DriverPacks"
HKLM,"%RunOnceEx%\Post_1",1,,"%24%\DPsFnshr.exe"
HKLM,"%RunOnceEx%\Post_2",,,"Windows Post-Install Wizard"
HKLM,"%RunOnceEx%\Post_2",1,,"%222%\WPI\WPI.hta"

[Postlogon.Run]
"%11%\rundll32.exe %11%\iernonce.dll,RunOnceExProcess"

[strings]
cdname = "AIO"
cdtagfile = "\AIO.ICO"
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

As you can see I run RunOnceEx twice at logon. I did this in the hope that setup would find the root of the disc at the end of the installation.

Well I was wrong it now looks at

%Systemroot%\system32\unknown\WPI\WPI.hta

I also changed the variable agian to a random number (222) to see if that would help. Obviously not!

I'm gonna change this back to 01 and see what happens.

Apart from this idea I'm not really sure what to do next :unsure: .

Edit:

Sorry next time I'll read more carefully:

HKLM,"%RunOnceEx%\Setup_2",1,,"%01%\..\WPI\WPI.hta"

I didn't see the one up dots the first time I looked.

Problem solved, thanks Delprat.

Edited by kof94
Link to comment
Share on other sites

Hey Mazin,

Actually my cmdlines.txt looks like this:

[COMMANDS]
"setup.cmd"

:P

Then in my setup.cmd:

cmdow @ /HID
@ECHO OFF

net user Philip /add
net localgroup Administrators Philip /add
net accounts /maxpwage:unlimited

::RunOnceEX
rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\setup.inf
if %computername%==DESKTOP rundll32 setupapi,InstallHinfSection DesktopInstall 128 .\setup.inf
if %computername%==NOTEBOOK rundll32 setupapi,InstallHinfSection NotebookInstall 128 .\setup.inf

::Tweaks
rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\tweaks.inf
if %computername%==DESKTOP rundll32 setupapi,InstallHinfSection DesktopInstall 128 .\tweaks.inf
if %computername%==NOTEBOOK rundll32 setupapi,InstallHinfSection NotebookInstall 128 .\tweaks.inf

EXIT

(I have multiple sections in my inf with specific software profiles)

]Bonkers[

Link to comment
Share on other sites

]Bonkers[, your cmd has a hidden... "feature", that will make it fail if %computername% is empty (Tweaks will not get installed). And you can make it shorter and more flexible :

cmdow @ /HID
@ECHO OFF

net user Philip /add
net localgroup Administrators Philip /add
net accounts /maxpwage:unlimited

for %%i in (setup tweaks) do (
rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\%%i.inf
for %%n in (Desktop Notebook) do if /i "%computername%"=="%%n" rundll32 setupapi,InstallHinfSection %%nInstall 128 .\%%i.inf
)

EXIT

if you want to add another INF file, just add its name in the (setup tweaks) parenthesis (case insensitive)

if you want to add another profile, add its name in the (Desktop Notebook) parenthesis : this one is case sensitive about the INF section name, not about %computername%

++

Edited by Delprat
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...