RtAttachShutdownHandler registers a shutdown notification handler. The handler function is called in its own thread when one of the system stop events occurs.
HANDLE RtAttachShutdownHandler( PSECURITY_ATTRIBUTES pThreadAttributes, ULONG StackSize, VOID (RTFCNDCL *pRoutine)(PVOID Context, LONG reason), PVOID Context, ULONG Priority );
pThreadAttributes
parameter is ignored. Must be set to NULL.
StackSize
is rounded up to a multiple of 4K bytes.
pRoutine
is called when a shutdown event occurs and executes in a normal iwin32 context. Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/iwin32.h | iwin32.h | iwin32.lib |
This function operates in the real-time portion of your application.
The function pointed to by Routine is called when Windows is shut down. The source of the stop notification is presented to this function in the reason argument. The reason argument may have one of the following values according the reason for the notification:
RT_SHUTDOWN_NT_ PENDING | The system is starting a normal shutdown and is querying applications if the shutdown may proceed. |
RT_SHUTDOWN_NT_SYSTEM_SHUTDOWN | The system is starting a normal shutdown. Shortly after all shutdown handlers execute, Windows will stop. |
RT_SHUTDOWN_NT_STOP | Windows has stopped (i.e., blue screen). INtime will continue to operate. |
The order in which the shutdown handlers execute is dependent upon the priority specified when the handler object was created.
Only one shutdown handler object is permitted per INtime process. A handler function should not call ExitThread, but should simply return when finished. When all registered shutdown handlers have returned, the system completes the Windows shutdown sequence.
A shutdown handler object may be destroyed by calling RtReleaseShutdownHandler.