Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions Code/DDevExtensions/D_D130/DDevExtensions.dproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{13bb5c7c-bee9-44e9-863a-a43268dc0228}</ProjectGuid>
<MainSource>DDevExtensions.dpr</MainSource>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<DCC_DCCCompiler>DCC32</DCC_DCCCompiler>
<DCC_DependencyCheckOutputName>..\bin\DDevExtensionsD130.dll</DCC_DependencyCheckOutputName>
<DCC_DependencyCheckOutputName>..\bin\$(Platform)\DDevExtensionsD130.dll</DCC_DependencyCheckOutputName>
<ProjectVersion>20.3</ProjectVersion>
<Config Condition="'$(Config)'==''">Release</Config>
<Basis>True</Basis>
<AppType>Library</AppType>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<ProjectName Condition="'$(ProjectName)'==''">DDevExtensions</ProjectName>
</PropertyGroup>
Expand Down Expand Up @@ -64,20 +64,20 @@
<DllSuffix>D130</DllSuffix>
<DCC_StringChecks>off</DCC_StringChecks>
<DCC_SYMBOL_PLATFORM>false</DCC_SYMBOL_PLATFORM>
<DCC_ExeOutput>..\bin</DCC_ExeOutput>
<DCC_ExeOutput>..\bin\$(Platform)</DCC_ExeOutput>
<DCC_ImageBase>53900000</DCC_ImageBase>
<DCC_DcuOutput>lib</DCC_DcuOutput>
<DCC_DcuOutput>lib\$(Platform)</DCC_DcuOutput>
<UsePackages>true</UsePackages>
<DCC_WIDECHAR_REDUCED>false</DCC_WIDECHAR_REDUCED>
<DCC_DependencyCheckOutputName>..\bin\DDevExtensionsD130.dll</DCC_DependencyCheckOutputName>
<DCC_DependencyCheckOutputName>..\bin\$(Platform)\DDevExtensionsD130.dll</DCC_DependencyCheckOutputName>
<GenDll>true</GenDll>
<DCC_UsePackage>vcl;rtl;designide;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<Debugger_RunParams>-rBDSPlain -pDelphi</Debugger_RunParams>
<Debugger_LoadUnspecifiedSymbols>true</Debugger_LoadUnspecifiedSymbols>
<DCC_Namespace>Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<PreBuildEvent><![CDATA[copy /Y "$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\CompileInterceptorW.dll" "$(OUTPUTDIR)"
<PreBuildEvent><![CDATA[copy /Y "$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win32\CompileInterceptorW.dll" "$(OUTPUTDIR)"
$(PreBuildEvent)]]></PreBuildEvent>
<Debugger_LoadAllSymbols>false</Debugger_LoadAllSymbols>
<Debugger_HostApplication>$(BDS)\Bin\bds.exe</Debugger_HostApplication>
Expand All @@ -87,6 +87,8 @@ $(PreBuildEvent)]]></PreBuildEvent>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_MajorVer>1</VerInfo_MajorVer>
<PreBuildEvent><![CDATA[copy /Y "$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win64\CompileInterceptorW.dll" "$(OUTPUTDIR)"
$(PreBuildEvent)]]></PreBuildEvent>
<VerInfo_MinorVer>0</VerInfo_MinorVer>
<VerInfo_Build>0</VerInfo_Build>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
Expand All @@ -96,8 +98,8 @@ $(PreBuildEvent)]]></PreBuildEvent>
<DCC_DebugInformation>0</DCC_DebugInformation>
<DCC_LocalDebugSymbols>False</DCC_LocalDebugSymbols>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_ObjOutput>lib</DCC_ObjOutput>
<DCC_HppOutput>lib</DCC_HppOutput>
<DCC_ObjOutput>lib\$(Platform)</DCC_ObjOutput>
<DCC_HppOutput>lib\$(Platform)</DCC_HppOutput>
<DCC_ResourcePath>OldPalette;$(DCC_ResourcePath)</DCC_ResourcePath>
<DCC_ObjPath>OldPalette;$(DCC_ObjPath)</DCC_ObjPath>
<DCC_IncludePath>OldPalette;$(DCC_IncludePath)</DCC_IncludePath>
Expand All @@ -110,14 +112,14 @@ $(PreBuildEvent)]]></PreBuildEvent>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_DcuOutput>lib\debug</DCC_DcuOutput>
<DCC_DcuOutput>lib\$(Platform)\debug</DCC_DcuOutput>
<MapFile>3</MapFile>
<ILINK_MapFileType>DetailedSegments</ILINK_MapFileType>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<Version>7.0</Version>
<DCC_MapFile>3</DCC_MapFile>
<DCC_ObjOutput>lib</DCC_ObjOutput>
<DCC_HppOutput>lib</DCC_HppOutput>
<DCC_ObjOutput>lib\$(Platform)</DCC_ObjOutput>
<DCC_HppOutput>lib\$(Platform)</DCC_HppOutput>
<DCC_ResourcePath>OldPalette;$(DCC_ResourcePath)</DCC_ResourcePath>
<DCC_ObjPath>OldPalette;$(DCC_ObjPath)</DCC_ObjPath>
<DCC_IncludePath>OldPalette;$(DCC_IncludePath)</DCC_IncludePath>
Expand Down Expand Up @@ -1176,15 +1178,35 @@ $(PreBuildEvent)]]></PreBuildEvent>
<Import Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')" Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
<PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win32'">
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;</PreBuildEvent>
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win32\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;
</PreBuildEvent>
<PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
<PreLinkEvent/>
<PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
<PostBuildEvent/>
<PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' And '$(Platform)'=='Win64'">
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win64\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;
</PreBuildEvent>
<PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
<PreLinkEvent/>
<PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
<PostBuildEvent/>
<PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win32'">
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;</PreBuildEvent>
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win32\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;
</PreBuildEvent>
<PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
<PreLinkEvent/>
<PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
<PostBuildEvent/>
<PostBuildEventIgnoreExitCode>False</PostBuildEventIgnoreExitCode>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' And '$(Platform)'=='Win64'">
<PreBuildEvent>copy /Y &quot;$(PROJECTDIR)\..\..\..\CompileInterceptor\Bin\Win64\CompileInterceptorW.dll&quot; &quot;$(OUTPUTDIR)&quot;
</PreBuildEvent>
<PreBuildEventIgnoreExitCode>False</PreBuildEventIgnoreExitCode>
<PreLinkEvent/>
<PreLinkEventIgnoreExitCode>False</PreLinkEventIgnoreExitCode>
Expand Down
26 changes: 26 additions & 0 deletions Code/DDevExtensions/Source/CompileProgress/CompileProgress.pas
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ function CompileActiveProject(Instance: TObject; CompileMode: TCompileMode; Wait
end;

{$IF CompilerVersion >= 21.0} // Delphi 2010+
{$IFDEF CPUX86}
procedure HookedProjectGroupCompileActive;
asm
// Only show the dialog if we are called by TAppBuilder.Compile()
Expand All @@ -384,13 +385,38 @@ procedure HookedProjectGroupCompileActive;
jb CompileActiveProject
jmp CallOrgProjectGroupCompileActive
end;
{$ENDIF CPUX86}
{$IFDEF CPUX64}
procedure HookedProjectGroupCompileActive;
asm
// Only show the dialog if we are called by TAppBuilder.Compile()
// Win64 calling convention: RCX=Self, RDX=CompileMode, R8=Wait
// Return address is at [RSP], RAX and R9 are volatile scratch registers
mov rax, [rsp] // ret-addr
sub rax, 5 // call instruction size
mov r9, OrgAppBuilderCompile
sub rax, r9 // rax = difference between TAppBuilder.Compile and the return address
jns @@Compare
neg rax
@@Compare:
cmp rax, 30 // We can be called from TAppBuilder.Compile() within 30 bytes
jb CompileActiveProject
jmp CallOrgProjectGroupCompileActive
end;
{$ENDIF CPUX64}

procedure InitPlugin(Unload: Boolean);
// We can't hook into bds.exe because the copy protection will catch us. So we need to go a different
// way than what we used to do in Delphi 2009.
const
{$IFDEF CPUX86}
StartCompileSymbol = '@Comprgrs@TProgressForm@StartCompile$qqrv';
ProjectGroupCompileActiveSymbol = '@Projectgroup@TProjectGroup@CompileActive$qqr21Compintf@TCompileModeo';
{$ENDIF}
{$IFDEF CPUX64}
StartCompileSymbol = '_ZN8Comprgrs13TProgressForm12StartCompileEv';
ProjectGroupCompileActiveSymbol = '_ZN12Projectgroup13TProjectGroup13CompileActiveEN8Compintf12TCompileModeEb';
{$ENDIF}
var
Ctx: TRttiContext;
MainType: TRttiType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ TBuildControl = record
FSilent: Boolean;
FWait: Boolean;
end;
{$IFEND}

{$IFDEF CPUX86}
{$IF CompilerVersion >= 22.0} // XE+
procedure TCompiler_Compile(Compiler: TObject; var BuildInfo: TProjectBuildInfo; const BuildControl: TBuildControl; const FileName: string);
external delphicoreide_bpl name '@Basepascomintf@TCompiler@Compile$qqrr26Compintf@TProjectBuildInforx22Compintf@TBuildControlx20System@UnicodeString';
var
Expand All @@ -114,14 +117,27 @@ function TCompiler_Compile(Compiler: TObject; const FileName: string; const Proj
var
Org_TCompiler_Compile: function(Compiler: TObject; const FileName: string; const Project: ICustomProject; CompileMode: TCompileMode; Wait, ClearPackages, ClearMessages: Boolean; FinishProc: TCompileFinishedProc): TCompileResult;
{$IFEND}
{$ENDIF CPUX86}
{$IFDEF CPUX64}
procedure TCompiler_Compile(Compiler: TObject; var BuildInfo: TProjectBuildInfo; const BuildControl: TBuildControl; const FileName: string);
external delphicoreide_bpl name '_ZN14Basepascomintf9TCompiler7CompileERN8Compintf17TProjectBuildInfoERKNS1_13TBuildControlEN6System13UnicodeStringE';
var
Org_TCompiler_Compile: procedure(Compiler: TObject; var BuildInfo: TProjectBuildInfo; const BuildControl: TBuildControl; const FileName: string);
{$ENDIF CPUX64}

{$IFDEF CPUX86}
{$IF CompilerVersion >= 23.0} // XE2+
function TCustomCodeIProject_GetCompState(Project: TObject; const PlatformName: string): Integer;
external coreide_bpl name '@Projectmodule@TCustomCodeIProject@GetCompState$qqrx20System@UnicodeString';
{$ELSE}
function TCustomCodeIProject_GetCompState(Project: TObject): Integer;
external coreide_bpl name '@Projectmodule@TCustomCodeIProject@GetCompState$qqrv';
{$IFEND}
{$ENDIF CPUX86}
{$IFDEF CPUX64}
function TCustomCodeIProject_GetCompState(Project: TObject; const PlatformName: string): Integer;
external coreide_bpl name '_ZN13Projectmodule19TCustomCodeIProject12GetCompStateEN6System13UnicodeStringE';
{$ENDIF CPUX64}

procedure NopClearCompState(CompState: Integer); stdcall;
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ implementation
sCurrFileLabelName = 'CurrFile';
{$IFEND}

{$IFDEF CPUX86}
procedure ProgressFormPtr;
external coreide_bpl name '@Comprgrs@ProgressForm';
{$ENDIF}
{$IFDEF CPUX64}
procedure ProgressFormPtr;
external coreide_bpl name '_ZN8Comprgrs12ProgressFormE';
{$ENDIF}

var
ProgressFormP: ^TForm;
Expand Down
14 changes: 14 additions & 0 deletions Code/DDevExtensions/Source/DSUFeatures/DSUFeatures.pas
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,20 @@ function HookedLoadPackageEx(const Name: string; AValidatePackage: TValidatePack

procedure PreInit;
const
{$IFDEF CPUX86}
sLoadPackageCache = '@Pascpppakmgr@TProfileData@LoadPackageCache$qqr' + _xp_ + System_Inifiles_TCustomIniFile;
sSavePackageCache = '@Pascpppakmgr@TProfileData@SavePackageCache$qqr' + _xp_ + System_Inifiles_TCustomIniFile + 'o';

sPaletteItemDelegateSaveData = '@Comppalmgr@TComponentPalettePageItemDelegate@SaveData$qqr' + _xp_ + System_Inifiles_TCustomIniFile;
sPaletteItemDelegateLoadData = '@Comppalmgr@TComponentPalettePageItemDelegate@LoadData$qqr' + _xp_ + System_Inifiles_TCustomIniFile;
{$ENDIF CPUX86}
{$IFDEF CPUX64}
sLoadPackageCache = '_ZN12Pascpppakmgr12TProfileData16LoadPackageCacheEPN6System8Inifiles14TCustomIniFileE';
sSavePackageCache = '_ZN12Pascpppakmgr12TProfileData16SavePackageCacheEPN6System8Inifiles14TCustomIniFileEb';

sPaletteItemDelegateSaveData = '_ZN10Comppalmgr33TComponentPalettePageItemDelegate8SaveDataEPN6System8Inifiles14TCustomIniFileE';
sPaletteItemDelegateLoadData = '_ZN10Comppalmgr33TComponentPalettePageItemDelegate8LoadDataEv';
{$ENDIF CPUX64}

RetCode: Byte = $C3;
var
Expand All @@ -263,7 +272,12 @@ procedure PreInit;

procedure InitPlugin(Unload: Boolean);
const
{$IFDEF CPUX86}
sLoadPackageEx = Unit_System_SysUtils + '@LoadPackage$qqrx20System@UnicodeStringpqqrui$o';
{$ENDIF CPUX86}
{$IFDEF CPUX64}
sLoadPackageEx = '_ZN6System8Sysutils11LoadPackageENS_13UnicodeStringEPFbyE';
{$ENDIF CPUX64}
var
LibCoreide, LibRtl: THandle;
begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,23 @@ TMethodSymbol = class(TBaseSymbol)
CallAddrTSortedThingList_SetSortedP: PByte;
CompleteMethodSymbolTableIteratorP: PByte;

{$IFDEF CPUX86}
function TClassSymbol_MethodAddPos(Instance: TClassSymbol; const Name: string): Integer;
external delphicoreide_bpl name '@Pasmgr@TClassSymbol@MethodAddPos$qqrx20System@UnicodeString';
{$ENDIF}
{$IFDEF CPUX64}
function TClassSymbol_MethodAddPos(Instance: TClassSymbol; const Name: string): Integer;
external delphicoreide_bpl name '_ZN6Pasmgr12TClassSymbol12MethodAddPosEN6System13UnicodeStringE';
{$ENDIF}

{$IFDEF CPUX86}
procedure TPascalClassCompleter_Complete;
external delphicoreide_bpl name '@Completers@TPascalClassCompleter@Complete$qqrx20System@UnicodeString';
{$ENDIF}
{$IFDEF CPUX64}
procedure TPascalClassCompleter_Complete;
external delphicoreide_bpl name '_ZN10Completers21TPascalClassCompleter8CompleteEN6System13UnicodeStringE';
{$ENDIF}

function TClassSymbol_MethodAddPos_AlphSort(Instance: TClassSymbol; const Name: string): Integer;
begin
Expand Down Expand Up @@ -266,6 +278,7 @@ function TTableIterator_Create(ASymbolTable: TSymbolTable): TTableIterator;
Result := TTableIterator.Create(ASymbolTable);
end;

{$IFDEF CPUX86}
function MethodSymbolTableIteratorFactory(AClass: TClass; DL: Integer; ASymbolTable: TSymbolTable): TTableIterator;
asm
push ecx
Expand All @@ -284,6 +297,13 @@ function MethodSymbolTableIteratorFactory(AClass: TClass; DL: Integer; ASymbolTa
pop eax
call TTableIterator_Create
end;
{$ELSE}
function MethodSymbolTableIteratorFactory(AClass: TClass; DL: Integer; ASymbolTable: TSymbolTable): TTableIterator;
begin
// Win64: simplified fallback - just create the iterator without sorting hack
Result := TTableIterator_Create(ASymbolTable);
end;
{$ENDIF CPUX86}
{begin
// Sort all items that are already collected
OrgTSortedThingList_SetSorted(ThingList, True);
Expand All @@ -296,6 +316,7 @@ function MethodSymbolTableIteratorFactory(AClass: TClass; DL: Integer; ASymbolTa
{-------------------------------------------------------------------------------------------------}

procedure InstallDisableAlphaSortClassCompletion(Value: Boolean);
{$IFDEF CPUX86}
const
CompleteSetSortedBytes: array[0..18] of SmallInt = (
$B2, $01, // mov dl,$01 // 0
Expand Down Expand Up @@ -403,5 +424,10 @@ procedure InstallDisableAlphaSortClassCompletion(Value: Boolean);
ReplaceRelCallOffset(@CallAddrTSortedThingList_SetSortedP[CallOffsetSetSorted], OrgTSortedThingList_SetSorted);
end;
end;
{$ELSE}
begin
// Win64: x86 byte-pattern matching is not applicable, feature not available
end;
{$ENDIF CPUX86}

end.
Loading