Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
Posted: Tue Sep 14, 2010 8:33 am Post subject:
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.
Joined: 17 Feb 2008 Posts: 524 Location: Inside the Intel CET shadow stack
Posted: Tue Sep 14, 2010 8:49 am Post subject:
If you're interested in PInvoke, the whole Win32 API library has been documented for .NET PInvoke at pinvoke.net. _________________
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.
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