Solved

how to insert my DLL into a console application?

Posted on 2002-06-29
6
232 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 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.
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.

896 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

15 Experts available now in Live!

Get 1:1 Help Now