summaryrefslogtreecommitdiff
path: root/PC
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2000-08-22 11:20:21 +0000
committerMark Hammond <mhammond@skippinet.com.au>2000-08-22 11:20:21 +0000
commita4878fe9271e2b31d9441d54e6dfb65e3ced9600 (patch)
tree45048016c59048a68389dcf355245c5b713d93f9 /PC
parent271403d713c1bb4b153b5478c779f732d51e6c26 (diff)
downloadcpython-a4878fe9271e2b31d9441d54e6dfb65e3ced9600.tar.gz
Registered modules could only exist in HKEY_LOCAL_MACHINE - now HKEY_CURRENT_USER can override.
Diffstat (limited to 'PC')
-rw-r--r--PC/import_nt.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/PC/import_nt.c b/PC/import_nt.c
index f0a27350b0..573106fd3f 100644
--- a/PC/import_nt.c
+++ b/PC/import_nt.c
@@ -34,7 +34,7 @@ FILE *PyWin_FindRegisteredModule(const char *moduleName,
#endif
struct filedescr *fdp = NULL;
FILE *fp;
- HKEY keyBase = HKEY_LOCAL_MACHINE;
+ HKEY keyBase = HKEY_CURRENT_USER;
int modNameSize;
long regStat;
@@ -56,8 +56,17 @@ FILE *PyWin_FindRegisteredModule(const char *moduleName,
modNameSize = pathLen;
regStat = RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize);
- if (regStat != ERROR_SUCCESS)
- return NULL;
+ if (regStat != ERROR_SUCCESS) {
+ /* No user setting - lookup in machine settings */
+ keyBase = HKEY_LOCAL_MACHINE;
+ /* be anal - failure may have reset size param */
+ modNameSize = pathLen;
+ regStat = RegQueryValue(keyBase, moduleKey,
+ pathBuf, &modNameSize);
+
+ if (regStat != ERROR_SUCCESS)
+ return NULL;
+ }
/* use the file extension to locate the type entry. */
for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
size_t extLen = strlen(fdp->suffix);