Reading from and writing to the registry in windows Vista
-
Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera
-
Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera
Sternocera wrote:
This just appears to not work at all on Vista as a regular user...
Do the registry functions fail?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Hello, I'm maintaining an MFC application that reads and writes from/to the registry. Previously, it used the HKEY_LOCAL_MACHINE key. However, this meant that Vista users needed full OS administrative privileges, (and perhaps non-admin XP users, but there aren't a whole lot of those around) which isn't desirable. So, I changed the key used to HKEY_CURRENT_USER. This just appears to not work at all on Vista as a regular user, though it does work elsewhere. How can I store values in the registry without administrative privileges? Regards, Sternocera
You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off). I would recommend the manifest resource file with the security section since it allows you to use registry and file functions without getting false positives from virtualization. I use "AsInvoker" for user apps. "Windows via C/C++, Fifth Edition" by Richter has some good information on dealing with Vista and using manifests correctly. The Microsoft endorsed way of properly designing an application for UAC is to use a security manifest section in your manifest file/resource. Windows Vista Application Development Requirements for User Account Control Compatibility[^] Create and Embed an application manifest[^] Certified for Logo Test Case[^]
-
You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off). I would recommend the manifest resource file with the security section since it allows you to use registry and file functions without getting false positives from virtualization. I use "AsInvoker" for user apps. "Windows via C/C++, Fifth Edition" by Richter has some good information on dealing with Vista and using manifests correctly. The Microsoft endorsed way of properly designing an application for UAC is to use a security manifest section in your manifest file/resource. Windows Vista Application Development Requirements for User Account Control Compatibility[^] Create and Embed an application manifest[^] Certified for Logo Test Case[^]
Bob, Thanks for that, but all I want to do is stored some key:value pair application settings! Surely there is a simpler way?
bob16972 wrote:
You need to include a security section in your manifest file to prevent Registry and File Virtualization for your application (or have the user turn User Access Control [UAC] off).
Why? I thought that registry and file virtualisation where ways in which Vista supported applications that used the registry. Regards, Sternocera