Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Forwarding in Delphi??

Status
Not open for further replies.

Secata

Programmer
Aug 30, 2002
2
ZA
Hi

Does anyone know if it is possible, to do export forwarding in Delphi?

C++ Example from
EXPORTS
•••
HeapAlloc = NTDLL.RtlAllocHeap

I don't have a C++ compiler and would like to know if it is possible through Delphi.

I am trying to write a proxy .dll and have all it's exported routines, thanks to dependency viewer, but don't have all of the routines parameters, therefor I am looking to re-declare the routine I need to hook and forward the rest...

Any alternatives to redeclaring all of the .dll routines, will also be welcome. I can't use code injection, cus I am trying to do a global hook of the .dll and not just for one process and trying to hack the .dll's exports section, seems a bit drastic and error prone...

Any suggestions?

Thanks in advance
 
you mean something like this??

Code:
....
interface

function ldap_openW(HostName: PWCHAR; PortNumber: ULONG): PLDAP; cdecl;
function ldap_openA(HostName: PCHAR; PortNumber: ULONG): PLDAP; cdecl;

implementation

const
  sLDAPLIB = 'wldap32.dll';

function ldap_open; external sLDAPLIB name 'ldap_openW';
function ldap_init; external sLDAPLIB name 'ldap_initW';

or 
function ldap_openW; external sLDAPLIB;
function ldap_openA; external sLDAPLIB;
....

--------------------------------------
What You See Is What You Get
 
This sounds about righ, yes:

or
function ldap_openW; external sLDAPLIB;
function ldap_openA; external sLDAPLIB;
....

Only problem is that you still have to do a full declare prior , which requires the parameters...and even after that, it still does not show up as a forwarded export on dependency walker, i.e. the entry point for a forwarded export, looks something like 'wldap32.ldap_openW' and not for instance displaying the address such as '0x0003968F'.

Meaning, if I understand it correctly, that forwarded exports maps the declaration of the original export into it's own memory space without having to do a full declare. Or am I missing the pot on forwarded exports?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top