?
Solved

DLL forwarding

Posted on 1998-12-21
3
Medium Priority
?
450 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 100 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
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.
Suggested Courses

741 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