KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Unit FastCodePatch.pas works in Win32 platform. Delphi XE2 supports Win64 platform, any ideas how to make FastCodePatch works in Win64 platform? unit FastcodePatch; interface function FastcodeGetAddress(AStub: Pointer): Pointer; procedure FastcodeAddressPatch(const ASource, ADestination: Pointer); implementation uses Windows; type PJump = ^TJump; TJump = packed record OpCode: Byte; Distance: Pointer; end; function FastcodeGetAddress(AStub: Pointer): Pointer; begin if PBYTE(AStub)^ = $E8 then begin Inc(Integer(AStub)); Result := Pointer(Integer(AStub) + SizeOf(Pointer) + PInteger(AStub)^); end else Result := nil; end; procedure FastcodeAddressPatch(const ASource, ADestination: Pointer); const Size = SizeOf(TJump); var NewJump: PJump; OldProtect: Cardinal; begin if VirtualProtect(ASource, Size, PAGE_EXECUTE_READWRITE, OldProtect) then begin NewJump := PJump(ASource); NewJump.OpCode := $E9; NewJump.Distance := Pointer(Integer(ADestination) - Integer(ASource) - 5); FlushInstructionCache(GetCurrentProcess, ASource, SizeOf(TJump)); VirtualProtect(ASource, Size, OldProtect, @OldProtect); end; end; end. The solution provided by Ville Krumlinde doesn't work on 64 bits package. It works on Standalone .exe application only.
Tags (comma-separated)
Save Edits
Cancel