RtlRunOnceExecuteOnce function (ntddk.h)
The RtlRunOnceExecuteOnce performs a one-time initialization.
Syntax
NTSYSAPI NTSTATUS RtlRunOnceExecuteOnce(
PRTL_RUN_ONCE RunOnce,
PRTL_RUN_ONCE_INIT_FN InitFn,
PVOID Parameter,
PVOID *Context
);
Parameters
[in, out] RunOnce
A pointer to the RTL_RUN_ONCE one-time initialization structure.
[in] InitFn
A pointer to a RunOnceInitialization routine.
[in, out] Parameter
The value to pass as the Parameter parameter to the RunOnceInitialization routine.
[out] Context
A pointer to a PVOID variable that receives the initialized data.
Return value
RtlRunOnceExecuteOnce returns STATUS_SUCCESS if the operation succeeds, or the appropriate NTSTATUS error code if the operation fails.
Remarks
For the first call to RtlRunOnceExecuteOnce for a particular RTL_RUN_ONCE structure, RtlRunOnceExecuteOnce calls the RunOnceInitialization routine to initialize the data. Every subsequent call to RtlRunOnceExecuteOnce for that structure supplies the same initialized data. The RunOnceInitialization routine will not be called twice for the same RTL_RUN_ONCE structure.
RtlRunOnceExecuteOnce runs with normal kernel APCs disabled. The routine should not be called within a special kernel APC unless all calls occur at APC_LEVEL.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Available starting with Windows Vista. |
Target Platform | Universal |
Header | ntddk.h (include Ntddk.h) |
Library | NtosKrnl.lib |
DLL | NtosKrnl.exe |
IRQL | <= APC_LEVEL (See Remarks section.) |