Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


CODYQX4

Help with RunOnceEx

Recommended Posts

I have set up a unattended XP SP2 disk, with several components installed at runonceex. I have done it all by inf and it seems to work. I just have one issue with it. Many of the things I am installing use other inf files and open up copy boxes. How can I hide and disable these so that my runonceex cannot be canceled?

Share this post


Link to post
Share on other sites

Hey there, Good afternoon.

You should attach a file called "cmdow.exe" in this location -> \$OEM$\$$\System32.

After you've done this, in your RunOnceEx.cmd file you should start it with such option:

cmdow @ /HID

@echo off

Good luck!

Share this post


Link to post
Share on other sites
Hey there, Good afternoon.

You should attach a file called "cmdow.exe" in this location -> \$OEM$\$$\System32.

After you've done this, in your RunOnceEx.cmd file you should start it with such option:

cmdow @ /HID

@echo off

Good luck!

Sorry, but I'm doing it by INF, not cmd. I also did try that before and it does hide the command window but not anything else. I am using RunonceEx to install TabletPC and MediaCenter Components, and it does work (This is referred to XP Ultimate in this forum). The INF's copy files from CMPNENTS on disk 2 of XP, but they open copy progress dialog boxes that can be closed by clicking the cancel button or the red X. I wanted to be able to hide these copy boxes but am not sure how to do so, or at least make the cancel and X buttons disappear. I do have the CMDOW if it can be done to hide the copy boxes.

Share this post


Link to post
Share on other sites

you could write a simple program in vb that blocks user input and start it at the beginning of RunOnceEX and performs a loop to see when the last but 1 key has completed then allows input again and then your last key should reboot the computer.

cmdlines.cmd - Modify this to your INF file, make sure you start BlockInput using %COMSPEC% /C or RunOnceEX will not continue

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

REG ADD %KEY% /V TITLE /D "Installing Additional Applications" /f
REG ADD %KEY% /V FLAGS /D "dword:0x00000110" /f

REG ADD %KEY%\000 /VE /D "Blocking User Input" /f
REG ADD %KEY%\000 /V 1 /D "%COMSPEC% /C START <PATH>\BlockInput.exe" /f

REG ADD %KEY%\019 /VE /D "WHATEVER YOU WANT" /f <---This is the key to check has completed, When it has it gets deleted
REG ADD %KEY%\019/V 1 /D "WHATEVER YOU WANT.exe" /f so Result = 0 and continues to run

REG ADD %KEY%\020 /VE /D "Restarting The Computer" /f
REG ADD %KEY%\020 /V 1 /D "Shutdown -f -r -t 60" /f

BlockInput.exe

Const HKEY_LOCAL_MACHINE = &H80000002
Const STANDARD_RIGHTS_ALL = &H1F0000
Const SYNCHRONIZE = &H100000
Const KEY_CREATE_LINK = &H20
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal samDesired As Long, phkResult As Long) As Long

Private Sub Form_Load()
Dim Result As Long

BlockInput True
Do While Result <> 0
DoEvents
RegOpenKeyEx HKEY_LOCAL MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\019", 0, KEY_ALL_ACCESS, Result
Sleep 10000
Loop
BlockInput False
Unload Me

End Sub

you can modify the code to enumerate all the subkeys under RunOnceEX and the deduct 1 from it or use a simple text file with the number to check for as the only entry in it so that you dont have to recompile every time you make a change.

the alternative crude approach is to just block input and allow windows to shut it when you reboot, with this approach you dont need to start it using %COMSPEC% as it blocks input then exits so gives an exit code to RunOnceEX and continues

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Sub Form_Load()
BlockInput True
Unload Me
End Sub

Please be aware though i have not tested that either of these work, on paper they do, if i get time i might compile them and modify it to try and fit as many peoples needs as possible, but don't hold your breath, i am very busy on modifying something for work.

if you don't have vb6 installed or any programming experience i am sure someone on here has, perhaps the moderators will pass it onto the dev team and they will examine the code and put it on here for the whole community.

i myself prefer to compile myself then i know exactly what it does and whats in it

Hope This Helps.

Lee.

Share this post


Link to post
Share on other sites
you could write a simple program in vb that blocks user input and start it at the beginning of RunOnceEX and performs a loop to see when the last but 1 key has completed then allows input again and then your last key should reboot the computer.

cmdlines.cmd - Modify this to your INF file, make sure you start BlockInput using %COMSPEC% /C or RunOnceEX will not continue

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

REG ADD %KEY% /V TITLE /D "Installing Additional Applications" /f
REG ADD %KEY% /V FLAGS /D "dword:0x00000110" /f

REG ADD %KEY%\000 /VE /D "Blocking User Input" /f
REG ADD %KEY%\000 /V 1 /D "%COMSPEC% /C START <PATH>\BlockInput.exe" /f

REG ADD %KEY%\019 /VE /D "WHATEVER YOU WANT" /f <---This is the key to check has completed, When it has it gets deleted
REG ADD %KEY%\019/V 1 /D "WHATEVER YOU WANT.exe" /f so Result = 0 and continues to run

REG ADD %KEY%\020 /VE /D "Restarting The Computer" /f
REG ADD %KEY%\020 /V 1 /D "Shutdown -f -r -t 60" /f

BlockInput.exe

Const HKEY_LOCAL_MACHINE = &H80000002
Const STANDARD_RIGHTS_ALL = &H1F0000
Const SYNCHRONIZE = &H100000
Const KEY_CREATE_LINK = &H20
Const KEY_CREATE_SUB_KEY = &H4
Const KEY_ENUMERATE_SUB_KEYS = &H8
Const KEY_NOTIFY = &H10
Const KEY_QUERY_VALUE = &H1
Const KEY_SET_VALUE = &H2
Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY Or KEY_CREATE_LINK) And (Not SYNCHRONIZE))

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, ByVal samDesired As Long, phkResult As Long) As Long

Private Sub Form_Load()
Dim Result As Long

BlockInput True
Do While Result <> 0
DoEvents
RegOpenKeyEx HKEY_LOCAL MACHINE, "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\019", 0, KEY_ALL_ACCESS, Result
Sleep 10000
Loop
BlockInput False
Unload Me

End Sub

you can modify the code to enumerate all the subkeys under RunOnceEX and the deduct 1 from it or use a simple text file with the number to check for as the only entry in it so that you dont have to recompile every time you make a change.

the alternative crude approach is to just block input and allow windows to shut it when you reboot, with this approach you dont need to start it using %COMSPEC% as it blocks input then exits so gives an exit code to RunOnceEX and continues

Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Sub Form_Load()
BlockInput True
Unload Me
End Sub

Please be aware though i have not tested that either of these work, on paper they do, if i get time i might compile them and modify it to try and fit as many peoples needs as possible, but don't hold your breath, i am very busy on modifying something for work.

if you don't have vb6 installed or any programming experience i am sure someone on here has, perhaps the moderators will pass it onto the dev team and they will examine the code and put it on here for the whole community.

i myself prefer to compile myself then i know exactly what it does and whats in it

Hope This Helps.

Lee.

Not really sure how to do that :blushing: . Is there any way I could disable the mouse and keyboard during runonceex?

If it helps, this is my runonceex.inf file

[Version]
Signature=$CHICAGO$
[DefaultInstall]
AddReg = RunXP
[XP]
AddReg = RunXP
[RunXP]
;http://support.microsoft.com/?kbid=232509
HKLM,"%RunOnceEx%\",Title,0,"Installing Windows XP Ultimate"
HKLM,"%RunOnceEx%\",Flags,0x00010001,20
HKLM,"%RunOnceEx%\install01",,,".NET Framework AIO"
HKLM,"%RunOnceEx%\install01",1,,"%24%\Install\DOTNETAIO\dotnetfx.exe"
HKLM,"%RunOnceEx%\install01",2,,"%24%\Install\DOTNETAIO\SP3.exe /Q"
HKLM,"%RunOnceEx%\install01",3,,"%24%\Install\DOTNETAIO\dotnet11SP1.exe"
HKLM,"%RunOnceEx%\install01",4,,"%24%\Install\DOTNETAIO\netfxAIO.exe"
HKLM,"%RunOnceEx%\install02",,,"Media Center Edition 2005 Components"
HKLM,"%RunOnceEx%\install02",1,,"rundll32 setupapi.dll,InstallHinfSection Freestyle 128 medctroc.inf"
HKLM,"%RunOnceEx%\install03",,,"Windows Digital Media Enhancements"
HKLM,"%RunOnceEx%\install03",1,,"%24%\Install\Batch\Plus.cmd"
HKLM,"%RunOnceEx%\install04",,,"Sonic CD and DVD Burning Engine"
HKLM,"%RunOnceEx%\install04",1,,"rundll32 setupapi.dll,InstallHinfSection SonicDVDandCDBurning 128 sonic.inf"
HKLM,"%RunOnceEx%\install05",,,"Tablet PC Edition 2005 Components"
HKLM,"%RunOnceEx%\install05",1,,"rundll32 setupapi.dll,InstallHinfSection TPG 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",2,,"rundll32 setupapi.dll,InstallHinfSection System 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",3,,"rundll32 setupapi.dll,InstallHinfSection OOBE 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",4,,"rundll32 setupapi.dll,InstallHinfSection Notebook 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",5,,"rundll32 setupapi.dll,InstallHinfSection StickyNotes 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",6,,"rundll32 setupapi.dll,InstallHinfSection AllShortcuts 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",7,,"rundll32 setupapi.dll,InstallHinfSection SRInstall 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install05",8,,"rundll32 setupapi.dll,InstallHinfSection AllReg 128 tabletpc.inf"
HKLM,"%RunOnceEx%\install06",,,"Repairing Components"
HKLM,"%RunOnceEx%\install06",1,,"%24%\Install\Batch\TabFix.cmd"
HKLM,"%RunOnceEx%\ZZCleanup",,,"Cleaning up And Rebooting"
HKLM,"%RunOnceEx%\ZZCleanup",1,,"%11%\cmd.exe /c rd /S /Q %24%\Install\"
HKLM,"%RunOnceEx%\ZZCleanup",2,,"%11%\cmd.exe /c shutdown -r -t 00"
[Strings]
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

It follows the method here to the letter (http://gosh.msfn.org/using_runonceex.htm)

This inf successfully installs Media Center and TabletPC components on XP Pro, as long as the proper reg entries are added. (XP Ultimate)

Edited by CODYQX4

Share this post


Link to post
Share on other sites

I will compile the crude method for you and rewrite your inf to suit, hope this helps, gimme a few hours though, pm me and i will send you it.

Share this post


Link to post
Share on other sites

The program ran, but unfortunately, it didn't block user input while installing in virtualbox, however, if executed on my real PC it does block everything except CTRL + ALT + DEL combination, so maybe it's just a virtualbox issue? Also I suppose CTRL + ALT + DEL working is a good thing as it could be used as a failsafe, and not let a typical user cancel runonceex, as they might not think of it.

Edited by CODYQX4

Share this post


Link to post
Share on other sites

I'm glad it fits your needs. If someone really wanted to cancel setup they would find a way to do it no matter what you do to stop them, try ctrl + shift + esc and see if it brings up task manager.

Share this post


Link to post
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...