Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C# dll trainer help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
vnlagrla
Cheater
Reputation: 0

Joined: 10 Apr 2011
Posts: 33

PostPosted: Mon Dec 31, 2012 6:36 pm    Post subject: C# dll trainer help Reply with quote

I have made C# exe trainers that use ReadProcessMemory and WriteProcessMemory, but now I want to make a dll trainer in C#. how would I read/write and would I need to make an injector? any help would be appreciated.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Dec 31, 2012 7:52 pm    Post subject: Reply with quote

Managed DLLs do not load/work the same as native ones. You can't just inject a managed DLL into a process and have it work. You need to first load the .NET framework into the process then have the process load your DLL and create an instance of the main object it is exposing.

It's known as CLR hosting, there is an old guide on how to do it here:
http://www.codingthewheel.com/archives/how-to-inject-a-managed-assembly-dll

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Tue Jan 01, 2013 12:26 pm    Post subject: Reply with quote

I could give you a hand tomorrow when im able to function properly.
I can't remember if i'v made a full memory class for dll's but it wouldn't take long too.

I'll sort you out with my injector aswell. Basically does what Wiccaan mentioned besides it doesnt use a C++ dll.

A simple example of a c#/vb dll
Code:
using System;
using System.Windows.Forms;
using System.Threading;
namespace CDll
{
    public class Class1
    {
        public static int DllMain(String arg)
        {
            new Thread(Main).Start();
            return 0;
        }

        static void Main()
        {
            MessageBox.Show("C# Dll Injected");
        }
    }
}

Code:
Public Class Class1

    Public Shared Function DllMain(ByVal arg As String) As Integer
        Dim _Thread As System.Threading.Thread = New System.Threading.Thread(AddressOf Main)
        _Thread.Start()
        Return 0
    End Function

    Shared Sub Main()
        MsgBox("VB Dll Injected")
    End Sub

End Class


And they'l inject just fine


I had to do this awhile back when i wanted to make a trainer for an xtrap protected game. Worked just fine.

_________________
Back to top
View user's profile Send private message
vnlagrla
Cheater
Reputation: 0

Joined: 10 Apr 2011
Posts: 33

PostPosted: Tue Jan 01, 2013 3:38 pm    Post subject: Reply with quote

@Wiccaan thanks that tut was very informative. But if I can keep with c# i will. If not I'll Definitely give that tut a try.

@Pingo that would be great! can't wait to see how the injection works Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites