WaitForDebugEvent

  BOOL WaitForDebugEvent(lpde, dwTimeout)    
  LPDEBUG_EVENT lpde; /* address of structure for event information */
  DWORD dwTimeout; /* number of milliseconds to wait for event */

The WaitForDebugEvent function waits for a debug event to occur in a process that is being debugged.

Parameters

lpde

Points to a DEBUG_EVENT structure that is filled with information about the debug event.

The DEBUG_EVENT structure has the following format:

typedef struct _DEBUG_EVENT { /* de */

DWORD dwDebugEventCode;

DWORD dwProcessId;

DWORD dwThreadId;

union {

EXCEPTION_DEBUG_INFO Exception;

CREATE_THREAD_DEBUG_INFO CreateThread;

CREATE_PROCESS_DEBUG_INFO CreateProcessInfo;

EXIT_THREAD_DEBUG_INFO ExitThread;

EXIT_PROCESS_DEBUG_INFO ExitProcess;

LOAD_DLL_DEBUG_INFO LoadDll;

UNLOAD_DLL_DEBUG_INFO UnloadDll;

OUTPUT_DEBUG_STRING_INFO DebugString;

} u;

} DEBUG_EVENT, *LPDEBUG_EVENT;

dwTimeout

Specifies the number of milliseconds the function will wait for a debug event. If dwTimeout is zero, the function tests for a debug event and returns immediately. If dwTimeout is -1, the function will not return until a debug event has occurred.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

Only the thread that created idProcess with the CreateProcess function can call WaitForDebugEvent.

See Also

ContinueDebugEvent, DebugActiveProcess, DebugBreak, OutputDebugString