Skip to content

Commit

Permalink
Reorganized examples
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Feb 28, 2018
1 parent 0ddec52 commit 78df3b3
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ program CustomFormatter;

uses
System.SysUtils,
Zydis in '..\..\Zydis\Zydis.pas',
Zydis.Exception in '..\..\Zydis\Zydis.Exception.pas',
Zydis.Decoder in '..\..\Zydis\Zydis.Decoder.pas',
Zydis.Formatter in '..\..\Zydis\Zydis.Formatter.pas';
Zydis in '..\Zydis\Zydis.pas',
Zydis.Exception in '..\Zydis\Zydis.Exception.pas',
Zydis.Decoder in '..\Zydis\Zydis.Decoder.pas',
Zydis.Formatter in '..\Zydis\Zydis.Formatter.pas';

{* ============================================================================================== *}
{* Formatter *}
Expand Down
124 changes: 124 additions & 0 deletions Examples/CustomFormatter.dproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{2F0CE0AE-FA5B-40AF-A42A-F03C996A119D}</ProjectGuid>
<ProjectVersion>18.3</ProjectVersion>
<FrameworkType>None</FrameworkType>
<MainSource>CustomFormatter.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Console</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<SanitizedProjectName>CustomFormatter</SanitizedProjectName>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<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_Locale>1033</VerInfo_Locale>
<DCC_ConsoleTarget>true</DCC_ConsoleTarget>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<Icon_MainIcon>Zydis.ico</Icon_MainIcon>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_ConsoleTarget>true</DCC_ConsoleTarget>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<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_Locale>1033</VerInfo_Locale>
<Icon_MainIcon>Zydis.ico</Icon_MainIcon>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Zydis\Zydis.pas"/>
<DCCReference Include="..\Zydis\Zydis.Exception.pas"/>
<DCCReference Include="..\Zydis\Zydis.Decoder.pas"/>
<DCCReference Include="..\Zydis\Zydis.Formatter.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
File renamed without changes.
41 changes: 41 additions & 0 deletions Examples/Examples.groupproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{D2FEAC7B-BA6A-4F35-B075-A47A8CB9AE80}</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<Projects Include="CustomFormatter.dproj">
<Dependencies/>
</Projects>
<Projects Include="SimpleDemo.dproj">
<Dependencies/>
</Projects>
</ItemGroup>
<Target Name="CustomFormatter">
<MSBuild Projects="CustomFormatter.dproj"/>
</Target>
<Target Name="CustomFormatter:Clean">
<MSBuild Projects="CustomFormatter.dproj" Targets="Clean"/>
</Target>
<Target Name="CustomFormatter:Make">
<MSBuild Projects="CustomFormatter.dproj" Targets="Make"/>
</Target>
<Target Name="SimpleDemo">
<MSBuild Projects="SimpleDemo.dproj"/>
</Target>
<Target Name="SimpleDemo:Clean">
<MSBuild Projects="SimpleDemo.dproj" Targets="Clean"/>
</Target>
<Target Name="SimpleDemo:Make">
<MSBuild Projects="SimpleDemo.dproj" Targets="Make"/>
</Target>
<Target Name="Build">
<CallTarget Targets="CustomFormatter;SimpleDemo"/>
</Target>
<Target Name="Clean">
<CallTarget Targets="CustomFormatter:Clean;SimpleDemo:Clean"/>
</Target>
<Target Name="Make">
<CallTarget Targets="CustomFormatter:Make;SimpleDemo:Make"/>
</Target>
<Import Project="$(BDS)\Bin\CodeGear.Group.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Group.Targets')"/>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ program SimpleDemo;

uses
System.SysUtils,
Zydis in '../../Zydis/Zydis.pas',
Zydis.Exception in '../../Zydis/Zydis.Exception.pas',
Zydis.Decoder in '../../Zydis/Zydis.Decoder.pas',
Zydis.Formatter in '../../Zydis/Zydis.Formatter.pas';
Zydis in '../Zydis/Zydis.pas',
Zydis.Exception in '../Zydis/Zydis.Exception.pas',
Zydis.Decoder in '../Zydis/Zydis.Decoder.pas',
Zydis.Formatter in '../Zydis/Zydis.Formatter.pas';

{* ============================================================================================== *}
{* Entry point *}
Expand Down
124 changes: 124 additions & 0 deletions Examples/SimpleDemo.dproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{B67489E9-839F-402C-93DB-B014EBB1B4B4}</ProjectGuid>
<ProjectVersion>18.3</ProjectVersion>
<FrameworkType>None</FrameworkType>
<MainSource>SimpleDemo.dpr</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<TargetedPlatforms>3</TargetedPlatforms>
<AppType>Console</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''">
<Cfg_2_Win64>true</Cfg_2_Win64>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\$(Platform)\$(Config)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<SanitizedProjectName>SimpleDemo</SanitizedProjectName>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<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_Locale>1033</VerInfo_Locale>
<DCC_ConsoleTarget>true</DCC_ConsoleTarget>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<Icon_MainIcon>Zydis.ico</Icon_MainIcon>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_ConsoleTarget>true</DCC_ConsoleTarget>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<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_Locale>1033</VerInfo_Locale>
<Manifest_File>(Ohne)</Manifest_File>
<Icon_MainIcon>Zydis.ico</Icon_MainIcon>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>(Ohne)</Manifest_File>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="..\Zydis\Zydis.pas"/>
<DCCReference Include="..\Zydis\Zydis.Exception.pas"/>
<DCCReference Include="..\Zydis\Zydis.Decoder.pas"/>
<DCCReference Include="..\Zydis\Zydis.Formatter.pas"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>
File renamed without changes.
2 changes: 1 addition & 1 deletion Zydis/Zydis.Decoder.pas
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface
System.SysUtils, Zydis, Zydis.Exception;

type
TZydisDecoder = class(TObject)
TZydisDecoder = class sealed(TObject)
strict private
FContext: Zydis.TZydisDecoder;
public
Expand Down
5 changes: 2 additions & 3 deletions Zydis/Zydis.Formatter.pas
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ TZydisFormatter = class(TObject)
var Str: TZydisString; const Instruction: TZydisDecodedInstruction;
const Operand: TZydisDecodedOperand; Decorator: TZydisDecoratorType): TZydisStatus; virtual;
public
function FormatInstruction(const Instruction: TZydisDecodedInstruction): String; inline;
function FormatOperand(const Instruction: TZydisDecodedInstruction;
Index: ZydisU8): String; inline;
function FormatInstruction(const Instruction: TZydisDecodedInstruction): String;
function FormatOperand(const Instruction: TZydisDecodedInstruction; Index: ZydisU8): String;
public
constructor Create(Style: TZydisFormatterStyle);
public
Expand Down

0 comments on commit 78df3b3

Please sign in to comment.