[Solved] Help adding registry entries at first login..

Questions about Update Pack making? Ask here.
Post Reply
User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

[Solved] Help adding registry entries at first login..

Post by incith » Sun Dec 03, 2006 12:48 pm

I've searched and searched and tried to modify various addons and the like, I'd be more than grateful if someone could just post up an example AddOn that will make use of AddReg to add a few registry entries upon first user login.

Thanks in advance!
Last edited by incith on Sun Dec 03, 2006 9:19 pm, edited 1 time in total.

User avatar
5eraph
Site Admin
Posts: 4621
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sun Dec 03, 2006 1:48 pm

I learned a great deal playing with dgelwins most stupid addon. It deals only with AddReg.

User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

Post by incith » Sun Dec 03, 2006 1:53 pm

Unfortunately the download link is dead for that addon. (nor does it deal with RunOnce[Ex])
Last edited by incith on Sun Dec 03, 2006 2:00 pm, edited 1 time in total.

User avatar
5eraph
Site Admin
Posts: 4621
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sun Dec 03, 2006 1:56 pm

Try my download link at the end of the thread. You'll find a lot of useful information if you read through the entire thread. :)

User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

Post by incith » Sun Dec 03, 2006 2:01 pm

Yeah, I grabbed yours, but none the less that's just adding a registry entry during perhaps T-22 or T-13, and I'm kind of lost on how to do it during first login, which I'm pretty sure requires RunOnce or RunOnceEx..

User avatar
5eraph
Site Admin
Posts: 4621
Joined: Tue Jul 05, 2005 9:38 pm
Location: Riverview, MI USA

Post by 5eraph » Sun Dec 03, 2006 2:24 pm

You are correct about RunOnceEx. RunOnce will execute after the INF has been processed. A nested RunOnce will execute at T-12.

I did not realize you needed to add them at first logon. Most entries added during Windows setup do persist and make their way through to that point.

You can use this code as an example to add registry entries at first logon.

Code: Select all

[ROE.AddReg]
HKLM,"%ROEKey%\010",,,"Adding Registry Entries"
HKLM,"%ROEKey%\010",1,,"%11%\REG ADD %CCtrl% /v AutoReboot /t REG_DWORD /d 0 /f"

[Strings]
ROEKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"
CCtrl  = "HKLM\SYSTEM\CurrentControlSet\Control\CrashControl"
For more information about using RunOnceEx in INF files please see Gosh's guide.

User avatar
ricktendo64
Posts: 3214
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sun Dec 03, 2006 2:36 pm

I have solved that problem with my sidebar addon
http://www.sokoolz.com/addons/r64/Rickt ... PAddOn.rar

User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

Post by incith » Sun Dec 03, 2006 5:40 pm

I'll check out your addon now, and yes, what I need to do is add registry entries at first login, which I guess in full would be add registry entries that add registry entries upon first login.

I'm not trying to run commands at first login, just add registry entries/modify registry entries/etc.

I'm sure I'll hopefully figure it out with your addon and the example above :)

Edit: Oh, and yes, I have already added them at the T-13 stage or so, but that way just doesn't work well enough for this.

Edit #2: Actually, I really do feel lost on this for some reason. A perhaps easier to follow example of what I'm trying to do is, upon first login, add some registry entries.. all I can find is adding commands to be issued on RunOnceEx, is it not possible to just insert some registry entries themselves upon first login? As in, adding registry entries outside of RunOnceEx.. updating other registry keys upon first login? .. hope I'm making sense here.

User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

Post by incith » Sun Dec 03, 2006 7:07 pm

Hm, my first solution now will be to test with nLite using the RunOnce area of the configuration.

The commands I am adding are, for example, using reg.exe:

Code: Select all

reg ADD "HKLM\blah\blah" /v KeyValueName /t REG_BINARY /d Data
I think this will work, and I'll post back later if it does.

User avatar
ricktendo64
Posts: 3214
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Sun Dec 03, 2006 8:12 pm

O.K. I know
[RunOnceEx.AddReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",,0x00000012
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",Flags,0x00010001,0x00000080
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\Roex_1",1,,"rundll32 setupapi,InstallHinfSection Login 128 %17%\Sidebar.inf"
This are the only runonceex AddReg entries in my [OptionalComponents] ->RunOnceEx.AddReg
It is executed during T13 and it will launch add the other RunOnceEx regentries Login's AddReg
[Login]
Modes ="RunOnceEx"
Tip ="1st Logon"
Modes =0,1,2,3
AddReg=Login.AddReg
[Login.AddReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",,0x00000012
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",Title,0x00000000,"Windows Sidebar"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx",Flags,0x00010001,0x00000020
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\RTM_1",,,"Registering Sidebar"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\RTM_1",1,,"%24%\VAIO\Tools\Reg.cmd"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\RTM_2",,,"Deleting Shit!"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx\RTM_2",1,,"rundll32 advpack,LaunchINFSection %17%\Sidebar.inf,ObsoDelete"
So login addreg is not added until t13 ensuring that it will get lauched during 1st logon rather than t12 or 13

User avatar
incith
Posts: 19
Joined: Wed Nov 23, 2005 8:16 pm
Location: Canada

Post by incith » Sun Dec 03, 2006 9:19 pm

Thanks, my method worked good too :) Even better to use reg add "HKLM\Path\Blah" /f, the /f being force over-write of existing data. But thanks, I'll most likely turn my project into an addon for ease-of-use.

johnny.westerlund
Posts: 3
Joined: Fri Oct 27, 2006 6:50 am

Post by johnny.westerlund » Tue Dec 05, 2006 4:59 am

Thought i'd add another way to do it.

Active Setup and how to implement it

Written by Ed Tippelt, ert@pobox.com, copyright 2002

Active setup is a process that runs automatically when a user logs in.
Registry keys at

HKLM\Software\Microsoft\Active Setup\Installed Components\%APPNAME%
and
HKCU\Software\Microsoft\Active Setup\Installed Components\%APPNAME%

are compared, and if the HKCU registry entries don't exist, or the
version number of HKCU is less than HKLM, then the specified
application is executed for the current user.

If your application requires installation of components such as
files or registry keys on a per-user basis, but your application
has no advertised entry points or other triggers to initiate the
installation process, then Active Setup is the solution.

To implement Active Setup, you need to package all your user
installation requirements into an EXE preferably,
using SMS Installer, or Wise Installation System for example,
and place the EXE on the client workstation
during the main application installation process.

In addition, populate the following registry key with two ( REG_SZ ) values:

KEY:
HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\%APPNAME% -
where %APPNAME% is an arbitrary string which can be the application name,
or its product code GUID. As long as it is unique on that workstation!

VALUE1:
StubPath=<full local path>\YourActiveSetup.exe

VALUE2:
Version=1


When each new user logs on, the operating system compares Active Setup
keys between HKLM and HKCU, and runs the nominated executable if the
HKCU entry is missing or the version in HKCU is less than HKLM.
So if you ever need to update the ActiveSetup executable, just install
a new version, and increment the Version registry key (VALUE2 above)
in HKLM. Next time the user logs on, the active setup will run again
for that user.

can also use rundll and a inf file as your active setup command. Heres how windows media player does it..

rundll32.exe advpack.dll,LaunchINFSection C:\WINDOWS\INF\wmp10.inf,PerUserStub

TechnoHunter
Posts: 506
Joined: Sun Feb 26, 2006 4:13 am

Post by TechnoHunter » Tue Dec 05, 2006 5:30 am

well now, that sounds nifty! thanks for the info.

-wanders off to test it while muttering 'bout "learning something new everyday"

TechnoHunter

User avatar
ricktendo64
Posts: 3214
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Tue Dec 05, 2006 11:39 am

COOL !!! Gonna use it

Anybody know how I can do 2 StubPath's in 1 Reg entrie?

For instance I want to Register 2 DLLs

User avatar
ricktendo64
Posts: 3214
Joined: Mon May 22, 2006 12:27 am
Location: Honduras

Post by ricktendo64 » Wed Dec 06, 2006 11:46 am

Ive used this method and its Really Awesome

BTW I figured out how to Register 2 DLLs in one line using |

Example
"""%%ProgramFiles%%\Windows Sidebar\.\regsvr32.exe"" /s sbdrop.dll|""%%ProgramFiles%%\Windows Sidebar\.\regsvr32.exe"" /s wlsrvc.dll"

Post Reply