EurekaLog
Menu

EurekaLog 7 Manual

ConvertRetAddr

Convert return address to instruction pointer.

Unit

ELowLevel

Syntax

function ConvertRetAddr(
const AReturnAddr: Pointer
): Pointer;

Parameters

AReturnAddr [in]

Return address. It is usually obtained by analyzing call stack or via ReturnAddress.

Return value

Pointer to CALL opcode. This value is always less than AReturnAddr.

Remarks

This routine is used for hooks.

If you have a return address and want to show/indicate caller - then you can use this function to convert return address to instruction pointer in caller's source. This function is needed because return address points to the next line in source file.

Function doesn't raise access violation in case of unavailable memory.

Warning

Function does NOT check if the AReturnAddr is a valid return address. Do not pass arbitrary pointers, pass return addresses only.

Note

This is a wrapper for EDisAsm.GetAddrByRetAddr function.

Examples

var
P: Pointer;
begin
P := ReturnAddress; // P is a return address to caller (e.g. next line)
P := ConvertRetAddr(P); // Now P points to the exact caller of this code
end;

See also

•GetAddrByRetAddr
•GetTargetAddrByCallAddr


Send feedback... Build date: 2026-10-21
Last edited: 2026-10-21
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: https://www.eurekalog.com/help/eurekalog/topic_function_ELowLevel_ConvertRetAddr