[python-win32] Python and Win 7 Registry VirtualStore

John Spitzer johned9999 at comcast.net
Tue Jun 4 06:51:34 CEST 2013


Hello,

I've searched the python sites and help, library's and all the forums I 
could find, but haven't seen any mention of this. This help line seemed 
like a good place to ask this.

I am on an HP laptop Intel Core 2 Duo, running Windows 7 Pro SP1 32Bit. 
I am using Python 2.7.3.

I have an application I built that ran fine on Windows XP, but now fails 
on Windows 7. The place I'm encountering the problem is where I try to 
read a key from the registry. I believe it's because of the 
Virtualization of the registry on Windows 7. This key is created by 
another app that I'm trying to co-ordinate with. On Windows XP the 
Registry key was:

[HKEY_LOCAL_MACHINE\SOFTWARE\Interface Software\ConnMgr]
"DB Path"="C:\\Documents and Settings\\All Users\\Application 
Data\\<path to a data file>"

When this app is installed on Windows 7, the key is directed to the 
registry Virtual Store at:
[HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\Interface 
Software\ConnMgr]
"DB Path"="C:\\ProgramData\\EnvisionWare\\<path to a data file>"

So far that is what I think I'd expected on Windows 7 and the 
virtualization of the registry.

The code fragment that is reading the registry is:
-----
from _winreg import *


         ConnKey = OpenKey(HKEY_LOCAL_MACHINE, r'SOFTWARE\Interface 
Software\ConnMgr', 0, KEY_READ)
         ConnValue = QueryValueEx(ConnKey, "DB Path")
         EWDataSource = os.path.split(str(ConnValue[0]))
------
The OpenKey fails with the message: WindowsError: (2, 'The system cannot 
find the file specified"). I believe this is because the key does not 
exist at the path [HKEY_LOCAL_MACHINE\SOFTWARE\Interface Software\ConnMgr].

After all this, the question is: Why isn't the OpenKey call being 
redirected to the VirtualStore? What can I change in the program, ACLs 
or other to make it be redirected?

Any help would be appreciated.
Thanks,
John

-- 
John Spitzer
johned9999 at comcast.net
503-590-7434



More information about the python-win32 mailing list