Page 1 of 1

[SOLVED] readstring registry function

Published: April 3, 2025 - 11:01 AM
by guigeek
Good morning,
I'm having trouble accessing a specific registry:
Are you able to run this command?

Code: Select all

 registry_readstring(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State\\Machine\\Scripts\\Shutdown\\0\\0','Script')
I always get an empty result.

The command does work on the top tree, for example

Code: Select all

registry_readstring(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State\\Machine\\Scripts\\Shutdown\\0','DisplayName')
Similarly, if I use reg_key_exists, the function has a specific return value:

Code: Select all

reg_key_exists(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State\\Machine\\Scripts\\Shutdown\\0')
Returns True

but

Code: Select all

reg_key_exists(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\State\\Machine\\Scripts\\Shutdown\\0\\0')
Returns

Code: Select all

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Program Files (x86)\wapt\waptutils.py", line 2786, in reg_key_exists
    with reg_openkey_noredir(rootkey, subkeypath):
AttributeError: __enter__
Any idea why this behavior occurs?

THANKS !
Good day,

Re: readstring registry function

Published: April 3, 2025 - 11:53 AM
by guigeek
Sorry, I just saw it was a permissions issue.
It works as an admin.

Re: readstring registry function

Published: April 4, 2025 - 12:56 PM
by dcardon
Hello Guillaume,
guigeek wrote: Apr 3, 2025 - 11:53 Sorry, I just saw it was a permissions issue.
It works as admin.
No worries, it happens to the best of us ;)

Sincerely,

Denis