diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2001-02-23 11:38:38 (GMT) |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2001-02-23 11:38:38 (GMT) |
commit | 5edc627f6646f34a1d474d9fbbaf6537cc069a43 (patch) | |
tree | bce7e367b7ff8022bdc092af17e899143e3549b0 /PC/getpathp.c | |
parent | af449638b61438121c26f911295eec559cf68406 (diff) | |
download | cpython-5edc627f6646f34a1d474d9fbbaf6537cc069a43.zip cpython-5edc627f6646f34a1d474d9fbbaf6537cc069a43.tar.gz cpython-5edc627f6646f34a1d474d9fbbaf6537cc069a43.tar.bz2 |
Checkin updated version of patch #103933 . As Thomas says, fixes the bugs #131064, #129584, #127722. See the discussion in bug #131064
Diffstat (limited to 'PC/getpathp.c')
-rw-r--r-- | PC/getpathp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/PC/getpathp.c b/PC/getpathp.c index d4366df..760a575 100644 --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -199,6 +199,10 @@ extern const char *PyWin_DLLVersionString; Ex family of functions so it also works with Windows CE. Returns NULL, or a pointer that should be freed. + + XXX - this code is pretty strange, as it used to also + work on Win16, where the buffer sizes werent available + in advance. It could be simplied now Win16/Win32s is dead! */ static char * @@ -279,6 +283,7 @@ getpythonregpath(HKEY keyBase, int skipcore) } RegCloseKey(subKey); } + /* original datasize from RegQueryInfo doesn't include the \0 */ dataBuf = malloc((dataSize+1) * sizeof(TCHAR)); if (dataBuf) { TCHAR *szCur = dataBuf; @@ -299,8 +304,11 @@ getpythonregpath(HKEY keyBase, int skipcore) if (skipcore) *szCur = '\0'; else { - *(szCur++) = _T(';'); - dataSize--; + /* If we have no values, we dont need a ';' */ + if (numKeys) { + *(szCur++) = _T(';'); + dataSize--; + } /* Now append the core path entries - this will include the NULL */ |