Solved

DLL forwarding

Posted on 1998-12-21
3
379 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now