Then search for all ways how to terminate a process and block them. The easiest way to do so is to block OpenProcess for all matters (and to
handle OnCloseQuery). To let Windows shutdown, Windows is issuing a broadcast message on WM_ENDSESSION. After this message (and the check, that this message came from Windows and not from anybody else issuing WM_ENDSESSION to your window) your program needs to be terminatable.
Bernhard
ADD: Which implies: If someone hooks GetSystemMetrics, and tells your program after issuing the WM_ENDSESSION-Message to your window, your process becomes terminateable even if Windows does not really shut down.