Page 1 of 1

[Resolved] Problem with the registry

Published: February 27, 2018 - 09:19
by dsp
Good morning,
I have a small problem; when I try to modify the HKEY_CURRENT_USER For example:

Code: Select all

registry_setstring(HKEY_CURRENT_USER,r'Software\Microsoft\Windows\CurrentVersion\Internet Settings','toto1','tata1')
The Wapt agent on the other machine makes the change in the HKEY_USERS.
Did I do something wrong?

Sincerely

Re: Problem with the registry

Published: February 27, 2018 - 09:48
by agauvrit
Good morning,

This is what is called a context problem.

The beehive HKEY_CURRENT_USER refers to the current user context, therefore during package installation (function install() ), this refers to the local SYSTEM user of the machine.

During your tests, this must have worked very well since the modifications are made in the hive of the user account used for package development.
But once the package is pushed to the workstations, the changes are not made in the user hives.

If you need to make changes to the user hive, you should therefore execute the function within the user customization context by defining the function session_setup():

Code: Select all

def install():
	[...]

def session_setup():
	registry_setstring(HKEY_CURRENT_USER,r'Software\Microsoft\Windows\CurrentVersion\Internet Settings','toto1','tata1')
The documentation on this subject: https://www.wapt.fr/fr/doc-1.5/Creation ... index.html

Sincerely,

Alexander

Re: Problem with the registry

Published: February 27, 2018 - 10:20 AM
by dsp
Thanks for your quick reply, it works better when things are done correctly ^^