Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Zydis-Pascal to the latest Zydis version #2

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3c9e1cc
Remove Old Files
Coldzer0 Oct 31, 2023
eb1d27a
Update .gitignore
Coldzer0 Oct 31, 2023
0060b6e
Update README.md
Coldzer0 Oct 31, 2023
3d619b2
Sync Zydis with the latest update v4.0.0
Coldzer0 Oct 31, 2023
00fe65f
Create libZydis.a
Coldzer0 Oct 31, 2023
594e1b7
Disassembler example
Coldzer0 Oct 31, 2023
b77602e
DisassembleSimple example
Coldzer0 Oct 31, 2023
77796bc
PascalCased filenames
Coldzer0 Oct 31, 2023
5584e5e
More PascalCased filenames
Coldzer0 Oct 31, 2023
ac883b8
Added Pointer Types for all Zyan types
Coldzer0 Nov 1, 2023
7b4df05
Added ZYAN_FAILED to check if the return status is failure
Coldzer0 Nov 1, 2023
5291745
Formatter types unit
Coldzer0 Nov 1, 2023
49adc6f
Decoder Types Unit
Coldzer0 Nov 1, 2023
447f253
Disassembler Types Unit
Coldzer0 Nov 1, 2023
205c68a
Update Zydis.Enums.pas
Coldzer0 Nov 1, 2023
f669d3e
Added Encoder APIs and Types
Coldzer0 Nov 1, 2023
95cb837
Add License to units headers
Coldzer0 Nov 1, 2023
b28b821
Add Win & Linux x64 Static Library
Coldzer0 Nov 1, 2023
6524683
Added EncodeFromScratch Example
Coldzer0 Nov 1, 2023
3bf9167
Change `lpr` to `dpr`
Coldzer0 Nov 1, 2023
9a288d3
Change `lpr` to `dpr` for Disassembler Example
Coldzer0 Nov 1, 2023
bc1057d
Update Zydis.Types.pas
Coldzer0 Nov 1, 2023
f563156
Add Linux binraies to .gitignore
Coldzer0 Nov 2, 2023
34389e9
Delphi compatibility changes
Coldzer0 Nov 2, 2023
91dd65f
Examples Delphi compatibility changes
Coldzer0 Nov 2, 2023
b60c961
Added dynamic libs for windows
Coldzer0 Nov 2, 2023
599353b
Delphi x32 .obj files
Coldzer0 Nov 2, 2023
5fbb62a
Delphi x64 .obj files
Coldzer0 Nov 2, 2023
06e6fe8
Small updates to enable JIT for x32 & some formatting
Coldzer0 Nov 2, 2023
ea9af5d
Adding more decoder APIs
Coldzer0 Nov 2, 2023
ed40709
Update EncodeFromScratch.dpr
Coldzer0 Nov 2, 2023
9ee63a4
Remove unused unit from Zydis.Apis
Coldzer0 Nov 2, 2023
98b40f4
Update Zydis.Decoder.pas
Coldzer0 Nov 10, 2023
269f3db
Added Encoder high-level Unit
Coldzer0 Nov 10, 2023
0e9e9ec
Update README.md
Coldzer0 Nov 20, 2023
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
63 changes: 13 additions & 50 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@

# Created by https://www.gitignore.io/api/delphi,freepascal

### Delphi ###
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
#*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#
*.dSYM

# Delphi compiler-generated binaries (safe to delete)
*.exe
*.dll
*.bpl
*.bpi
*.dcp
*.so
*.apk
*.drc
*.map
Expand All @@ -45,9 +12,12 @@
*.tds
*.dcu
*.lib
*.a
*.o
*.ocx
*.zip
*.exe
*.dbg
*.res

# Delphi autogenerated files (duplicated info)
*.cfg
Expand All @@ -61,25 +31,18 @@
*.tvsconfig
*.dsk

# Delphi history and backups
# Delphi history , Build and backups
lib
backup
__history/
__recovery/
*.~*

# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat
*.bak

### FreePascal ###
*.lps
*.compiled
*.[oa]
*.ppu
*.rst
*.cgi
*.log
*.bak*
fp.ini
fp.cfg
fp.dsk

# End of https://www.gitignore.io/api/delphi,freepascal
# Linux binraies
Examples/EncodeFromScratch
Examples/disassemblesimple
Examples/Disassembler
238 changes: 0 additions & 238 deletions Examples/CustomFormatter.dpr

This file was deleted.

46 changes: 46 additions & 0 deletions Examples/DisassembleSimple.dpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
Zydis DisassembleSimple Example By Coldzer0
}
program DisassembleSimple;

{$IFDEF FPC}
{$mode Delphi}{$H+}{$J-}
{$ENDIF}
{$IfDef MSWINDOWS}
{$APPTYPE CONSOLE}
{$EndIf}

uses
SysUtils,
Zydis.Apis,
Zydis.Enums,
Zydis.Types,
Zydis.Status,
Zydis.Disassembler.Types;

var
offset : ZyanUSize;
runtime_address: ZyanU64;
instruction : TZydisDisassembledInstruction;
Data: array[0..24] of ZyanU8 = ($51, $8D, $45, $FF, $50, $FF,
$75, $0C, $FF, $75, $08, $FF, $15, $A0, $A5, $48, $76, $85, $C0,
$0F, $88, $FC, $DA, $02, $00);

{$R *.res}

begin
offset := 0;
runtime_address := $007FFFFFFF400000;

Initialize(instruction);
// Loop over the instructions in our buffer.
while ZYAN_SUCCESS(ZydisDisassembleIntel(ZYDIS_MACHINE_MODE_LONG_64,
runtime_address, @data[offset], SizeOf(data) - offset, instruction)) do
begin
WriteLn(Format('%.16X %s', [runtime_address, UTF8ToString(instruction.text)]));
inc(offset, instruction.info.length);
inc(runtime_address, instruction.info.length);
end;

ReadLn;
end.
Loading