From bbf36e8903f8e86dcad8131c818e122537c30f9e Mon Sep 17 00:00:00 2001 From: Nikita Nemkin Date: Wed, 24 Jun 2020 04:32:23 +0500 Subject: [PATCH] bpo-41070: Simplify pyshellext.dll build (GH-21037) Replace MIDL-generated file with manual GUID definition. Use the same .def file for release and debug builds. Update setup build to support latest toolset --- PC/pyshellext.cpp | 10 ++++------ PC/pyshellext.def | 1 - PC/pyshellext.idl | 12 ------------ PC/pyshellext_d.def | 6 ------ PCbuild/pyshellext.vcxproj | 4 +--- PCbuild/pyshellext.vcxproj.filters | 8 -------- Tools/msi/bundle/bootstrap/pythonba.vcxproj | 5 +++++ 7 files changed, 10 insertions(+), 36 deletions(-) delete mode 100644 PC/pyshellext.idl delete mode 100644 PC/pyshellext_d.def diff --git a/PC/pyshellext.cpp b/PC/pyshellext.cpp index 019880264be..ffca169857c 100644 --- a/PC/pyshellext.cpp +++ b/PC/pyshellext.cpp @@ -12,15 +12,14 @@ #include #include -#include "pyshellext_h.h" - #define DDWM_UPDATEWINDOW (WM_USER+3) static HINSTANCE hModule; static CLIPFORMAT cfDropDescription; static CLIPFORMAT cfDragWindow; -static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\{BEA218D2-6950-497B-9434-61683EC065FE}"; +#define CLASS_GUID "{BEA218D2-6950-497B-9434-61683EC065FE}" +static const LPCWSTR CLASS_SUBKEY = L"Software\\Classes\\CLSID\\" CLASS_GUID; static const LPCWSTR DRAG_MESSAGE = L"Open with %1"; using namespace Microsoft::WRL; @@ -121,8 +120,7 @@ HRESULT FilenameListCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, LPCWSTR psz return hr; } - -class PyShellExt : public RuntimeClass< +class DECLSPEC_UUID(CLASS_GUID) PyShellExt : public RuntimeClass< RuntimeClassFlags, IDropTarget, IPersistFile @@ -483,7 +481,7 @@ public: } STDMETHODIMP GetClassID(CLSID *pClassID) { - *pClassID = CLSID_PyShellExt; + *pClassID = __uuidof(PyShellExt); return S_OK; } }; diff --git a/PC/pyshellext.def b/PC/pyshellext.def index 5424bd1180d..288a9adf982 100644 --- a/PC/pyshellext.def +++ b/PC/pyshellext.def @@ -1,4 +1,3 @@ -LIBRARY "pyshellext" EXPORTS DllRegisterServer PRIVATE DllUnregisterServer PRIVATE diff --git a/PC/pyshellext.idl b/PC/pyshellext.idl deleted file mode 100644 index c0a183876ad..00000000000 --- a/PC/pyshellext.idl +++ /dev/null @@ -1,12 +0,0 @@ -import "ocidl.idl"; - -[uuid(44039A76-3BDD-41C1-A31B-71C00202CE81), version(1.0)] -library PyShellExtLib -{ - [uuid(BEA218D2-6950-497B-9434-61683EC065FE), version(1.0)] - coclass PyShellExt - { - [default] interface IDropTarget; - interface IPersistFile; - } -}; \ No newline at end of file diff --git a/PC/pyshellext_d.def b/PC/pyshellext_d.def deleted file mode 100644 index 7d2148bb861..00000000000 --- a/PC/pyshellext_d.def +++ /dev/null @@ -1,6 +0,0 @@ -LIBRARY "pyshellext_d" -EXPORTS - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE diff --git a/PCbuild/pyshellext.vcxproj b/PCbuild/pyshellext.vcxproj index 655054e3723..ea432d6bc9a 100644 --- a/PCbuild/pyshellext.vcxproj +++ b/PCbuild/pyshellext.vcxproj @@ -96,7 +96,7 @@ version.lib;shlwapi.lib;%(AdditionalDependencies) Console - ..\PC\pyshellext$(PyDebugExt).def + ..\PC\pyshellext.def true @@ -104,11 +104,9 @@ - - diff --git a/PCbuild/pyshellext.vcxproj.filters b/PCbuild/pyshellext.vcxproj.filters index 36d1d1655f5..77cd3060857 100644 --- a/PCbuild/pyshellext.vcxproj.filters +++ b/PCbuild/pyshellext.vcxproj.filters @@ -15,11 +15,6 @@ Source Files - - - Source Files - - Resource Files @@ -29,8 +24,5 @@ Source Files - - Source Files - \ No newline at end of file diff --git a/Tools/msi/bundle/bootstrap/pythonba.vcxproj b/Tools/msi/bundle/bootstrap/pythonba.vcxproj index 75aad442a44..ef71fe7da08 100644 --- a/Tools/msi/bundle/bootstrap/pythonba.vcxproj +++ b/Tools/msi/bundle/bootstrap/pythonba.vcxproj @@ -21,6 +21,9 @@ Release Win32 + v142 + v141 + v140 v140 v120 {7A09B132-B3EE-499B-A700-A4B2157FEA3D} @@ -47,6 +50,8 @@ comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies) + $(WixInstallPath)sdk\vs2017\lib\x86 + $(WixInstallPath)sdk\vs2017\lib\x86 $(WixInstallPath)sdk\vs2015\lib\x86 $(WixInstallPath)sdk\vs2013\lib\x86 pythonba.def