Thread: DLL Injection cant compile GCC

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    204

    DLL Injection cant compile GCC

    Hi I am trying to learn dll injection. My job has asked me to learn about using the windows api's and dll injection - turns out its not the easiest topic to find good material on.
    Currently the C++ projects work uses use the GCC Compiler so I want to stick with that even though a lot of the online material uses the windows compiler (i understand this might cause me some issues).

    I have been following this tutorial, and trying to compile the "codetoinject" project. I am using the codeblocks IDE at the moment, because Im used to it. I have attached the project I have, but I get a load of error messages that I think relate to the fact that I am using a different compiler.
    Could anyone point me in the right direction

    OR

    does anyone have a dll injection example that the know comiles with GCC that I could have so that I have a basis to learn from. It doesnt need to be complex - a lot of the pop up a message box in notepad, or add a menu item or something.

    At the moment Im stabbing in the dark abit.
    Thanks guystestingC++.zip

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    We will not discuss this here, but I will give you the google terms. CreateRemoteThread, VirtualAllocEx
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    204
    Sorry, why no discussion? pm or something?

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    How to write a Virus and things like that are against this site rules.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    204
    Im interested you say that. Thats an assumption that everyone out there has an element of 'evil' about them? Software on your computer relies on dll injection all the time. Windows allow dll injection because its required.
    What would happen if this was a worldly attitude? American's are allowed to carry hand guns in some states?
    Im not out to build viruses and if I were that driven to build one a forum isn't really the brick wall between it happening and it not happening.
    Can we assume someone is not malicious before we assume they are anymore?

  6. #6
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by a.mlw.walker View Post
    Can we assume someone is not malicious before we assume they are anymore?
    Actually, no we cant.

    Besides, regardless of what your intentions are, this forums is open to anyone to read, regardless of their motives.

    Also, whilst you gave plenty of effort into appearing to be offended, you did not actually provide an alternative explanation as to what you are doing this for.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by a.mlw.walker View Post
    Software on your computer relies on dll injection all the time. Windows allow dll injection because its required.
    That is not true. Very few real world programs rely on DLL injection. DLL injection, as a technique, refers specifically to running code within a program's address space that was not intended by the creator of that program.

    The most common reason that people seek information about DLL injection, statistically, is attempting to subvert the program that is receiving the code injection. That includes people trying to hack into games, people trying to bypass licensing restrictions, virii, and trojan horses. Those people usually get on their high horse and insist they are entitled to be trusted by default, which is what you have done.

    Operating systems support code injection because there are some specific - and important - types of programs that need it. If you were in the small population of people who actually write such programs, you could simply identify your purpose.

    Quote Originally Posted by a.mlw.walker View Post
    Can we assume someone is not malicious before we assume they are anymore?
    We can also pull our pants down, bend over, and assume you won't get excited. That doesn't make it so.

    In any event, discussing of hacking/cracking techniques is against site policy. Even if folks were inclined to trust you, when you ask about a technique that is often used by hackers and crackers, that policy would require you to provide a convincing argument that your motive was not malicious.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  8. #8
    Registered User
    Join Date
    Apr 2008
    Posts
    204
    In any event, discussing of hacking/cracking techniques is against site policy
    Then I won't, thats fine, but I do find the concept of hiding techniques from people because of the fear as to what they may do with them interesting:
    iMalc,
    Im not offended in the slightest.
    I work for a software research and development company in the UK who do a lot of work in Windows using C++. I have only been there 3 months and they are continually asking us to learn/train in specific areas so that we will (hopefully) be of use to the R&D department. This is one topic I had never heard of before joining the company, and from reading around the web software such as MSN messenger uses dll injection - for non maliciious reasons.

    Im not trying to convince you to show me how to do this. You've made it quite clear you wont, I merely wanted to bring up the point that, the world is a sad place if we cant share knowledge based on the fear of what someone might want to do with it.
    I can't tell you what the objectives are of me learning dll injection, because I dont know what the project I am going to be put on is yet - chances are the project won't require it, but its on the list of things I should understand.

    Never mind. I hear there's a good book by Richter on the windows api I should read.
    I'll come back when I have less controversial questions.

  9. #9
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by a.mlw.walker View Post
    I do find the concept of hiding techniques from people because of the fear as to what they may do with them interesting.
    I don't give people keys to my home or cars, unless they have earned my trust. That is not fear. It is prudence.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  10. #10
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    We can also pull our pants down, bend over, and assume you won't get excited.
    O_o

    How did the start of a, probably horrifying, pornographic film find its way into this discussion?

    This is strangely disturbing.

    I merely wanted to bring up the point that, the world is a sad place if we cant share knowledge based on the fear of what someone might want to do with it.
    Do you know how to make a bomb?

    If you did know how to make a bomb, would you tell me how?

    What if I said I was trying to remove a stump from my yard, would you tell me then?

    What if I made the pretense of being terribly offended and continued to profess the purist of intents, would you tell me then?

    What if I claimed I worked in the destruction field, would you tell me then?

    You fail in your responsibilities to others when you grant such dangerous information without showing diligence in confirming my intent.

    So no, we can't just assume that absence of malicious intent.

    This isn't about you, your ego, your pretense, or fears of the misuse of any information that might be shared.

    This is about us; specifically, this is about our responsibility.

    Soma

  11. #11
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    In a way this reminds me of the combat art that I study (pekiti tirsia kali). I say combat art instead of martial art because it isn't about competition, it is about killing (or rather, the preservation of life through deadly force). It is surprisingly difficult to get people to teach this art, you have to convince them that you're not going to use it to wreak havoc. Back in the middle of summer I attended a special seminar where one of the leaders of the art visited from the home country (Philippines). After two days of truly stunning training under one of the most deadly combat masters on the planet, he made it very clear that we were not to teach any of the deadly techniques to ANYBODY on our own and that we would be immediately shunned and banned from the art for doing so.

    It's an interesting parallel. I think most people who want to study PTK are sincere in their motivations for it, but there are a few who are not and we need to be vigilant that we are not training criminals.

    Honestly, were there not a site policy in place prohibiting discussion of hacking techniques, I would have gone into detail. But that's not up to me.
    Last edited by brewbuck; 09-15-2012 at 09:41 AM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It seems that the tribe has spoken.

    *thread closed*
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DLL Injection
    By Cr4zYPT in forum C Programming
    Replies: 7
    Last Post: 09-09-2011, 11:43 AM
  2. dll injection
    By mundaneblur in forum Windows Programming
    Replies: 0
    Last Post: 09-16-2010, 12:58 AM
  3. DLL Injection, Help please
    By AlexWu in forum C Programming
    Replies: 12
    Last Post: 05-05-2010, 08:50 PM
  4. DLL Injection
    By Lionel in forum Windows Programming
    Replies: 6
    Last Post: 09-25-2005, 12:41 PM