There is no real Win32 function to verify this.
Instead, Windows sends a message to WM_QUERYENDSESSIONeach application when shutdown starts.
You can reply to this message and, for example, cancel the shutdown. (Although you should not do this if absolutely necessary)
A message is sent before the actual shutdown WM_ENDSESSION.
, , WM_QUERYENDSESSION.
EDIT:
, .
, . , .
. MSDN .