The following possible failure modes come to mind:
- Your process has no manifest and so is virtualized. The writes succeed but the data lands in the virtual store.
- Your process has a manifest but does not run elevated. The process is not virtualized. The attempts to open keys for writing under
HKLM
therefore fail but your code fails to report that error. - The process is 32 bit and so the access is redirected to the 32 bit view of the registry. The writes succeed but the data lands in the 32 view under
HKLM\Software\Wow6432Node
.
You'll need an application manifest to avoid virtualization. You need to use the requireAdministrator
setting for requestedExecutionLevel
.
Use KEY_WOW64_64KEY
to specify access to the 64 bit view from your 32 bit program.