summaryrefslogtreecommitdiffstats
path: root/PC/bdist_wininst
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-01-16 21:55:05 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-01-16 21:55:05 (GMT)
commit709c2aeba63a63f4bc58813a79f81c89fbd63326 (patch)
tree8dcad4e407b9d0320dae24d2c7b70d01e12a01f1 /PC/bdist_wininst
parentca9aab19ab34b7300d1d6b3f2ab3a6a636e92a88 (diff)
parent332334f1abdca7d8c55f3e8f59da4ca048b42754 (diff)
downloadcpython-709c2aeba63a63f4bc58813a79f81c89fbd63326.zip
cpython-709c2aeba63a63f4bc58813a79f81c89fbd63326.tar.gz
cpython-709c2aeba63a63f4bc58813a79f81c89fbd63326.tar.bz2
Issue #26071: bdist_wininst created binaries fail to start and find 32bit Python
Diffstat (limited to 'PC/bdist_wininst')
-rw-r--r--PC/bdist_wininst/bdist_wininst.vcxproj2
-rw-r--r--PC/bdist_wininst/install.c17
2 files changed, 16 insertions, 3 deletions
diff --git a/PC/bdist_wininst/bdist_wininst.vcxproj b/PC/bdist_wininst/bdist_wininst.vcxproj
index 2ab474e..7971dc7 100644
--- a/PC/bdist_wininst/bdist_wininst.vcxproj
+++ b/PC/bdist_wininst/bdist_wininst.vcxproj
@@ -70,6 +70,8 @@
<Optimization>MinSpace</Optimization>
<AdditionalIncludeDirectories>$(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary Condition="'$(Configuration)'=='Debug'">MultiThreadedDebug</RuntimeLibrary>
+ <RuntimeLibrary Condition="'$(Configuration)'=='Release'">MultiThreaded</RuntimeLibrary>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>$(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c
index 16eeb35..e01dba6 100644
--- a/PC/bdist_wininst/install.c
+++ b/PC/bdist_wininst/install.c
@@ -153,6 +153,13 @@ char *failure_reason = NULL;
HANDLE hBitmap;
char *bitmap_bytes;
+static const char *REGISTRY_SUFFIX_6432 =
+#ifdef MS_WIN64
+ "";
+#else
+ "-32";
+#endif
+
#define WM_NUMFILES WM_USER+1
/* wParam: 0, lParam: total number of files */
@@ -657,8 +664,8 @@ static HINSTANCE LoadPythonDll(char *fname)
if (h)
return h;
wsprintf(subkey_name,
- "SOFTWARE\\Python\\PythonCore\\%d.%d\\InstallPath",
- py_major, py_minor);
+ "SOFTWARE\\Python\\PythonCore\\%d.%d%s\\InstallPath",
+ py_major, py_minor, REGISTRY_SUFFIX_6432);
if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, subkey_name,
fullpath, &size) &&
ERROR_SUCCESS != RegQueryValue(HKEY_LOCAL_MACHINE, subkey_name,
@@ -666,7 +673,9 @@ static HINSTANCE LoadPythonDll(char *fname)
return NULL;
strcat(fullpath, "\\");
strcat(fullpath, fname);
- return LoadLibrary(fullpath);
+ // We use LOAD_WITH_ALTERED_SEARCH_PATH to ensure any dependent DLLs
+ // next to the Python DLL (eg, the CRT DLL) are also loaded.
+ return LoadLibraryEx(fullpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
}
static int prepare_script_environment(HINSTANCE hPython)
@@ -2254,6 +2263,8 @@ int DoInstall(void)
GetPrivateProfileString("Setup", "user_access_control", "",
user_access_control, sizeof(user_access_control), ini_file);
+ strcat(target_version, REGISTRY_SUFFIX_6432);
+
// See if we need to do the Vista UAC magic.
if (strcmp(user_access_control, "force")==0) {
if (!MyIsUserAnAdmin()) {