Using CreateProcess to launch event viewer, how to wait the end of the viewer?

100 views Asked by At

I'm currently writing an application that must start the event viewer (system32/eventvwr.msc) and be blocked as long as the event viewer runs.

For standard applications I'm doing this by:

    BOOL logDone =  CreateProcess(NULL
                              , applicationCmdLine
                              , NULL
                              , NULL
                              , false
                              , NORMAL_PRIORITY_CLASS
                              , NULL
                              , NULL
                              , &si
                              , &pi
                            );
if (logDone)
{
    WaitForSingleObject(pi.hProcess, INFINITE);
}

But this code does not work with the event viewer. The wait immediately returns.

Do you now how to wait for the end of this application?

Thanks for your help.

0

There are 0 answers