RtkRtssAttachEx
RtkRtssAttachEx attaches a Windows 64 kernel device driver to the wRTOS real-time Subsystem and allows setting up a callback function when the Subsystem is shut down.
Syntax
NTSTATUS RtkRtssAttachEx(
[in] ULONG MaxWFSO,
[out] PRTSSINST RtssInstPtr,
[in] VOID (RTKAPI *Routine) (PVOID Context, LONG reason),
[in] PVOID Context,
);
Parameters
[in] MaxWFSO
The count of the number of wait-for-single-objects the user requires. The required minimum is one.
[out] RtssInstPtr
A pointer to an RTSSINST object that will return a non-zero value if the function succeeds, 0 if the function fails.
[in] Routine
This is the callback function to be called when the wRTOS Subsystem starts a normal stop or when the system starts a normal shutdown.
[in] Context
The argument to the call back function.
Return Value
If the function succeeds, it returns STATUS_SUCCESS. If the function fails, it returns one of the following NTSTATUS error codes:
- STATUS_UNSUCCESSFUL
- STATUS_INVALID_PARAMETER
- STATUS_LICENSE_VIOLATION
Remarks
This call should be made only once by a kernel-resident device driver. The returned instance must be used for all subsequent RTKAPI calls. This call is usually made at, but not restricted to, driver entry, unless your device driver is set to start at boot time.
If the device driver caller starts at boot time, you must:
- Set the wRTOS Subsystem to start at the boot time.
- Set your driver dependencies to depend on wRTOS Subsystem (wRTOS_Rtss.sys). For information on setting dependencies, see the MSDN article at https://learn.microsoft.com/en-us/windows-hardware/drivers/install/specifying-driver-load-order
- Make this call ONCE in the Driver Dispatch routine, NEVER in the DriverEntry routine.
The reason arguments have the following values:
| Argument | Value |
|---|---|
|
SHTDN_REASON_WINDOWS_SYSTEM_SHUTDOWN |
The system is starting a normal shutdown. Shortly after all shutdown handlers have been executed, Windows will stop. |
|
SHTDN_REASON_RTX_SYSTEM_SHUTDOWN |
wRTOS Subsystem is going to be stopped (i.e., wRTOS is going to be unloaded). RTSS will continue to operate with service restrictions. |
The driver writer should use this callback function to close all the wRTOS handles created or opened previously. After this function returns, the RTK driver should never make any further RTKAPI calls since wRTOS has called RtkRtssDetach internally.
Note: When the system stops not in a normal shutdown where the reason argument is SHTDN_REASON_WINDOWS_STOP (i.e., blue screen or stop screen), the call back function is not called.
Requirements
| Minimum supported version | Header | Library |
IRQL |
|---|---|---|---|
|
wRTOS 1.0 SDK |
RtkApi.h |
RtkApi_W64.lib |
PASSIVE_LEVEL |
See Also: