]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Subject: Bug in PC/import_nt.c
authorGuido van Rossum <guido@python.org>
Mon, 15 Jun 1998 18:01:34 +0000 (18:01 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 15 Jun 1998 18:01:34 +0000 (18:01 +0000)
From: Dan Pierson <dan@remote.control.com>
To: "Mark Hammond (E-mail)" <MHammond@skippinet.com.au>,
    "Guido van Rossum (E-mail)" <guido@cnri.reston.va.us>
Date: Mon, 8 Jun 1998 17:25:07 -0400

RegistryQueryValue requires that its fourth argument be initialized to
the length of the buffer being passed in, this wasn't being done.  I
also split the call and status test into two lines with a local variable
so that I could look at the status in the debugger.

PC/import_nt.c

index 17696976ca456fa9b9954a1a5d9ab2e46a9fc8df..b506694bd58882d5d75bc49f582a3b5bdddb13ce 100644 (file)
@@ -45,6 +45,7 @@ FILE *PyWin_FindRegisteredModule( const char *moduleName, struct filedescr **ppF
        FILE *fp;
        HKEY keyBase = PyWin_IsWin32s() ? HKEY_CLASSES_ROOT : HKEY_LOCAL_MACHINE;
        int modNameSize;
+       long regStat;
 
        // Calculate the size for the sprintf buffer.
        // Get the size of the chars only, plus 1 NULL.
@@ -53,7 +54,9 @@ FILE *PyWin_FindRegisteredModule( const char *moduleName, struct filedescr **ppF
        moduleKey = alloca(bufSize); 
        sprintf(moduleKey, "Software\\Python\\PythonCore\\%s\\Modules\\%s%s", PyWin_DLLVersionString, moduleName, debugString);
 
-       if (RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize)!=ERROR_SUCCESS)
+       modNameSize = bufSize;
+       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++) {