Solved

how to insert my DLL into a console application?

Posted on 2002-06-29
6
235 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
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 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 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.

830 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