RtNalAttachProcessExitHandler
RtNalAttachProcessExitHandler registers an application's networking exit handler to allow an RTSS application to perform custom code cleanup when an application exits.
Syntax
BOOL RtNalAttachProcessExitHandler( VOID (RTFCNDCL *pRoutine)(PVOID context), PVOID pContext, ULONG priority );
Parameters
pRoutine
The exit handler function to call on process exit. This function can handle NAL resource cleanup and will be called at the beginning of process exiting via ExitProcess. This parameter cannot be NULL.
pContext
The argument to the handler routine referenced in pRoutine.
priority
Thread priority to run the application exit handler. This priority can be 0 to 127.
Return Value
Returns TRUE when a process handler has been registered. Otherwise it returns FALSE. Call GetLastError to obtain an error code. Only one networking exit handler is allowed per process. The call will fail if a handler is already attached. The possible error codes are listed below:
Error Code | Meaning |
---|---|
ERROR_INVALID_PARAMETER | pRoutine is NULL or priority is greater than RT_PRIORITY_MAX. |
ERROR_ALREADY_EXISTS | An exit handler is already attached. |
ERROR_NOT_READY | RtNalInit has not completed successfully. |
Remarks
This function allows a user to register a callback for an application using the NAL. This callback will be called at process termination. This allows for application-specific resource cleanup in the event an application fails to exit cleanly.
This callback is useful if an application uses an RTDLL that requires application-specific NAL resource cleanup, since cleanup cannot be done in Dllmain during DLL_PROCESS_DETACH.
This exit handler can be removed by calling RtNalReleaseProcessExitHandler.
Only one exit handler can be attached at a given time.
Avoid doing the following after the callback is executed:
- Avoid calling any C Runtime functions.
- Avoid calling ExitProcess().
Requirements
Minimum Supported Version (NAL) | RTX64 Network Abstraction Layer 2.0 |
Minimum Supported Version (RTX64) | RTX64 3.4 |
Header | rtnapi.h, RtNalApi.h |
Library | RtNal.lib |
See Also: