changeset: 99943:db74f3a4cbeb parent: 99941:cf868f77b400 parent: 99942:daa6fdaf9835 user: Steve Dower date: Sat Jan 16 13:55:05 2016 -0800 files: Misc/NEWS PC/bdist_wininst/install.c description: Issue #26071: bdist_wininst created binaries fail to start and find 32bit Python diff -r cf868f77b400 -r db74f3a4cbeb Lib/distutils/command/wininst-14.0-amd64.exe Binary file Lib/distutils/command/wininst-14.0-amd64.exe has changed diff -r cf868f77b400 -r db74f3a4cbeb Lib/distutils/command/wininst-14.0.exe Binary file Lib/distutils/command/wininst-14.0.exe has changed diff -r cf868f77b400 -r db74f3a4cbeb Misc/NEWS --- a/Misc/NEWS Sat Jan 16 13:48:31 2016 -0800 +++ b/Misc/NEWS Sat Jan 16 13:55:05 2016 -0800 @@ -613,6 +613,9 @@ Windows ------- +- Issue #26071: bdist_wininst created binaries fail to start and find + 32bit Python + - Issue #26073: Update the list of magic numbers in launcher - Issue #26065: Excludes venv from library when generating embeddable diff -r cf868f77b400 -r db74f3a4cbeb PC/bdist_wininst/bdist_wininst.vcxproj --- a/PC/bdist_wininst/bdist_wininst.vcxproj Sat Jan 16 13:48:31 2016 -0800 +++ b/PC/bdist_wininst/bdist_wininst.vcxproj Sat Jan 16 13:55:05 2016 -0800 @@ -70,6 +70,8 @@ MinSpace $(PySourcePath)Modules\zlib;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) + MultiThreadedDebug + MultiThreaded $(PySourcePath)PC\bdist_wininst;%(AdditionalIncludeDirectories) diff -r cf868f77b400 -r db74f3a4cbeb PC/bdist_wininst/install.c --- a/PC/bdist_wininst/install.c Sat Jan 16 13:48:31 2016 -0800 +++ b/PC/bdist_wininst/install.c Sat Jan 16 13:55:05 2016 -0800 @@ -153,6 +153,13 @@ 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 @@ 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 @@ 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 @@ 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()) {