Solved

how to insert my DLL into a console application?

Posted on 2002-06-29
6
240 Views
Last Modified: 2012-08-13
hi all,

is anybody knows how to insert my dll into a console application, not a gui application. that means i want to insert my dll into an application which doesn't use user32.dll at all.


how to?
0
Comment
Question by:greensleeve
[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
6 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 7119805
As with all DLLs, you load it using a call to:

LoadLibrary() from KERNEL32.DLL.  Then you find addresses for its export functions using GetProcAddress() also from KERNEL32.DLL.  There is no need for USER32.DLL.

BTW, technically speaking you DO NOT "insert" a DLL into any application.  Your application LOADS and then USES a DLL, but at no time is it "inserted".
0
 

Author Comment

by:greensleeve
ID: 7120154
thanks,but i mean i want insert my dll into other processes,i use hook technique, but hook only can insert my dll into those which use user.dll, for those not use user.dll, hook doesn't work.
0
 
LVL 32

Expert Comment

by:jhance
ID: 7120267
What does USER32.DLL have to do with "hooking" and the problem at hand?

Maybe if you explained your situation and what you are trying to do rather than trying to be mysterious, better advice could be offered.
0
Independent Software Vendors: 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!

 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 total points
ID: 7120385
I'm guessing he wants to use DLL injection to hook a console application.  He's probably currently using method 1 of the following article (which relies on USER32) to perform the DLL injection.

  http://www.codeguru.com/system/apihook.html


He may want to read the entire article for different methods of DLL injection-- or preferably pick up Jeffrey Richter's Programming Applications for Windows.

  http://www.amazon.com/exec/obidos/ASIN/1572319968/

But based on his other questions, he's probably trying to hook Winsock calls.  In which case, a proxy DLL may end up making the most sense.  There used to be a stub download available, but I can't find it now.  Here's a possible starting point.

  http://www.sockets.com/devtools.htm
0
 
LVL 11

Expert Comment

by:griessh
ID: 7262540
Dear greensleeve

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "clockwatcher"

comment(s) as an answer.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
ID: 7332984
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

734 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