winapi - How to use RegDeleteTree to delete KEY_WOW64_64KEY key? -
i have tested regdeletetree()
in 32bit program. delete key_wow64_32key
key. there function regopenkeyex()
specify key_wow64_32key
or key_wow64_64key
?
i have tired code:
hkey key = null; if (regopenkeyex(hkey_local_machine, _t("software\\asd"), 0, key_read | key_wow64_64key, &key) == error_success) { long d = regdeletetree(key, null); if (d != error_success) { cout << "error" << d; } else { cout << "success"; } }
the output success key still exits in registry. i'm running on windows 7 vs 2013 , compiled win32 program not x64.
use regopenkeyex
key_wow64_64key
open 64 bit view of key. call regdeletetree
passing returned key.
regarding update. ask read access when opening key. documentation regdeletetree
states:
the key must have been opened following access rights: delete, key_enumerate_sub_keys, , key_query_value.
the fact call succeeds anyway makes me think process subject virtualization. need have manifest process forces uac elevation. use requireadministrator
option in manifest.
Comments
Post a Comment