RtlRunOnceExecuteOnce function

The RtlRunOnceExecuteOnce performs a one-time initialization.

Syntax

NTSTATUS RtlRunOnceExecuteOnce(
  _Inout_ PRTL_RUN_ONCE         RunOnce,
  _In_    PRTL_RUN_ONCE_INIT_FN InitFn,
  _Inout_ PVOID                 Parameter,
  _Out_   PVOID                 *Context
);

Parameters

RunOnce

A pointer to the RTL_RUN_ONCE one-time initialization structure.

InitFn

A pointer to a RunOnceInitialization routine.

Context

A pointer to a PVOID variable that receives the initialized data.

Parameter

The value to pass as the Parameter parameter to the RunOnceInitialization routine.

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

   
Windows version 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.)"

See Also

RtlRunOnceInitialize

RunOnceInitialization

RtlRunOnceComplete

RTL_RUN_ONCE

RtlRunOnceBeginInitialize

Send comments about this topic to Microsoft