Einzelnen Beitrag anzeigen

WoTo

Registriert seit: 28. Jun 2004
Ort: Rotenburg (Wümme)
102 Beiträge
 
Delphi 2005 Enterprise
 
#5

Re: c++ zu delphi (kleines snippet)

  Alt 23. Aug 2006, 09:12
Hallo,

hier meine Umsetzung:

Delphi-Quellcode:
type
  pStilleToHook = ^stilletoHook;
  g_pOrigstilletoFunc = procedure of Object;


var
  g_stilletoOffset : integer;
  g_pOrigstilletoDamageFunc : integer;
  stilletoHook: integer;
  AdwstilletoOffset : integer;

procedure stilleto_Hook(ApstilletoHook: pStilleToHook; dwstilletoOffset : integer);
var
  dwOldProtect : integer;
begin
  g_StilleToOffset := dwStilleToOffset;
  if (pstilletoHook <> NIL) AND (g_stilletoOffset <> 0) AND (VirtualProtect(pstilletoHook,4,PAGE_EXECUTE_READWRITE, dwOldProtect))
  then begin
    g_pOrigstilletoFunc = pstilletoHook^ + (Ulong(pstilletoHook) + 4);
    pstilletoHook^ = Ulong(stilleto_Stub) - (Ulong(pstilletoHook) + 4);
    VirtualProtect(pstilletoHook, 4, dwOldProtect, dwOldProtect);
  end;
end;

begin
  g_stilletoOffset := 0;
  g_pOrigstilletoDamageFunc := 0;

  StilleTo_Hook(pStilleToHook, AdwstilletoOffset);
end.
Bei der If-Abfrage bin ich mir nicht sicher.

Bis denne,
Woto
  Mit Zitat antworten Zitat