 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Krähne Expert Cheater
Reputation: 0
Joined: 06 Jun 2010 Posts: 108 Location: Inside of my Kernel
|
Posted: Sun Mar 06, 2011 12:59 am Post subject: Writting a .dll (C#) |
|
|
Hi... i'm making a .dll for inject into a process... the code for injection is not a problem but... i'm begining with the dll.
I have looking for a information, but... i doesn't find the way for do this:
When my .dll is injected, i want this show a formulary, where can i add buttons, etc... for specific things.
So... it's posible?, i mean... make a .dll for inject, and this show a form where can i manipulate the proces... by the concept "now is my own process too". I hoope this can be posible, in C#... because, in Delphi i have that.
if you want to know how delphi show a form from a .dll project, i'll post right here:
Code: | Library DllProject;
uses
SysUtils, Classes, Windows,
MainFRM in 'MainFRM.pas' {Form1};
{$R *.res}
Procedure ShowForm;
Begin
Form1:=TForm1.Create(nil);
Form1.ShowModal;
End;
Var
BeOwnProcess:THandle;
HandleID:Cardinal;
Begin
BeOwnProcess := OpenProcess(PROCESS_ALL_ACCESS, false, GetCurrentProcessID);
CreateRemoteThread(BeOwnProcess, nil, 0, @ShowForm, @ShowForm, 0, HandleID);
End. |
So... i have made this also in C#?, i mean... "CreateRemoteThread", etc...?.
Gruß.
|
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Sun Mar 06, 2011 3:33 am Post subject: |
|
|
Yes, it's possible but it's more work then just injecting the DLL. Since C# compiles down to managed code, you have to load the .NET runtime in the target process before you can inject a managed module into it.
You'll need to create a bootstrap DLL to inject (C++ or other native language that can access API) to do the dirty work for you and load your managed DLL afterward which then you can do all your hacking etc in.
Here's an example of how to do it:
http://www.codingthewheel.com/archives/how-to-inject-a-managed-assembly-dll
_________________
- Retired. |
|
Back to top |
|
 |
Krähne Expert Cheater
Reputation: 0
Joined: 06 Jun 2010 Posts: 108 Location: Inside of my Kernel
|
Posted: Sun Mar 06, 2011 3:15 pm Post subject: |
|
|
Wiccaan wrote: | Yes, it's possible but it's more work then just injecting the DLL. Since C# compiles down to managed code, you have to load the .NET runtime in the target process before you can inject a managed module into it.
You'll need to create a bootstrap DLL to inject (C++ or other native language that can access API) to do the dirty work for you and load your managed DLL afterward which then you can do all your hacking etc in. |
Thanks alot dude!, i made that and... WORKS!
But... i don't know if this is the correct way, for show my .dll form.
I mean... when i inject this "native .dll", and this "invoke" my ".NET .dll", i was need this show a windows forms, so... i made this:
Code: | static Form1 F;
public static int Start(String Args)
{
F = new Form1();
F.ShowDialog();
return 0;
} |
But i don't know if that is the best way for made it.
So... what you think about it?.
Gruß
|
|
Back to top |
|
 |
AhMunRa Grandmaster Cheater Supreme
Reputation: 27
Joined: 06 Aug 2010 Posts: 1117
|
Posted: Sun Mar 06, 2011 6:26 pm Post subject: |
|
|
Pretty much that is the way. You are creating a new form which you have specified, then you are calling ShowDialog to the new form. About anything I've done in C# that created a form used this method.
_________________
<Wiccaan> Bah that was supposed to say 'not saying its dead' lol. Fixing >.> |
|
Back to top |
|
 |
Krähne Expert Cheater
Reputation: 0
Joined: 06 Jun 2010 Posts: 108 Location: Inside of my Kernel
|
Posted: Sun Mar 06, 2011 7:44 pm Post subject: |
|
|
AhMunRa wrote: | Pretty much that is the way. You are creating a new form which you have specified, then you are calling ShowDialog to the new form. About anything I've done in C# that created a form used this method. |
Nice man, thank you!... Anyways works perfect for me.
See yá.
Gruß.
|
|
Back to top |
|
 |
|
|
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
|
|