petko wrote: Mon Oct 25, 2021 12:38 pm
Another piece of the puzzle might be the
SetProcessShutdownParameters WINAPI function. My initial tests show that adding call to this function in my main exe makes the main process receive the shutdown messages before the sub-processes, so I am able to properly store any pending changes from the Chromium components. I am not sure in what percentage of the cases it works, but it certainly increases the like-hood of a proper shutdown.
Code: Select all
SetProcessShutdownParameters(0x3FF, SHUTDOWN_NORETRY);
Reference: https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setprocessshutdownparameters
I didn't know that function. Thanks!
I just released a new version of BriskBard with most of the suggestions given in the previous links I posted, including calls to ShutdownBlockReasonCreate and ShutdownBlockReasonDestroy, resturning false to WM_QUERYENDSESSION, replacing TApplication.WndProc to intercept WM_ENDSESSION, etc.
It's not perfect but I'll keep trying other things.
I'll try to add a "
hidden window" to handle WM_QUERYENDSESSION in the subprocesses as the CEF project maintainer suggested and I'll test SetProcessShutdownParameters too.
Chromium uses that function in several places too :
https://source.chromium.org/search?q=SetProcessShutdownParameters&sq=&ss=chromium