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
This commit is contained in:
Nikita Nemkin 2020-06-24 04:32:23 +05:00 committed by GitHub
parent 90ed8a6d71
commit bbf36e8903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 36 deletions

View File

@ -12,15 +12,14 @@
#include <olectl.h> #include <olectl.h>
#include <strsafe.h> #include <strsafe.h>
#include "pyshellext_h.h"
#define DDWM_UPDATEWINDOW (WM_USER+3) #define DDWM_UPDATEWINDOW (WM_USER+3)
static HINSTANCE hModule; static HINSTANCE hModule;
static CLIPFORMAT cfDropDescription; static CLIPFORMAT cfDropDescription;
static CLIPFORMAT cfDragWindow; 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"; static const LPCWSTR DRAG_MESSAGE = L"Open with %1";
using namespace Microsoft::WRL; using namespace Microsoft::WRL;
@ -121,8 +120,7 @@ HRESULT FilenameListCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, LPCWSTR psz
return hr; return hr;
} }
class DECLSPEC_UUID(CLASS_GUID) PyShellExt : public RuntimeClass<
class PyShellExt : public RuntimeClass<
RuntimeClassFlags<ClassicCom>, RuntimeClassFlags<ClassicCom>,
IDropTarget, IDropTarget,
IPersistFile IPersistFile
@ -483,7 +481,7 @@ public:
} }
STDMETHODIMP GetClassID(CLSID *pClassID) { STDMETHODIMP GetClassID(CLSID *pClassID) {
*pClassID = CLSID_PyShellExt; *pClassID = __uuidof(PyShellExt);
return S_OK; return S_OK;
} }
}; };

View File

@ -1,4 +1,3 @@
LIBRARY "pyshellext"
EXPORTS EXPORTS
DllRegisterServer PRIVATE DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE DllUnregisterServer PRIVATE

View File

@ -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;
}
};

View File

@ -1,6 +0,0 @@
LIBRARY "pyshellext_d"
EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE

View File

@ -96,7 +96,7 @@
<Link> <Link>
<AdditionalDependencies>version.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>version.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<ModuleDefinitionFile>..\PC\pyshellext$(PyDebugExt).def</ModuleDefinitionFile> <ModuleDefinitionFile>..\PC\pyshellext.def</ModuleDefinitionFile>
</Link> </Link>
<Midl> <Midl>
<CompileInterface>true</CompileInterface> <CompileInterface>true</CompileInterface>
@ -104,11 +104,9 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\PC\pyshellext.cpp" /> <ClCompile Include="..\PC\pyshellext.cpp" />
<Midl Include="..\PC\pyshellext.idl" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\PC\pyshellext.def" /> <None Include="..\PC\pyshellext.def" />
<None Include="..\PC\pyshellext_d.def" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\PC\pyshellext.rc" /> <ResourceCompile Include="..\PC\pyshellext.rc" />

View File

@ -15,11 +15,6 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Midl Include="..\PC\pyshellext.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\PC\pyshellext.rc"> <ResourceCompile Include="..\PC\pyshellext.rc">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
@ -29,8 +24,5 @@
<None Include="..\PC\pyshellext.def"> <None Include="..\PC\pyshellext.def">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</None> </None>
<None Include="..\PC\pyshellext_d.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -21,6 +21,9 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration> <Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">Win32</Platform> <Platform Condition="'$(Platform)' == ''">Win32</Platform>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '16.0' or '$(VisualStudioVersion)' == '16.0')">v142</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and ('$(MSBuildToolsVersion)' == '15.0' or '$(VisualStudioVersion)' == '15.0')">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset> <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath14)' != ''">v140</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset> <PlatformToolset Condition="'$(PlatformToolset)' == '' and '$(VCTargetsPath12)' != ''">v120</PlatformToolset>
<ProjectGuid>{7A09B132-B3EE-499B-A700-A4B2157FEA3D}</ProjectGuid> <ProjectGuid>{7A09B132-B3EE-499B-A700-A4B2157FEA3D}</ProjectGuid>
@ -47,6 +50,8 @@
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib;dutil.lib;balutil.lib;version.lib;uxtheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v142'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v141'">$(WixInstallPath)sdk\vs2017\lib\x86</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v140'">$(WixInstallPath)sdk\vs2015\lib\x86</AdditionalLibraryDirectories> <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v140'">$(WixInstallPath)sdk\vs2015\lib\x86</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v120'">$(WixInstallPath)sdk\vs2013\lib\x86</AdditionalLibraryDirectories> <AdditionalLibraryDirectories Condition="'$(PlatformToolset)' == 'v120'">$(WixInstallPath)sdk\vs2013\lib\x86</AdditionalLibraryDirectories>
<ModuleDefinitionFile>pythonba.def</ModuleDefinitionFile> <ModuleDefinitionFile>pythonba.def</ModuleDefinitionFile>