Solved

DLL forwarding

Posted on 1998-12-21
3
422 Views
Last Modified: 2008-02-20
Does anybody has an idea on how to redirect a call to a function in a dll to your own dll ?

Thank you!
0
Comment
Question by:kctan100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 1180813
This is code:

   const char szcScpWDLLName [] = "MYDLL.DLL";
   const char szcFuncName [] = "MyFunction";  
   TModule  *DLLModule;

   DLLModule = new TModule ( DLLName, TRUE);
   int FAR PASCAL ( *Fun )( char * );
   ( FARPROC ) Fun = DLLModule ->
                      GetProcAddress ( szcFuncName );
   if ( Fun )
     Fun ( ....);
It is for OWL, in pure Windows you
must use LoafLibrary function(instead of TModule)
Best Regards, Alex
0
 

Author Comment

by:kctan100
ID: 1180814
I there is a misunderstanding on the question. In fact, I'm trying to intercept a call to a function in a specified dll.

Example :
A.Dll exports function A.

B.exe calls A.

Instead of calling A, I will force B.exe to call my version of A in another DLL.
0
 
LVL 6

Accepted Solution

by:
stsanz earned 50 total points
ID: 1180815
Create a new DLL that exports all the functions exported by the original DLL. In each function of your new DLL, call the corresponding function in the original DLL (or replace it by your own code).
Rename the original DLL (say LIB.DLL to LIBORI.DLL) an name your new DLL as LIB.DLL

This solution can be a bit long if the DLL exports hundreds of functions. Does anyone know a better solution ?

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question