Die aktuelle Version ist 1.5a (Info & Quelltext).

Download: (35.608 Bytes, vom 09.08.2006 09:45:06)


GenCodeHook.pas (CodeLen.pas, CodeMem.pas, CodeMemOpt.pas)

Delphi unit containing functions to do a generic code hook by replacing the
code location to be patched by a jump to the new location. Additionally, a
new code fragment is created that allows to call the old function. See the
included README.txt for more information and how to use it.

Version 1.5a - Always find the most current version at

Copyright (C) 2005, 2006 Volker Siebert <>
All rights reserved.

License: M.I.T. (see source resp. the included file "README.txt")


2006-08-08: Version 1.3c

  • Small fix in "CodeLen.pas" (Delphi 5 only).

2006-01-01: Version 1.5

  • Some small changes to avoid warnings under Delphi 2006.

2005-10-23: Version 1.4

  • Almost complete rewrite of CodeLen.pas with the new functions "AnalyzeCpuInstructionSequence", "LengthOfCpuInstructionSequence", and "CopyCpuInstructionSequence".
  • Modified "CreateGenericCodeHook" to use two different branch types instead of a pc-relative displacement.
  • Removed the flag "Is16Bit" - did never work for 16-bit code.
  • Still no support for Windows 95/98/Me system area ($80000000-$FFFFFFFF).

Version 1.3 (non-public)

  • Removed from WebSite because of several problems regarding relocation of relative displacements, and with Windows 9x/Me and global hooks.
  • Added "AnalyzeCpuInstruction" for a thorough analysis of the instruction, including referenced code and data memory.

2005-09-16: Version 1.2

  • First public version (added sample application).
  • Enhanced "PatchMemory" by first overwriting the first byte with $CC.
  • Added some AMD specific instructions and 3DNow to "CodeLen.pas".

2005-09-15: Version 1.1

  • Added module "CodeMem.pas" for extensible code memory allocation.
  • Wrote optimized code memory manager "CodeMemOpt.pas".
  • Enhanced "PatchMemory" by "FlushInstructionCache".
  • Added function "IsJumpInstruction" to "CodeLen.pas".

2005-09-15: Version 1.0

  • Initial version, derived from the "PrintToFile" project.

Alle Versionen

Name   Version   Größe   Datum / Uhrzeit
GenCodeHook   1.5a   35.608   09.08.2006 09:45:06
GenCodeHook   1.5   35.530   01.01.2006 16:41:27
GenCodeHook   1.4   34.821   23.10.2005 15:08:37

Zusätzliche Suchbegriffe

GenCodeHook, CreateGenericCodeHook, API hook, CPU instruction analysis, Assembler, AnalyzeCpuInstructionSequence, TCodeMemoryManager, AllocCodeMem.

Flocke's Garage
Valid HTML 4.01 Transitional Valid CSS!
(C) 2005-2018 Volker Siebert.
Creative Commons-LizenzvertragDer gesamte Inhalt dieser Webseite steht unter einer Creative Commons-Lizenz (sofern nicht anders angegeben).