Using DebugActiveProcess and WaitForDebugEvent seems to hang
<p>I have used DebugActiveProcess to attach a process. After that I used WaitForDebugEvent, but it seems that the application is stuck in some infinite loop and I am not able to debug the attached process. </p>

<p>Below is my code:</p>

<pre><code>    DebugActiveProcess( processID );
    int temp = 0;

    DEBUG_EVENT DBEvent;

    while (1)
    {
        WaitForDebugEvent( &amp;DBEvent, INFINITE );
        if ( DBEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )
            break;
        if ( DBEvent.dwDebugEventCode == CREATE_PROCESS_DEBUG_EVENT )
        {
            //MessageBox(0,"Debugging started!","Ble",0);
            temp = 1;
        }
        else if ( DBEvent.dwDebugEventCode == EXCEPTION_DEBUG_EVENT )
        {
            if ( DBEvent.u.Exception.ExceptionRecord.ExceptionCode == EXCEPTION_BREAKPOINT )
            {
                ContinueDebugEvent( processID, qalsrvid, DBG_CONTINUE );
                continue;
            }
            ContinueDebugEvent( processID, qalsrvid, DBG_EXCEPTION_NOT_HANDLED );
        }
    }
</code></pre>
