Results 1 to 11 of 11
  1. #1
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed

    .NET phobia (only for the elite coders, ahaha)

    So i made an app in c# the other day cuz i was starting to get into c#, but i was so upset with myself. It was so easy to make an email spammer it was ridiculous. I also made an app that connected to my c++ server app and put the welcome message in a messagebox and this all took me like 5 or 6 lines of code. I felt cheated. Like it was cool, but it was so high level i was really upset with myself. Does anyone feel the same?

    That's why i returned to coding c++ win32 api windowed apps. Cuz it's so low level i like it. I feel like i control everything that happens. But i would love it if there was some way to physically place buttons and drag them to the position you wanted it instead of having to guess the coordinates. Other than that i love the winapi.

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by 258456 View Post
    So i made an app in c# the other day cuz i was starting to get into c#, but i was so upset with myself. It was so easy to make an email spammer it was ridiculous. I also made an app that connected to my c++ server app and put the welcome message in a messagebox and this all took me like 5 or 6 lines of code. I felt cheated. Like it was cool, but it was so high level i was really upset with myself. Does anyone feel the same?

    That's why i returned to coding c++ win32 api windowed apps. Cuz it's so low level i like it. I feel like i control everything that happens. But i would love it if there was some way to physically place buttons and drag them to the position you wanted it instead of having to guess the coordinates. Other than that i love the winapi.
    No way. There's a reason C# is becoming something of an industry-standard these days and that's because of RAD (Rapid Application Development). Sure, you can't access memory directly (In the general sense, you can access unmanaged memory directly but it's a pain), or do all sorts of pointer magic and cool low-level operations, but you can always write a native C++ library and use PInvoke to do the low-level stuff for you. C/C++ is still needed when you need to do something that requires low-level functionality, or where absolute efficiency is paramount, but for real-world application development, building a multi-step form in C/C++ is just not practical given the normal business constraints: Time and Money. No business-manager is going to be happy when you spend 100 hours building your whole application in C/C++, only to find out that if you'd just sucked it up and written it in C# it could have been achieved in 20, or even 10 hours.

    There are a time and a place for all languages; I think people SHOULD learn C/C++ at some point in their life (or another low-level language similar) if only to really learn what goes on 'behind-the-scenes' in a higher level language, but clinging to C/C++ for everything isn't practical. Now that I grasp at least the basics of C/C++ I have no qualms about doing the majority of my coding in C#; why should I have to write everything myself when it already exists? If I had to, I could write the functionality myself, but I don't see the point when Microsoft has done it all for me in the .NET framework.

    Even in C++ you find that you use all sorts of prebuilt libraries (hint 'Windows.h', 'stdio.h', 'stdlib.h'). Just think of the .NET Framework as a much bigger and more complete package.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. The Following 3 Users Say Thank You to Jason For This Useful Post:

    258456 (02-28-2012),Hell_Demon (03-02-2012),t7ancients (03-01-2012)

  4. #3
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Quote Originally Posted by Jason View Post


    No way. There's a reason C# is becoming something of an industry-standard these days and that's because of RAD (Rapid Application Development). Sure, you can't access memory directly (In the general sense, you can access unmanaged memory directly but it's a pain), or do all sorts of pointer magic and cool low-level operations, but you can always write a native C++ library and use PInvoke to do the low-level stuff for you. C/C++ is still needed when you need to do something that requires low-level functionality, or where absolute efficiency is paramount, but for real-world application development, building a multi-step form in C/C++ is just not practical given the normal business constraints: Time and Money. No business-manager is going to be happy when you spend 100 hours building your whole application in C/C++, only to find out that if you'd just sucked it up and written it in C# it could have been achieved in 20, or even 10 hours.

    There are a time and a place for all languages; I think people SHOULD learn C/C++ at some point in their life (or another low-level language similar) if only to really learn what goes on 'behind-the-scenes' in a higher level language, but clinging to C/C++ for everything isn't practical. Now that I grasp at least the basics of C/C++ I have no qualms about doing the majority of my coding in C#; why should I have to write everything myself when it already exists? If I had to, I could write the functionality myself, but I don't see the point when Microsoft has done it all for me in the .NET framework.

    Even in C++ you find that you use all sorts of prebuilt libraries (hint 'Windows.h', 'stdio.h', 'stdlib.h'). Just think of the .NET Framework as a much bigger and more complete package.
    Ya for sure bro. I totally agree with you. Just because it's really high level doesn't mean it's any less professional. It's just that i got bothered that stuff was so easy. And i think i will start doing pinvoke to call c++ functions. I never knew about that. Could you show me how to use pInvoke? Thanks Jason.

  5. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by 258456 View Post
    Ya for sure bro. I totally agree with you. Just because it's really high level doesn't mean it's any less professional. It's just that i got bothered that stuff was so easy. And i think i will start doing pinvoke to call c++ functions. I never knew about that. Could you show me how to use pInvoke? Thanks Jason.
    Well it'll take some work both in C++ and C# to get it working correctly.

    In C++ you'll have to mark the methods you want to export at "dllexport", and then use the extern "C" declaration to stop name mangling by the compiler:

    Code:
    #ifndef DLLEXPORT
        #define DLLEXPORT extern "C" __declspec(dllexport)
    #endif
    
    DLLEXPORT void Derp(int i) { }
    So your function will be exported with the name "Derp". However, if you're declaring any methods as stdcall rather than cdecl, you'll need to be aware that VC++ will mangle the names regardless. It will be in the format <originalname>@<numberofbytesofarguments>

    So if i declared Derp as:
    Code:
    DLLEXPORT __stdcall void Derp(int i)
    The exported name would be "Derp@4"
    The easiest way to get the correct name is to just use a PE explorer and look at the 'exported functions' table.

    Now, name in hand, you can go to C#.

    Code:
    using System.Runtime.InteropServices;
    Code:
    [DllImport(@"pathtoyourdll",<optionalarguments such as calling convention can go here>)]
    public static extern void Derp(int x);
    Now, with a stdcall it gets a little bit more tricky because of the name mangling. I don't have an IDE so i can't verify this right now but it should go along the lines of:

    Code:
    [DllImport(@"pathofdll", EntryPoint = "Derp@4", CallingConvention = CallingConvention.StdCall)]
    public static extern void Derp(int i);
    You can specify the entry point explicitly for all PInvokes, but I don't usually bother unless the name has a special symbol in it.
    Last edited by Jason; 02-28-2012 at 07:47 PM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  6. The Following 3 Users Say Thank You to Jason For This Useful Post:

    -Raz0r- (02-29-2012),258456 (02-28-2012),Hell_Demon (03-02-2012)

  7. #5
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    omg that's a real pain.

  8. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by 258456 View Post
    omg that's a real pain.
    Not when you get used to it. It's pretty much how all dependencies have to work (from the C++ side of things), mark the function as external so that it goes into the EAT of the PE so it can be found by external programs. Pretty quick and easy with PInvoke.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. The Following User Says Thank You to Jason For This Useful Post:

    258456 (02-29-2012)

  10. #7
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Quote Originally Posted by Jason View Post


    Not when you get used to it. It's pretty much how all dependencies have to work (from the C++ side of things), mark the function as external so that it goes into the EAT of the PE so it can be found by external programs. Pretty quick and easy with PInvoke.
    I guess so, well thanks for the info. Atleast it's possible to do it. Thanks Jason.

    ---------- Post added at 08:00 PM ---------- Previous post was at 06:47 PM ----------

    EDIT:

    Also, i added my dll as a reference in my c# project, but does that still mean that i have to add the dll with my app let's say if someone needs the program?

  11. #8
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by 258456 View Post
    I guess so, well thanks for the info. Atleast it's possible to do it. Thanks Jason.

    ---------- Post added at 08:00 PM ---------- Previous post was at 06:47 PM ----------

    EDIT:

    Also, i added my dll as a reference in my c# project, but does that still mean that i have to add the dll with my app let's say if someone needs the program?
    You don't add native dlls as references. Although the references ask for a DLL, they mean a .NET dll to import functions from, not a native C++ dll. You can use ILMerge to merge your dll with the exe though.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  12. #9
    258456's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    ghjghj
    Posts
    1,222
    Reputation
    18
    Thanks
    300
    My Mood
    Relaxed
    Quote Originally Posted by Jason View Post


    You don't add native dlls as references. Although the references ask for a DLL, they mean a .NET dll to import functions from, not a native C++ dll. You can use ILMerge to merge your dll with the exe though.

    And is ILMerge a separate program? or a class in c#?

  13. #10
    master131's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Melbourne, Australia
    Posts
    8,858
    Reputation
    3438
    Thanks
    101,672
    My Mood
    Breezy
    It's a seperate program...
    Donate:
    BTC: 1GEny3y5tsYfw8E8A45upK6PKVAEcUDNv9


    Handy Tools/Hacks:
    Extreme Injector v3.7.3
    A powerful and advanced injector in a simple GUI.
    Can scramble DLLs on injection making them harder to detect and even make detected hacks work again!

    Minion Since: 13th January 2011
    Moderator Since: 6th May 2011
    Global Moderator Since: 29th April 2012
    Super User/Unknown Since: 23rd July 2013
    'Game Hacking' Team Since: 30th July 2013

    --My Art--
    [Roxas - Pixel Art, WIP]
    [Natsu - Drawn]
    [Natsu - Coloured]


    All drawings are coloured using Photoshop.

    --Gifts--
    [Kyle]

  14. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by 258456 View Post
    And is ILMerge a separate program? or a class in c#?
    ILMerge is a microsoft command line tool to merge .NET assemblies. I'm not 100% sure if you can merge native .dlls with a .NET dll, but I haven't tried. You should already have ILMerge on your computer, just do a search for it.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. Only For the Coder
    By Lts92 in forum Piercing Blow Help
    Replies: 5
    Last Post: 10-26-2011, 03:39 AM
  2. [Info] For the nooby coders :) like me
    By FailHacker in forum C++/C Programming
    Replies: 12
    Last Post: 06-27-2011, 12:08 AM
  3. [ONLY GOD LIKE CODERS IN PLZ][[NOT FOR THE FAINT HEART]]
    By ^...,^ in forum C++/C Programming
    Replies: 5
    Last Post: 09-12-2009, 07:26 AM
  4. The Warrock Hacks Are Here but only for 20 min
    By patrick8099 in forum WarRock - International Hacks
    Replies: 13
    Last Post: 05-23-2007, 12:52 PM