c++ - RegOpenKeyEx access denied reading HKEY_LOCAL_MACHINE -


in windows 7 (32 bit), consistently error 5 (access denied) when call ::regopenkeyex on hkey_local_machine if not running in administrator mode.

this code:

result = ::regopenkeyex(hkey_local_machine, _t("software\\mycompany\\myapp"), 0, key_query_value, &keysoftware) 

i trying build app can installed entire machine opposed specific user. therefore installer (which run in administrator mode) writes hkey_local_machine, , installer works fine.

i'd app able read data installer has put registry. don't want change of registry data. have tried using key_read , key_execute instead of key_query_value. seems no matter do, cannot read hkey_local_machine without using elevated status. missing here?

your installer needs adjust security permissions on registry key non-admin users allowed access it. have @ regsetkeysecurity(), or installer's equivalent, or number of command-line tools available. can create dacl enables read-only access everyone user group, or specific user accounts.

update: since using inno setup, try in registry setup:

[registry] root: hklm; subkey: "software\mycompany\myapp"; permissions: everyone-read 

or:

[registry] root: hklm; subkey: "software\mycompany\myapp"; permissions: users-read 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -