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# windows api

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

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue Sep 14, 2010 8:25 am    Post subject: c# windows api Reply with quote

Hello.

Do you guys know some cool functions in the windows api that I can wrap?

_________________
Intel over amd yes.


Last edited by NINTENDO on Tue Sep 14, 2010 8:46 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Sep 14, 2010 8:33 am    Post subject: Reply with quote

How do you mean? You don't use reflection to call Win32 APIs, you use PInvoke.

Here's an example in C# for calling GetWindowThreadProcessId:
Code:
[DllImport("user32.dll", SetLastError=true)]
static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint ProcessId);

int GetProcessFromWindow(IntPtr hWnd)
{
    int procID = -1;
    GetWindowThreadProcessId(hWnd, out procID);
    return procID;
}


You only need to add System.Runtime.InteropServices to your using list.

_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Tue Sep 14, 2010 8:47 am    Post subject: Reply with quote

wops my bad. I didn't mean reflection. : >
_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Tue Sep 14, 2010 8:49 am    Post subject: Reply with quote

If you're interested in PInvoke, the whole Win32 API library has been documented for .NET PInvoke at pinvoke.net. Smile
_________________
It's not fun unless every exploit mitigation is enabled.
Please do not reply to my posts with LLM-generated slop; I consider it to be an insult to my time.
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Thu Sep 16, 2010 10:36 am    Post subject: Reply with quote

Burningmace wrote:
If you're interested in PInvoke, the whole Win32 API library has been documented for .NET PInvoke at pinvoke.net. Smile

thx Very Happy

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
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