-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b201037
commit 2844063
Showing
7 changed files
with
361 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
-$A8 | ||
-$B- | ||
-$C+ | ||
-$D+ | ||
-$E- | ||
-$F- | ||
-$G+ | ||
-$H+ | ||
-$I+ | ||
-$J- | ||
-$K- | ||
-$L+ | ||
-$M- | ||
-$N+ | ||
-$O+ | ||
-$P+ | ||
-$Q- | ||
-$R- | ||
-$S- | ||
-$T- | ||
-$U- | ||
-$V+ | ||
-$W- | ||
-$X+ | ||
-$YD | ||
-$Z1 | ||
-cg | ||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | ||
-H+ | ||
-W+ | ||
-M | ||
-$M16384,1048576 | ||
-K$00400000 | ||
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl" | ||
-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl" | ||
-w-UNSAFE_TYPE | ||
-w-UNSAFE_CODE | ||
-w-UNSAFE_CAST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
[FileVersion] | ||
Version=7.0 | ||
[Compiler] | ||
A=8 | ||
B=0 | ||
C=1 | ||
D=1 | ||
E=0 | ||
F=0 | ||
G=1 | ||
H=1 | ||
I=1 | ||
J=0 | ||
K=0 | ||
L=1 | ||
M=0 | ||
N=1 | ||
O=1 | ||
P=1 | ||
Q=0 | ||
R=0 | ||
S=0 | ||
T=0 | ||
U=0 | ||
V=1 | ||
W=0 | ||
X=1 | ||
Y=1 | ||
Z=1 | ||
ShowHints=1 | ||
ShowWarnings=1 | ||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; | ||
NamespacePrefix= | ||
SymbolDeprecated=1 | ||
SymbolLibrary=1 | ||
SymbolPlatform=1 | ||
UnitLibrary=1 | ||
UnitPlatform=1 | ||
UnitDeprecated=1 | ||
HResultCompat=1 | ||
HidingMember=1 | ||
HiddenVirtual=1 | ||
Garbage=1 | ||
BoundsError=1 | ||
ZeroNilCompat=1 | ||
StringConstTruncated=1 | ||
ForLoopVarVarPar=1 | ||
TypedConstVarPar=1 | ||
AsgToTypedConst=1 | ||
CaseLabelRange=1 | ||
ForVariable=1 | ||
ConstructingAbstract=1 | ||
ComparisonFalse=1 | ||
ComparisonTrue=1 | ||
ComparingSignedUnsigned=1 | ||
CombiningSignedUnsigned=1 | ||
UnsupportedConstruct=1 | ||
FileOpen=1 | ||
FileOpenUnitSrc=1 | ||
BadGlobalSymbol=1 | ||
DuplicateConstructorDestructor=1 | ||
InvalidDirective=1 | ||
PackageNoLink=1 | ||
PackageThreadVar=1 | ||
ImplicitImport=1 | ||
HPPEMITIgnored=1 | ||
NoRetVal=1 | ||
UseBeforeDef=1 | ||
ForLoopVarUndef=1 | ||
UnitNameMismatch=1 | ||
NoCFGFileFound=1 | ||
MessageDirective=1 | ||
ImplicitVariants=1 | ||
UnicodeToLocale=1 | ||
LocaleToUnicode=1 | ||
ImagebaseMultiple=1 | ||
SuspiciousTypecast=1 | ||
PrivatePropAccessor=1 | ||
UnsafeType=0 | ||
UnsafeCode=0 | ||
UnsafeCast=0 | ||
[Linker] | ||
MapFile=0 | ||
OutputObjs=0 | ||
ConsoleApp=1 | ||
DebugInfo=0 | ||
RemoteSymbols=0 | ||
MinStackSize=16384 | ||
MaxStackSize=1048576 | ||
ImageBase=4194304 | ||
ExeDescription= | ||
[Directories] | ||
OutputDir= | ||
UnitOutputDir= | ||
PackageDLLOutputDir= | ||
PackageDCPOutputDir= | ||
SearchPath= | ||
Packages=vcl;rtl;vclx | ||
Conditionals= | ||
DebugSourceDirs= | ||
UsePackages=0 | ||
[Parameters] | ||
RunParams= | ||
HostApplication= | ||
Launcher= | ||
UseLauncher=0 | ||
DebugCWD= | ||
[Version Info] | ||
IncludeVerInfo=0 | ||
AutoIncBuild=0 | ||
MajorVer=1 | ||
MinorVer=0 | ||
Release=0 | ||
Build=0 | ||
Debug=0 | ||
PreRelease=0 | ||
Special=0 | ||
Private=0 | ||
DLL=0 | ||
Locale=1031 | ||
CodePage=1252 | ||
[Version Info Keys] | ||
CompanyName= | ||
FileDescription= | ||
FileVersion=1.0.0.0 | ||
InternalName= | ||
LegalCopyright= | ||
LegalTrademarks= | ||
OriginalFilename= | ||
ProductName= | ||
ProductVersion=1.0.0.0 | ||
Comments= | ||
[Excluded Packages] | ||
c:\program files (x86)\borland\delphi7\Bin\dclocx70.bpl=Borland Sample Imported ActiveX Controls | ||
c:\program files (x86)\borland\delphi7\Bin\dcl31w70.bpl=Delphi 1.0 Compatibility Components | ||
c:\program files (x86)\borland\delphi7\Bin\dclshlctrls70.bpl=Shell Control Property and Component Editors | ||
c:\program files (x86)\borland\delphi7\Bin\dclsmp70.bpl=Borland Sample Components | ||
[HistoryLists\hlUnitAliases] | ||
Count=1 | ||
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
program HexReplacerGUI; | ||
|
||
uses | ||
Forms, | ||
Unit1 in 'Unit1.pas' {Form1}; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
Application.Initialize; | ||
Application.Title := 'Hex Replacer GUI'; | ||
Application.CreateForm(TForm1, Form1); | ||
Application.Run; | ||
end. |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
object Form1: TForm1 | ||
Left = 382 | ||
Top = 155 | ||
Width = 281 | ||
Height = 273 | ||
Caption = 'Hex Replacer GUI' | ||
Color = clBtnFace | ||
Font.Charset = DEFAULT_CHARSET | ||
Font.Color = clWindowText | ||
Font.Height = -11 | ||
Font.Name = 'MS Sans Serif' | ||
Font.Style = [] | ||
OldCreateOrder = False | ||
PixelsPerInch = 96 | ||
TextHeight = 13 | ||
object Label1: TLabel | ||
Left = 48 | ||
Top = 48 | ||
Width = 34 | ||
Height = 13 | ||
Caption = 'Regrex' | ||
end | ||
object Label2: TLabel | ||
Left = 160 | ||
Top = 48 | ||
Width = 63 | ||
Height = 13 | ||
Caption = 'Replacement' | ||
end | ||
object TBConvert: TButton | ||
Left = 96 | ||
Top = 120 | ||
Width = 73 | ||
Height = 33 | ||
Caption = 'Convert' | ||
TabOrder = 0 | ||
OnClick = TBConvertClick | ||
end | ||
object Edit1: TEdit | ||
Left = 40 | ||
Top = 64 | ||
Width = 57 | ||
Height = 21 | ||
TabOrder = 1 | ||
Text = '00' | ||
end | ||
object Edit2: TEdit | ||
Left = 152 | ||
Top = 64 | ||
Width = 81 | ||
Height = 21 | ||
TabOrder = 2 | ||
Text = 'FA' | ||
end | ||
object OpenDialog1: TOpenDialog | ||
Left = 32 | ||
Top = 96 | ||
end | ||
object SaveDialog1: TSaveDialog | ||
Left = 200 | ||
Top = 104 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
created on 12.03.2018 - bartimaeusnek | ||
} | ||
|
||
unit Unit1; | ||
interface | ||
|
||
uses | ||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | ||
Dialogs, StdCtrls; | ||
|
||
type | ||
TForm1 = class(TForm) | ||
TBConvert: TButton; | ||
Edit1: TEdit; | ||
Edit2: TEdit; | ||
OpenDialog1: TOpenDialog; | ||
SaveDialog1: TSaveDialog; | ||
Label1: TLabel; | ||
Label2: TLabel; | ||
procedure TBConvertClick(Sender: TObject); | ||
|
||
private | ||
{ Private declarations } | ||
|
||
|
||
public | ||
{ Public declarations } | ||
|
||
end; | ||
function GetFileSizeEx(const AFileName: string): Int64; | ||
function HexStrToInt(const str: string): byte; | ||
var | ||
Form1: TForm1; | ||
TCharFile,output : File; | ||
b : array of byte; | ||
regrex,replace : byte; | ||
|
||
implementation | ||
|
||
{$R *.dfm} | ||
|
||
procedure TForm1.TBConvertClick(Sender: TObject); | ||
var i : Integer; | ||
begin | ||
|
||
//open original file | ||
if OpenDialog1.Execute then | ||
if FileExists(OpenDialog1.FileName) then | ||
begin | ||
AssignFile(TCharFile, OpenDialog1.FileName); | ||
//open as readonly | ||
Reset(TCharFile,1); | ||
//set the array b to the files byte lenth | ||
SetLength(b,GetFileSizeEx(OpenDialog1.FileName)); | ||
//read the file to the array | ||
while not Eof(TCharFile) do | ||
begin | ||
for i:=0 to (Length(b)-1) do | ||
blockread(TCharFile,b[i],1); | ||
end; | ||
//close the file, since we dont need it anymore data is in array | ||
CloseFile(TCharFile); | ||
|
||
//get the regrex and replacement | ||
regrex := HexStrToInt(Edit1.Text); | ||
replace := HexStrToInt(Edit2.Text); | ||
|
||
for i:=0 to (Length(b)-1) do | ||
if b[i] = regrex then //check for the regrex | ||
b[i] := replace; //replace it | ||
|
||
//open/create a new file in RW mode & save byte array to it. | ||
if SaveDialog1.Execute then begin | ||
AssignFile(output,SaveDialog1.FileName); | ||
ReWrite(output,1); | ||
for i:=0 to (Length(b)-1) do | ||
blockwrite(output,b[i],1); | ||
end; | ||
CloseFile(output); | ||
ShowMessage('Done.'); | ||
end; | ||
end; | ||
|
||
|
||
function GetFileSizeEx(const AFileName: string): Int64; | ||
var | ||
F: TSearchRec; | ||
begin | ||
Result := -1; | ||
if FindFirst(AFileName, faAnyFile, F) = 0 then | ||
begin | ||
try | ||
Result := F.FindData.nFileSizeLow or (F.FindData.nFileSizeHigh shl 32); | ||
finally | ||
SysUtils.FindClose(F); | ||
end; | ||
end; | ||
end; | ||
|
||
function HexStrToInt(const str: string): byte; | ||
begin | ||
Result := StrToInt('$' + str); | ||
end; | ||
|
||
end. |