You are here

Force program to read HKCU instead of HKLM

5 posts / 0 new
Last post
Soulfate
Offline
Last seen: 8 years 6 months ago
Joined: 2015-09-15 07:22
Force program to read HKCU instead of HKLM

Hi,
I want to make a BATCH script to "portabilize" a program that doesn't need more than "users" rights (doesn't need "Admin" rights/privileges). That program reads registry keys and values in HK_LOCAL_MACHINE to define some options and variables.

I would like to force that program to read HK_CURRENT_USER (or any other registry key that doesn't need more than "users" rights) instead of HK_LOCAL_MACHINE because I don't want my BATCH script to need elevated privileges (and call an UAC prompt) to set up my program.

Furthermore, if it is also possible to redirect a folder that need elevated privileges to another folder (that doesn't need elevated privileges) without the need to elevate privileges, I'm interested. It's not important for this case because my program doesn't write or read anything in any folder needing elevated privileges, but it could be really interesting for future "portabilizations".
I know that I could use "MKLINK /j" command to redirect a folder to another, but if the junction is created into an elevated privileges folder, script needs elevated privileges.

Thank you for any help Wink

richo
richo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2007-01-31 22:03
RE: Force program to read HKCU instead of HKLM

As far as my understanding of it goes, this is not possible without hacking the program.

The UAC system is supposed to already redirect folders and registry when a pre-vista program is run (provided a compatibility shim has been created for the program)

P.S: Some of this is likely wrong, so someone with more knowledge on the matter will likely correct me.

Soulfate
Offline
Last seen: 8 years 6 months ago
Joined: 2015-09-15 07:22
Thank you for your help

Thank you for your help Wink
I know that virtualization tools are able to run a program that read/write in a virtual HKLM instead of the real and that process doesn't need elevated privileges, even for virtualized HKLM modifications.
Is that solution possible ? Is there a simple command line tool to run a program through virtualized environnement ?

Thank you!

richo
richo's picture
Offline
Last seen: 1 month 2 weeks ago
Joined: 2007-01-31 22:03
RE: simple command line tool

The only tool i know of that provides something like that is ThInstall, but that is a very expensive commercial program. I have used JauntePE in the past, but at the time it was a bit broken because of API changes in Windows Vista. Whether or not that has since been fixed is another story.

Soulfate
Offline
Last seen: 8 years 6 months ago
Joined: 2015-09-15 07:22
JauntePE

JauntePE works well on Windows 10 64-bit !
I've to use Resource Hacker to finalize the portable launcher (EXE file) to define a relative path instead of absolute and it works as expected.
Now, I'm going with scripts to customize registry values (they are statics with JauntePE and there is no variable to use)
Thank you so much

Log in or register to post comments