summaryrefslogtreecommitdiffstats
path: root/PC/import_nt.c
diff options
context:
space:
mode:
authorMark Hammond <mhammond@skippinet.com.au>2000-08-22 11:20:21 (GMT)
committerMark Hammond <mhammond@skippinet.com.au>2000-08-22 11:20:21 (GMT)
commit48b3eee170d84909ed6f7888374847ade0c3b01d (patch)
tree144b89f4ca5994cbd2723c229e24c5d0660afedd /PC/import_nt.c
parent79f1c1778d328b42e67e1480d3a2349e9408d634 (diff)
downloadcpython-48b3eee170d84909ed6f7888374847ade0c3b01d.zip
cpython-48b3eee170d84909ed6f7888374847ade0c3b01d.tar.gz
cpython-48b3eee170d84909ed6f7888374847ade0c3b01d.tar.bz2
Registered modules could only exist in HKEY_LOCAL_MACHINE - now HKEY_CURRENT_USER can override.
Diffstat (limited to 'PC/import_nt.c')
-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 f0a2735..573106f 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);