]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Registered modules could only exist in HKEY_LOCAL_MACHINE - now HKEY_CURRENT_USER...
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 22 Aug 2000 11:20:21 +0000 (11:20 +0000)
committerMark Hammond <mhammond@skippinet.com.au>
Tue, 22 Aug 2000 11:20:21 +0000 (11:20 +0000)
PC/import_nt.c

index f0a27350b0844519916c5e1de47c65699c022eaf..573106fd3ff2f390dcaa56fab41b7b37a0d38831 100644 (file)
@@ -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);