Results 1 to 6 of 6
  1. #1
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13

    Thumbs up [Tutorial] Create Unmanaged Export Library

    Okey, long time didn’t post a good stuff.

    On this post I’ll show you how to make a C# unmanaged DLL, As we now DLL C# doest like C, using code injection with C DLL will starting execute our code by call DLLMain fuction, we don’t following that way to make DLL in C#, we will using another method like using dllexport then use GetProcAddress to get our address of fuction then run the fuction.

    Robert Giesecke has made a project template to make a dll using that method on C#, so lets we say thanks to Robert Giesecke.

    Tools We Need :
    - Project Template From Robert Giesecke.
    - Visual Studio C# 2010 / 2011 (Im using C# 2010).
    - Knowledge about C#.


    Ok Lets Start :
    First download Robert Giesecke Project Template from her site, after you downloaded the file, put it on Visual Studio C# 2010/2011 Project Template.



    Look at the image, I have show you the path, and you have put the zip (don’t extract the template’s zip) there.
    After you put the zip on Visual C# Project Template folder, now open your Visual Studio 2010 / 2011, Create a C# new project, find Unmanaged Export Library from Visual C# Installed Templates, Give a name of your project then OK.



    After create a project u will have dllexport folder on your project and UnmanagedExports.cs, open UnmanagedExports.cs its will be the class have function same as dllexport function on C, and this file will be the entry point for our DLL. Look at the first code off UnmanagedExports.cs

    PHP Code:
    [DllExport("adddays"CallingConvention System.Runtime.InteropServices.CallingConvention.StdCall)]
          static 
    double AddDays(double dateValueint days)
          {
             return 
    DateTime.FromOADate(dateValue).AddDays(days).ToOADate();
          } 
    You can change DllExport function name with change adddays to what ever you want. And I will change my code to be.

    PHP Code:
    [DllExport("DLLMain"CallingConvention System.Runtime.InteropServices.CallingConvention.StdCall)]
          static 
    void DLLMain()
          {
             
          } 
    If you want doing something like write memory or reading or patching or what ever in DLLMain, yeah you can do it, but maybe if we split the class its will be neat. Ok so lets make Windows Form class, give the name Main for our new Windows Form Class.
    Ok after creating new Windows Form Class, lets we call the our form when DLLMain function is execute. In unmanagedExports.cs call your windows form call your main form with make a thread.

    PHP Code:
    [DllExport("DLLMain"CallingConvention System.Runtime.InteropServices.CallingConvention.StdCall)]
          static 
    void DLLMain()
          {
              new 
    Thread(() =>Application.Run(new Main())).Start();
          } 
    Oke, Just build / publish your dll and use DLL, I’ll make tutorial how to make injection for this DLL later, couse I have to work now .

    But if you want to make it injection. Like what I say. First you have injected DLL into process, and second you have find your function address (at this case DLLMain function address) then execute that process. You can use BlackMagic, WhiteMagic, or Syringe DLL library to make it easy to inject this dll method. or you can follow dwar to call export function from injected dll but it in C. i'll make it with C#

    Sorry for my English, if you have question free to ask.

    Thx To :
    - Xcvd
    - Robert Giesecke

    =========================UPDATE=================== =========
    I have make tutorial for inject dll make from this tutorial, here is the link
    Last edited by emoisback; 2012-07-01 at 09:41 PM.
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  2. The Following 5 Users Say Thank You to emoisback For This Useful Post:


  3. #2
    yizheng
    yizheng is offline
    Awesome to the MAX yizheng's Avatar
    Join Date
    2010 Aug
    Posts
    743
    Thanks Thanks Given 
    124
    Thanks Thanks Received 
    728
    Thanked in
    187 Posts
    Rep Power
    14
    Excellent post emoisback!

  4. #3
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    Quote Originally Posted by yizheng View Post
    Excellent post emoisback!
    thanks, anyway you can put anything on that DLL, like detour, or your YCS maybe ..

    Updated Link Injector on First Post.
    Last edited by emoisback; 2012-07-01 at 09:41 PM.
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  5. #4
    JeanBR
    JeanBR is offline
    Senior Member JeanBR's Avatar
    Join Date
    2012 Jan
    Location
    Hestia
    Posts
    326
    Thanks Thanks Given 
    41
    Thanks Thanks Received 
    210
    Thanked in
    82 Posts
    Rep Power
    0
    Very good emoisback you're doing a great job over the DLL's congratulations.
    Welcome To PGC.

  6. #5
    AikaMaster
    AikaMaster is offline
    Senior Member AikaMaster's Avatar
    Join Date
    2012 May
    Location
    Inside you mind!
    Posts
    245
    Thanks Thanks Given 
    58
    Thanks Thanks Received 
    642
    Thanked in
    68 Posts
    Rep Power
    0
    Great Post emoisback!
    It's not an easy task task to find such helpful tutorials like this one!

    We're proud to have you here bro!

  7. #6
    emoisback
    emoisback is offline
    Full member
    Join Date
    2011 Dec
    Location
    Indonesia there i'm
    Posts
    508
    Thanks Thanks Given 
    83
    Thanks Thanks Received 
    244
    Thanked in
    68 Posts
    Rep Power
    13
    Quote Originally Posted by AikaMaster View Post
    Great Post emoisback!
    It's not an easy task task to find such helpful tutorials like this one!

    We're proud to have you here bro!
    Thanks bro..
    i will continues this tutorial with game hack parts..
    read and write from injected DLL..using Marshal Class..
    hope can release soon..
    Learn from PGC for Share on PGC..


    For another Stuff i have make try to find it [Please, register to view links]
    If i have help you, please thanks and respect ..

  8. The Following User Says Thank You to emoisback For This Useful Post:


Similar Threads

  1. [Guide] Aion, how to export.
    By Drawing in forum Game Models and Graphic
    Replies: 0
    Last Post: 2012-06-14, 11:16 PM
  2. Photoshop Tutorial: Create Smudge Signature
    By abalamadilo in forum Graphics Tutorials
    Replies: 2
    Last Post: 2012-03-12, 09:34 PM
  3. Replies: 2
    Last Post: 2011-12-20, 09:07 PM
  4. Replies: 0
    Last Post: 2010-11-29, 04:08 PM
  5. [C#+MASM32] Using unmanaged dll Video Tutorial
    By Dwar in forum Programming Tutorials
    Replies: 0
    Last Post: 2010-11-14, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •