![]() |
AW: File patchen
Hier das ganze nochmal, sorry keine UI, alles unter der Console.
Als Ziel nahm ich einfach mein vorigen Post als Kompilat in der Hoffnung das er bei Dir exakt so ist wie bei mir.
Delphi-Quellcode:
Ich hoffe das es Dir hilft, so jedenfalls sieht bei mir ein simpler Byte-Patcher aus.
program Patcher;
{$APPTYPE CONSOLE} {$R *.res} uses System.SysUtils, System.Classes; const CFName = string('Patch.exe'); CFSize = UInt64(58880); CPatches = UInt64($23); COffsets: array[0..CPatches] of UInt64 = ($50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$5A,$5B,$5C,$5D,$5E,$5F,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$6A,$6B,$6C,$6D,$6E,$6F,$70,$71,$72,$73); //This program must be run under Win32 COrgBytes: array[0..CPatches] of Byte = ($54,$68,$69,$73,$20,$70,$72,$6f,$67,$72,$61,$6d,$20,$6d,$75,$73,$74,$20,$62,$65,$20,$72,$75,$6e,$20,$75,$6e,$64,$65,$72,$20,$57,$69,$6e,$33,$32); //Hier steht jetzt etwas total cooles! CNewBytes: array[0..CPatches] of Byte = ($48,$69,$65,$72,$20,$73,$74,$65,$68,$74,$20,$6a,$65,$74,$7a,$74,$20,$65,$74,$77,$61,$73,$20,$74,$6f,$74,$61,$6c,$20,$63,$6f,$6f,$6c,$65,$73,$21); var fs: TFileStream; FName: string; i: Integer; b: Byte; Org, New, Diff: UInt64; begin FName := ExtractFilePath(ParamStr(0)) + CFName; if (not FileExists(FName)) then begin WriteLn(FName + ' not found!'); ReadLn; Exit; end; try fs := TFileStream.Create(FName, fmOpenReadWrite or fmShareExclusive); try Org := 0; New := 0; Diff := 0; if (fs.Size <> CFSize) then begin WriteLn('Wrong Filesize!'); ReadLn; Exit; end; for i := 0 to CPatches do begin fs.Position := COffsets[i]; fs.Read(b, 1); if (b = COrgBytes[i]) then Inc(Org); if (b = CNewBytes[i]) then Inc(New); if ((b <> COrgBytes[i]) and (b <> CNewBytes[i])) then Inc(Diff); end; if Org = Succ(CPatches) then begin for i := 0 to CPatches do begin fs.Position := COffsets[i]; fs.Write(CNewBytes[i], 1); end; WriteLn('Patch applied!'); end; if New = Succ(CPatches) then begin for i := 0 to CPatches do begin fs.Position := COffsets[i]; fs.Write(COrgBytes[i], 1); end; WriteLn('Patch removed!'); end; if Diff <> 0 then WriteLn('Wrong Version!'); finally fs.Free; end; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; ReadLn; end. Falls es noch Fragen gibt, nur keine Scheu :thumb: |
AW: File patchen
Vielen-viele Dank für Deine Hilfe & Mühe, KodeZwerg! :-D :thumb: :angel:
Aber eine Frag habe ich immer noch: An welchem Befehl liegt es im Code, daß ich es bei mir immer noch nach höheren Rechten verlangt und sich von der IDE nicht starten läßt? Grüße, Andreas |
AW: File patchen
Liste der Anhänge anzeigen (Anzahl: 1)
Zitat:
|
AW: File patchen
Zitat:
|
AW: File patchen
Liste der Anhänge anzeigen (Anzahl: 1)
Ok, nur keine Panik! :lol:
Im Anhang ist eine .res datei namens "AsInvoker.res", kopiere diese in dein Projekt Verzeichnis. Ändere das hier
Delphi-Quellcode:
nach das hier
{$R *.res}
Delphi-Quellcode:
{$R AsInvoker.res}
Theoretisch sollte es funktionieren aber da ich kein XE besitze kann ich es nicht überprüfen! |
AW: File patchen
Toll! Es funktioniert mit
Delphi-Quellcode:
von der IDE aus. Und auch von der Kommandozeile werden "keine höheren Rechte" mehr eingefordert!
{$R AsInvoker.res}
Danke KodeZwerg! :-D :thumb: Viele Grüße Andreas |
AW: File patchen
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz