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#] Hook into an exe and execute some of its functions

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

Joined: 31 Dec 2014
Posts: 10

PostPosted: Wed Feb 25, 2015 11:31 am    Post subject: [C#] Hook into an exe and execute some of its functions Reply with quote

I have a simple program in C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
class Program
{
static int count;
static void Main(string[] args)
{
for (int i = 0; i<10; i++)
{
Console.WriteLine(func_count());
Console.ReadKey();
}
}

static int func_count()
{
return count++;
}
}
}
I want to write another simple C# program that will be able JUST to execute the func_count() WITHOUT being detected. In C after getting the right to access the memory region to avoid seg fault I would have to use a pointer to a function - something like:

int (* func_ptr)(); //pointer to function

func_ptr = func_count_address

What's a simple way to do this in C# like above that will also be undetectable?
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: Wed Feb 25, 2015 3:39 pm    Post subject: Reply with quote

If both apps are .NET the easiest way would be via loader reflection. You can load the first application inside of your own and reflect its properties and members to invoke them etc with ease.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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