summaryrefslogtreecommitdiffstats
path: root/PC
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-10-03 15:51:12 (GMT)
committerGitHub <noreply@github.com>2019-10-03 15:51:12 (GMT)
commite74fa70bcc379de1ce956273c5386fc8a7b9c5e6 (patch)
tree03264cae1c1434c5b2e8cb1312281cb505d26f00 /PC
parent6067e1d2bebccc2e73dd729d25c98df7bc9e2d59 (diff)
downloadcpython-e74fa70bcc379de1ce956273c5386fc8a7b9c5e6.zip
cpython-e74fa70bcc379de1ce956273c5386fc8a7b9c5e6.tar.gz
cpython-e74fa70bcc379de1ce956273c5386fc8a7b9c5e6.tar.bz2
bpo-38359: Ensures pyw.exe launcher reads correct registry key (GH-16561)
(cherry picked from commit 353fb1ecbfd58752dabae115c4964095e1e35e5f) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'PC')
-rw-r--r--PC/launcher.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/PC/launcher.c b/PC/launcher.c
index a260860..2749a4e 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -141,6 +141,8 @@ static wchar_t * get_env(wchar_t * key)
}
#if defined(_DEBUG)
+/* Do not define EXECUTABLEPATH_VALUE in debug builds as it'll
+ never point to the debug build. */
#if defined(_WINDOWS)
#define PYTHON_EXECUTABLE L"pythonw_d.exe"
@@ -154,10 +156,12 @@ static wchar_t * get_env(wchar_t * key)
#if defined(_WINDOWS)
#define PYTHON_EXECUTABLE L"pythonw.exe"
+#define EXECUTABLEPATH_VALUE L"WindowedExecutablePath"
#else
#define PYTHON_EXECUTABLE L"python.exe"
+#define EXECUTABLEPATH_VALUE L"ExecutablePath"
#endif
#endif
@@ -297,8 +301,12 @@ _locate_pythons_for_key(HKEY root, LPCWSTR subkey, REGSAM flags, int bits,
}
data_size = sizeof(ip->executable) - 1;
append_name = FALSE;
- status = RegQueryValueExW(ip_key, L"ExecutablePath", NULL, &type,
+#ifdef EXECUTABLEPATH_VALUE
+ status = RegQueryValueExW(ip_key, EXECUTABLEPATH_VALUE, NULL, &type,
(LPBYTE)ip->executable, &data_size);
+#else
+ status = ERROR_FILE_NOT_FOUND; /* actual error doesn't matter */
+#endif
if (status != ERROR_SUCCESS || type != REG_SZ || !data_size) {
append_name = TRUE;
data_size = sizeof(ip->executable) - 1;