[DllImport( "kernel32.dll", EntryPoint = "WaitForDebugEvent" )]
[return : MarshalAs( UnmanagedType.Bool )]
public static extern bool WaitForDebugEvent(ref DEBUG_EVENT lpDebugEvent, uint dwMilliseconds );
Wrapping WaitForDebugEvent is very hard, because you need to wrap DEBUG_EVENT, which is a large tagged variant structure. It's especially hard to make the wrappers work on both 32-bit and 64-bit because DEBUG_EVENT has different definitions on each platform.
Please add some!
Please add some!
The Managed Debugger (MDbg) sample has a great set of wrappers for the native debug API that deal with problems like these.
See http://blogs.msdn.com/jmstall/archive/2006/07/05/managed-wrappers-for-native-debug-api.aspx for a quick example of what the wrappers look like.
You can download Mdbg at http://www.microsoft.com/downloads/details.aspx?familyid=38449a42-6b7a-4e28-80ce-c55645ab1310&displaylang=en and get the wrappers there.
(or if that link gets broken, you can find the latest info at http://blogs.msdn.com/jmstall/archive/2005/11/08/mdbg_linkfest.aspx)
In contrast, if you are trying to do managed-debugging (instead of just write a native debugger in C#), you need to use the managed debugging APIs (ICorDebug) instead of the native debugging APIs here.