Jump to content

XP, RunOnceEx, I want to restart halfway through


Recommended Posts

Hi all,

I did a search, had many results, all of them irrelevant!

Here's the situation. I'm doing an unattended install of XP HE, and I'm using RunOnceEx to install some drivers (I'm not using the winnt.sif approach) and applications. I would like to restart after installing the drivers, and then continue with the applications. I see three ways of doing this.

1. Use the reboot option of the final driver to be installed: would work I think, but means I need to fiddle if I add a driver or change the installation order.

2. Use shutdown.exe: RunOnceEx thinks that this has finished instantly. I could use sleep.exe, but it feels sloppy to be trying to synchronise sleep and shutdown. If I use 5 secs with shutdown and 10 secs with sleep, is that guaranteed to work, or is there some other behaviour?

3. Use two .cmd files:

(RunOnceExDrivers.cmd is run from commandlines.txt)

RunOnceExDrivers.cmd

add registry entries to install the drivers, as per normal

add registry entries to run RunOnceExApplications.cmd

add registry entries to call shutdown.exe

RunOnceExApplications.cmd

add registry entries to install the applications, as per normal

I can imagine this causing problems because you're changing the registry entries (by calling RunOnceExApplications.cmd) as it's processing the list. Does anyone know if this is an issue or not?

So I thought I'd throw it out to the experts! Any feedback very welcome.

Ta,

Jesmond

Link to comment
Share on other sites


Couldn't you make a RunOnceEx.cmd install the drivers, and then the last thing the RunOnceEx.cmd does before restart is add the keys to the registry to install the Applications? Then it should reboot, the entries should be in the registry, and it should install the applications on login (If you are set up to login). That's just an untested guess, but I think it should work.

Link to comment
Share on other sites

Is there any particular reason why you want to reinstall before installing the applications?

Have you tried integrating the drivers into your CD? It's probably easier and cleaner than installing them afterwards.

You could get away with it by having the drivers install under keys numbered 001-100 say, and then applications from 500-> to avoid any problems of overlapping. I'm not sure when the RunOnceEx list is cleared however (if it's right after the command is executed or after the entire list is completed).

Link to comment
Share on other sites

Quick replies, thanks there!

the last thing the RunOnceEx.cmd does before restart is add the keys to the registry to install the Applications
mgleason007: If I understand you right that's my third suggestion!?
the drivers install under keys numbered 001-100 say, and then applications from 500-> to avoid any problems of overlapping

Zxian: I'm not worried about overlapping numbers. I'm worried that RunOnceEx will notice the added registry values and immediately continue the list, as opposed to waiting until rebooting. To put it another way: does the RunOnceEx process make a copy of the appropriate registry keys when it starts, and then use its own private copy, or does it keep a current_number and just directly check the registry to see what's next. If the former, my task is easy; if the latter, more difficult. I guess I can check quite easily.

Have you tried integrating the drivers into your CD?

Er, well, erm, the thing is I'm kinda wimpy. I don't like the idea of assuming that all the installation package does is install drivers. As I understand it, the winnt.sif approach copies the drivers, but never executes anything. Now I simply don't know what my driver executables do. I don't know which ones just install drivers, which install drivers and apps, and I just feel safer installing from an executable. I have the feeling though that everyone's gonna shoot me down here!

Thanks again for the help!

(I'm gonna run a quick experiment to see how RunOnceEx works...)

Jesmond

Link to comment
Share on other sites

to my testing the runonceex system deletes the key when it finishes it

so say i had a batch file to install apps A, B , C if ifinished with program A and then oddly lost power(or app A restarted the system) thos other keys should still be in there one problem i could see with this therom is is that the restart would loop indefinatly so you may want to do some testing on that

Link to comment
Share on other sites

Ah... I see your question regarding the order of RunOnceEx. To be honest, I'm not sure. Hopefully your test will answer that.

As for the drivers, we're not gonna shoot you down here. :P

I haven't done any of the hardcore integrating myself, but I know you can do it with nLite. Extract the driver packages (with WinRAR or the like) and then in nLite select the INF files that come in the driver executables. nLite should be able to integrate the drivers into the Windows driver base, so there's no need to install anything.

What drivers are you talking about here? Are you also talking about camera drivers and the like?

Link to comment
Share on other sites

Hi,

A few experiments with iernonce.dll later, and I think this is the behaviour of RunOnceEx:

1. Make private list of all RunOnceEx registry keys and values.

2. Iterate the private list, deleting each value (read command) from the real registry as it begins to execute that command.

3. When it has finished every value in a particular key it deletes the key (from the real registry).

4. When it has finished every key it deletes the TITLE value (from the real registry).

The important thing is that however you manipulate the values after RunOnceEx has started running, it still runs the original set of keys and values.

At least that's what my tests show;)

Thanks all.

Jesmond

Link to comment
Share on other sites

Why not try this, since the Runonce is start from the cmdlines.txt

I suggest this because at this point of the install it still has to reboot

so why not take advantage of that fact.

cmdow @ /HID

@echo off

::Place The Driver Install Before The RunOnceEx is ran.

start / w Whatever

for %%i in (C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: Z:) do if exist %%i\SETUP.exe set CDROM=%%i

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "The Install Section" /f

REG ADD %KEY%\000 /VE /D "Preparing Installation..." /f

REG ADD %KEY%\003 /VE /D "SCD10en" /f

REG ADD %KEY%\003 /V 1 /D "%CDROM%Apps\SCD10en.exe /q" /f

REG ADD %KEY%\005 /VE /D "Update KB885250" /f

REG ADD %KEY%\005 /V 1 /D "%CDROM%Apps\KB885250.exe /passive /norestart /l /n /o /z" /f

Link to comment
Share on other sites

Thanks gunsmokingman. Are you sure that it's ok to run programs at this stage? I'm a complete newbie at this and don't know, for example, if the installation process has installed things that require a reboot before user programs start getting run. If there aren't any problems, I would prefer to use RunOnceEx anyway (cos *cough* it looks cool). So... does anyone see any problems with using rundll32 iernonce.dll to install at this stage before rebooting?

Thanks again,

Jesmond

[edited for punctuation - **** important]

Edited by jburbell
Link to comment
Share on other sites

I just had a really wacky idea:

1. At the T-12 stage, add RunOnceEx entries starting with 500 or some other high number of that sort.

2. When RunOnceEx starts, it will start at the 500 entries.

3. Add entries during RunOnceEx for 005 and onward.

My theory is that the RunOnceEx processor thingee will not double back and start the list over, so when it reboots, it will have the rest of the list in there. Am I right?

Link to comment
Share on other sites

  • 2 weeks later...

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...