Re: How to patch overload function/method?
- From: Chau Chee Yang <ccy@xxxxxxxxxx>
- Date: Mon, 31 Dec 2007 17:58:05 +0800
You can obtain the real address with this GetActualAddr method.
type
PWin9xDebugThunk = ^TWin9xDebugThunk;
TWin9xDebugThunk = packed record
PUSH: Byte;
Addr: Pointer;
JMP: Byte;
Offset: Integer;
end;
PAbsoluteIndirectJmp = ^TAbsoluteIndirectJmp;
TAbsoluteIndirectJmp = packed record
OpCode: Word; //$FF25(Jmp, FF /4)
Addr: ^Pointer;
end;
function GetActualAddr(Proc: Pointer): Pointer;
function IsWin9xDebugThunk(AAddr: Pointer): Boolean;
begin
Result := (AAddr <> nil) and
(PWin9xDebugThunk(AAddr).PUSH = $68) and
(PWin9xDebugThunk(AAddr).JMP = $E9);
end;
begin
if Proc <> nil then
begin
if (Win32Platform <> VER_PLATFORM_WIN32_NT) and
IsWin9xDebugThunk(Proc) then
Proc := PWin9xDebugThunk(Proc).Addr;
if (PAbsoluteIndirectJmp(Proc).OpCode = $25FF) then
Result := PAbsoluteIndirectJmp(Proc).Addr^
else
Result := Proc;
end
else
Result := nil;
end;
Thanks. It works now. I will do more test later against this issue. Happy New Year.
--
Best regards,
Chau Chee Yang
E Stream Software Sdn Bhd
URL: www.sql.com.my
SQL Financial Accounting
.
- References:
- How to patch overload function/method?
- From: Chau Chee Yang
- Re: How to patch overload function/method?
- From: Florent Ouchet
- Re: How to patch overload function/method?
- From: Andreas Hausladen
- Re: How to patch overload function/method?
- From: Chau Chee Yang
- Re: How to patch overload function/method?
- From: Andreas Hausladen
- How to patch overload function/method?
- Prev by Date: Re: FastMM Install
- Next by Date: Re: How to patch overload function/method?
- Previous by thread: Re: How to patch overload function/method?
- Next by thread: Re: How to patch overload function/method?
- Index(es):
Relevant Pages
|