[Question] Win7 HKCU reg entries w/WINNT True Integrator

Windows 7 Update Pack discussion.
Post Reply
RP
Posts: 64
Joined: Tue Jan 01, 2008 4:00 pm

[Question] Win7 HKCU reg entries w/WINNT True Integrator

Post by RP » Sat Apr 14, 2012 8:30 am

I'm trying to get WINNT Integrator to apply HKCU reg entries, which Windows 7 of course doesn't allow in Setup before user account creation like XP did. Finding that using HKU,".DEFAULT" rarely works either.

Is there tried-and-true syntax to get around this restriction when doing INF-install WINNT True Integrator true addons? I would much rather have a solution totally contained in the INF that I can template for any addon rather than having to call out to some outside .cmd/.reg files and pray that nothing breaks with that whole cumbersome arrangement.

Addon in question that I'm trying to make is a Sysinternals installer that accepts the EULA, which can only be done with HKCU entries. Also running into the same brick wall with other addons I'm working on for installing optional sound schemes. Here's my INF for the Sysinternals one, applying Process Explorer. Totally conventional template INF same as all my working Win7 true addons posted on this forum...HKLM entries apply fine, HKCU installs fine manually on a running system, etc. The [Sysinternals.Reg] section right in the middle of the INF is where the HKCU entries are.

Code: Select all

[Version]
Signature=$Windows NT$

;----INSTALL SECTIONS----
[Sysinternals]
CopyFiles = Sysinternals.Files
AddReg = Uninstaller.Reg, Sysinternals.Reg, Process_Explorer.Reg
ProfileItems = Process_Explorer.Add.Shortcut

[DefaultInstall]
CopyFiles = @Sysinternals.inf, Sysinternals.Files
AddReg = Uninstaller.Reg, Sysinternals.Reg, Process_Explorer.Reg
ProfileItems = Process_Explorer.Add.Shortcut
UpdateInis = OCSysPrep.Update

;----UNINSTALL SECTIONS----
[DefaultUninstall]
BeginPrompt = Uninstaller.BeginPrompt
DelFiles = Sysinternals.Files
DelDirs = Sysinternals.DelDirs
ProfileItems = Process_Explorer.Del.Shortcut
DelReg = Uninstaller.Reg, Sysinternals.Reg, Process_Explorer.Reg
UpdateInis = OCSysPrep.CleanUp
EndPrompt = Uninstaller.EndPrompt
CleanUp = 1

;----COMPONENT SETUP SECTIONS----
[SourceDisksNames]
1 = "Sysinternals",,,

[SourceDisksFiles]
eula.txt=1
procexp.chm=1
procexp.exe=1

[DestinationDirs]
Sysinternals.Files = 16422,"Sysinternals"
DefaultDestDir = 17

[Sysinternals.Files]
eula.txt
procexp.chm
procexp.exe

[Sysinternals.Reg]
HKCU,"SOFTWARE\Sysinternals"
HKCU,"SOFTWARE\Sysinternals\Process Explorer"
HKCU,"SOFTWARE\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00

[Process_Explorer.Reg]
HKLM,"SOFTWARE\Sysinternals\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe"
HKLM,"SOFTWARE\Sysinternals\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe","Debugger",,"%16422%\Sysinternals\procexp.exe"

[Process_Explorer.Add.Shortcut]
Name = "Process Explorer"
InfoTip = "Shows information about which handles and DLLs processes have loaded."
CmdLine = 16422,"Sysinternals","procexp.exe"
SubDir = "Accessories\System Tools\Sysinternals"
WorkingDir = "%HOMEDRIVE% %HOMEPATH%"

[Process_Explorer.Del.Shortcut]
Name = "Process Explorer",0x00000002
SubDir = "Accessories\System Tools\Sysinternals"

[Sysinternals.DelDirs]
"%16422%\Sysinternals"

;----UNINSTALLER SUPPORT SECTIONS----
[Uninstaller.Reg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","DisplayName",,"Sysinternals"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","Publisher",,"Microsoft Corporation"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","DisplayIcon",,"%11%\imageres.dll,-36"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","UninstallString",,"rundll32.exe advpack.dll,LaunchINFSection "%17%\Sysinternals.inf",DefaultUninstall"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","ParentKeyName",,"OperatingSystem"
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Sysinternals","ParentDisplayName",,"Optional Components"

[OCSysPrep.Update]
%17%\OCSysPrep.inf,"Components",,"Sysinternals=advpack.dll,LaunchINFSection,Sysinternals.inf,Sysinternals"

[OCSysPrep.CleanUp]
%17%\OCSysPrep.inf,Components,Sysinternals=*

[Uninstaller.BeginPrompt]
Title = "Sysinternals Uninstaller"
Prompt = "Are you sure you want to remove Sysinternals from your computer?"
ButtonType = YESNO

[Uninstaller.EndPrompt]
Prompt = "Sysinternals was successfully removed from your computer."

;----STRINGS SECTION----
[Strings]

User avatar
nonno fabio
Posts: 1627
Joined: Mon Jun 06, 2005 10:36 am
Location: Northern Italy
Contact:

Post by nonno fabio » Sat Apr 14, 2012 12:32 pm

the only way you can try is to add the registry from an entries.ini file, see WinRar addon example.

From .inf file setup is impossible as this hive in windows 7 is mounted only after 2nd reboot (sysprep phase) in a totally different way than windows XP, where is easier (in XP HKCU is already mounted at t29)
Don't ask for a different configuration of Onepiece's XP AIO Update Pack: use one of the existing vanilla XP UpdatePack with your preferred addons instead

User avatar
OnePiece Alb
Posts: 525
Joined: Sat Sep 01, 2007 7:01 pm
Location: Albania
Contact:

Post by OnePiece Alb » Sat Apr 14, 2012 1:27 pm

As already said Nonno Fabio need to use these
HKU, "UserProfile\Software"
HKU, "DefaultUsers\Software" (that WinRar True AddOn uses)
HKU, ".DEFAULT\Software"
but it does try, windows normally load during the setup the (HKU, ".DEFAULT\Software") after second reboot load one of these (HKU, "UserProfile\Software" or HKU, "DefaultUsers\Software", if not I'm wrong load HKU, "DefaultUsers\Software")

http://www.ryanvm.net/forum/viewtopic.php?t=8750
nonno fabio wrote:entries.ini commands supported by DXIntegrator

DXIntegrator loads this HIVES as default, so like previous example if want to add reglines in HKLM\Software, you need to use MACHINE\%KEY_SOFTWARE%, if you want to add or delete reglines in HKLM\System instead, you need MACHINE\%KEY_SYSTEM%

Code: Select all

"%MountDir%\Windows\System32\config\SOFTWARE" = %KEY_SOFTWARE%
"%MountDir%\Windows\System32\config\SYSTEM" = %KEY_SYSTEM%
"%MountDir%\Windows\System32\config\SECURITY" = %KEY_SECURITY%
"%MountDir%\Windows\System32\config\SAM" = %KEY_SAM%
"%MountDir%\Windows\System32\config\COMPONENTS" = %KEY_COMPONENTS%
"%MountDir%\Windows\System32\config\DEFAULT" = %KEY_DEFAULT%
"%MountDir%\Users\default\ntuser.dat" = %KEY_NTUSER%
"%MountDir%\Windows\system32\smi\store\Machine\schema.dat" = %KEY_SCHEMA%
"%MountDir%\WINDOWS\system32\config\systemprofile\NTUSER.DAT" = %KEY_NTUSER_SP%
"%MountDir%\WINDOWS\system32\config\systemprofile\AppData\Local\Microsoft\Windows\UsrClass.dat" = %KEY_USRCLASS_SP%
"%MountDir%\Windows\ServiceProfiles\LocalService\NTUSER.DAT" = %KEY_NTUSER_LS%
"%MountDir%\Windows\ServiceProfiles\LocalService\AppData\Local\Microsoft\Windows\UsrClass.dat" = %KEY_USRCLASS_LS%
"%MountDir%\Windows\ServiceProfiles\NetworkService\NTUSER.DAT" = %KEY_NTUSER_NS%
"%MountDir%\Windows\ServiceProfiles\NetworkService\AppData\Local\Microsoft\Windows\UsrClass.dat" = %KEY_USRCLASS_NS%
"%MountDir%\Users\Administrator\NTUSER.DAT" = %KEY_NTUSER_ADMIN%
"%MountDir%\Users\Administrator\AppData\Local\Microsoft\Windows\UsrClass.dat" = %KEY_USRCLASS_ADMIN%
HKLM\%KEY_NTUSER_ADMIN%\Software\ = HKU, "UserProfile\Software"
HKLM\%KEY_NTUSER%\Software\ = HKU, "DefaultUsers\Software"
HKLM\%KEY_DEFAULT%\Software\ = HKU, ".DEFAULT\Software"

but the point that when creating the user Microsoft does not update the HKCU (as in Windows NT5.x 2000/XP/2003) but replaces it, as already said Nonno Fabio all AddReg in HKCU during Windows NT6.x Setup is lost, so need updating by entries.ini these hives

Ciao a tutti.

PS: I recommend the use of wget.exe + file.cmd (for example http://www.ryanvm.net/forum/viewtopic.php?t=8378) to create the sysinternals addon, because if I remember (Many years have passed now) correctly the Creator forbidden distribution of its package

RP
Posts: 64
Joined: Tue Jan 01, 2008 4:00 pm

Post by RP » Sun Apr 29, 2012 2:31 pm

Still having trouble getting this to work. I tried all 3 entries.ini HKU methods from Nonno Fabio's post. It manages to put them successfully in the HKU,.DEFAULT section, but none of them ever get copied over during Windows Setup into HKCU. Any ideas as to what I'm doing wrong here? Here are my 3 entries.ini attempts. All call the same INF I posted earlier.

#1 - HKU, ".DEFAULT\Software\"

Code: Select all

[general]
title = Process Explorer
description = Sysinternals Process Explorer
version = 15.13
company = Microsoft Corp.
builddate = 04/29/2012
releasetype = True Addon

[SysPrepOC]
Sysinternals=setupapi.dll,InstallHinfSection,Sysinternals.inf,Sysinternals

[GlobalOffLineChanges.Install]
AddReg = Sysinternals.Reg

[GlobalOffLineChanges.Uninstall]
DelReg = Sysinternals.Reg

[Sysinternals.Reg]
HKU,".DEFAULT\Software\Sysinternals"
HKU,".DEFAULT\Software\Sysinternals\Process Explorer"
HKU,".DEFAULT\Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00
#2 - HKU, "DefaultUsers\Software\" (as used in OnePiece's WinRAR addon). Same entries.ini as above, but with this for a reg section:

Code: Select all

[Sysinternals.Reg]
HKU,"DefaultUsers\Software\Sysinternals"
HKU,"DefaultUsers\Software\Sysinternals\Process Explorer"
HKU,"DefaultUsers\Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00
#3 - HKU,"UserProfile\Software\" Same entries.ini, but with this for a reg section:

Code: Select all

[Sysinternals.Reg]
HKU,"UserProfile\Software\Sysinternals"
HKU,"UserProfile\Software\Sysinternals\Process Explorer"
HKU,"UserProfile\Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00

User avatar
OnePiece Alb
Posts: 525
Joined: Sat Sep 01, 2007 7:01 pm
Location: Albania
Contact:

Post by OnePiece Alb » Mon Apr 30, 2012 12:56 pm

in the latest release seems that when compiling the exe, something is not ok and went, and very strange but here is their only de HKCU had problems ect ect, a trivial thing, already been repaired

try again with the new version
https://skydrive.live.com/?cid=c5215ade ... BAFE6!1329
https://docs.google.com/open?id=0B5EBub ... 3NMTXFFd2M

respect HKCU, all above example is to give you a more complete idea how it works there, entiries.ini example, integrates it, and after you do a quick installation in VM, and then see after installation, and those registry key that lets the KEY that you are interested ect ect
[SysPrepOC]
;;;Sysinternals=setupapi.dll,InstallHinfSection,Sysinternals.inf,Sysinternals

[GlobalOffLineChanges.Install]
AddReg = Sysinternals.Reg

[GlobalOffLineChanges.Uninstall]
;;DelReg = Sysinternals.Reg

[Sysinternals.Reg]
HKLM,"%KEY_SOFTWARE%\Software\Sysinternals_KEY_SOFTWARE\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_SYSTEM%\Software\Sysinternals_KEY_SYSTEM\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_SECURITY%\Software\Sysinternals_KEY_SECURITY\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_SAM%\Software\Sysinternals_KEY_SAM\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_COMPONENTS%\Software\Sysinternals_KEY_COMPONENTS\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_DEFAULT%\Software\Sysinternals_KEY_DEFAULT\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_NTUSER%\Software\Sysinternals_KEY_NTUSER\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_SCHEMA%\Software\Sysinternals_KEY_SCHEMA\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_NTUSER_SP%\Software\Sysinternals_KEY_NTUSER_SP\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_USRCLASS_SP%\Software\Sysinternals_KEY_USRCLASS_SP\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_NTUSER_LS%\Software\Sysinternals_KEY_NTUSER_LS\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_USRCLASS_LS%\Software\Sysinternals_KEY_USRCLASS_LS\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_NTUSER_NS%\Software\Sysinternals_KEY_NTUSER_NS\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_USRCLASS_NS%\Software\Sysinternals_KEY_USRCLASS_NS\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_NTUSER_ADMIN%\Software\Sysinternals_KEY_NTUSER_ADMIN\Process Explorer","EulaAccepted",0x10001,01,00,00,00
HKLM,"%KEY_USRCLASS_ADMIN%\Software\Sysinternals_KEY_USRCLASS_ADMIN\Process Explorer","EulaAccepted",0x10001,01,00,00,00

[SecurityRegistryBeforeIntegration]
"MACHINE\SYSTEM",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"
"MACHINE\SECURITY",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"
"USERS\SystemProfile",0,"D:P(A;CI;GR;;;LS)(A;CI;GR;;;BU)(A;CI;GR;;;PU)(A;CI;GA;;;BA)(A;CI;GR;;;SY)(A;CI;GR;;;CO)"
"USERS\SystemProfile_Classes",0,"D:P(A;CI;GR;;;LS)(A;CI;GR;;;BU)(A;CI;GR;;;PU)(A;CI;GA;;;BA)(A;CI;GR;;;SY)(A;CI;GR;;;CO)"
"USERS\LocalService_Classes",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)" ;;; or "USERS\S-1-5-19_Classes",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"
"USERS\S-1-5-19",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)" ;;; or "USERS\LocalService",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"
"USERS\S-1-5-20_Classes",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)" ;;; or "USERS\NetworkService_Classes",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"
"USERS\S-1-5-20",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)" ;;; or "USERS\NetworkService",0,"D:P(A;CIOI;GR;;;BU)(A;CIOI;GA;;;BA)(A;CIOI;GA;;;SY)(A;CIOI;GA;;;CO)"

but in general you just need to use normal line, example
[general]
title = Process Explorer
description = Sysinternals Process Explorer
version = 15.13
company = Microsoft Corp.
builddate = 04/29/2012
releasetype = True Addon

[SysPrepOC]
Sysinternals=setupapi.dll,InstallHinfSection,Sysinternals.inf,Sysinternals

[GlobalOffLineChanges.Install]
AddReg = Sysinternals.Reg

[Sysinternals.Reg]
HKCU,"Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00
attention here, and a serious error
[Sysinternals.Reg]

;; this line indicate the inf file, delete everything that is under those keys
HKCU,"Software\Sysinternals"
HKCU,"Software\Sysinternals\Process Explorer"


in this case and all ok, and only Sysinternals Key, but if the HKCU,"Software" ends there, and a serious problem later, you can accidentally delete important registry ect ect

is important to understand how it works and entries.ini + HKCU, if the image and clean and I mean no UserProfile present, the WinNT6.x True Integrator use\update "\Users\default\ntuser.dat", but if that image has been captured with imagex ect ect or is backupsystem.vhd ect ect, WinNT6.x True Integrator in this case tracks the UserProfile, and after use (update\edit ect ect UserProfile) "\Users\UserName\ntuser.dat" ect ect



However in this case you can also use the traditional way, the peruser mod
;
; Entries.ini
;
ect ect ect
ect ect ect
;This section contains entries that need to go into the [Components] section of the OCSysPrep.inf file.
[SysPrepOC]
Sysinternals=setupapi.dll,InstallHinfSection,Sysinternals.inf,Sysinternals
ect ect ect
ect ect ect



;
; Sysinternals INF
;

[Version]
signature="$Windows NT$"

[Sysinternals]
AddReg = Sysinternals.Reg.PerUser

[Sysinternals.PerUser.Goo]
;;CheckAdminRights = 1
AddReg = Sysinternals.Reg

[Sysinternals.Reg]
HKCU,"Software\Sysinternals", , ,
HKCU,"Software\Sysinternals\Process Explorer", , ,
HKCU,"Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00


;;;; This is because setupapi does not know the peruser mod directive
[Sysinternals.Reg.PerUser]
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}",,,"Sysinternals"
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}","ComponentID",,"Sysinternals"
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}","IsInstalled",0x00010001,1,0,0,0
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}","Locale",,
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}","StubPath",0x00020000,"rundll32.exe advpack.dll,LaunchINFSection Sysinternals.inf,Sysinternals.PerUser.Goo"
HKLM,"Software\Microsoft\Active Setup\Installed Components\{X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}","Version",,"1.0.0.0"

Or advpack who knows by default, the peruser mod directive
;
; Entries.ini
;
ect ect ect
ect ect ect
;This section contains entries that need to go into the [Components] section of the OCSysPrep.inf file.
[SysPrepOC]
Sysinternals=advpack.dll,LaunchINFSection,Sysinternals.inf,Sysinternals
ect ect ect
ect ect ect



;
; Sysinternals INF
;
[Version]
signature="$Windows NT$"

[Sysinternals]
PerUserInstall = PerUserInst

[DestinationDirs]
DefaultDestDir = 17

[Sysinternals.Reg.Add]
HKCU,"Software\Sysinternals", , ,
HKCU,"Software\Sysinternals\Process Explorer", , ,
HKCU,"Software\Sysinternals\Process Explorer","EulaAccepted",0x10001,01,00,00,00

[PerUserInst]
DisplayName=Sysinternals
Version=1.0.0000.0
IsInstalled=1
ComponentID=Sysinternals
GUID={X9B49E34-C7CC-11D0-8953-XXXXXXXXXXXX}
Locale=en
StubPath=rundll32.exe advpack.dll,LaunchINFSection %17%\Sysinternals.inf,PerUser.Install,1,N

[PerUser.Install]
;;CheckAdminRights = 1
AddReg = Sysinternals.Reg.Add
watch the http://www.ryanvm.net/forum/viewtopic.p ... 110#113110 just indicate the file.reg, and you create your addon automatically :wink:

apologize again for my English, if you will, when it enters Nonno Fabio will be able to explain most well, but I think you already conscious subject so I think you already understand

Ciao.

RP
Posts: 64
Joined: Tue Jan 01, 2008 4:00 pm

Post by RP » Sun May 13, 2012 8:47 pm

OnePiece,

Thanks much. It worked! That clears out a whole backlog of nonworking HKCU-dependent addons I've been doing (mostly sound schemes).

Post Reply