RtlRunOnceComplete function (ntddk.h)

The RtlRunOnceComplete routine completes the one-time initialization began by RtlRunOnceBeginInitialize.

Syntax

NTSYSAPI NTSTATUS RtlRunOnceComplete(
  [in, out]      PRTL_RUN_ONCE RunOnce,
  [in]           ULONG         Flags,
  [in, optional] PVOID         Context
);

Parameters

[in, out] RunOnce

Pointer to the RTL_RUN_ONCE one-time initialization structure.

[in] Flags

Drivers can optionally specify one or more of the following flags:

RTL_RUN_ONCE_ASYNC

Operate in asynchronous mode. This mode enables multiple completion attempts to execute in parallel. If this flag is used, subsequent calls to the RtlRunOnceComplete routine will fail unless this flag is also specified.

RTL_RUN_ONCE_INIT_FAILED

The initialization attempt failed.

[in, optional] Context

Specifies the initialized data.

Return value

RtlRunOnceComplete returns one of the following NTSTATUS values:

Return code Description
STATUS_SUCCESS
The operation completed successfully.
STATUS_UNSUCCESSFUL
The operation could not be completed. If the caller specified RTL_RUN_ONCE_ASYNC in the Flags parameter, this value can indicate that another thread completed the initialization.

Remarks

If RtlRunOnceComplete returns STATUS_SUCCESS, any subsequent call to RtlRunOnceBeginInitialize for the same RTL_RUN_ONCE structure supplies Context as the initialized data.

If the caller specified RTL_RUN_ONCE_ASYNC in the Flags parameter and RtlRunOnceComplete returns any value other than STATUS_SUCCESS, the caller must clean up any initialization that it attempted.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of Windows.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL <= APC_LEVEL

See also

RTL_RUN_ONCE

RtlRunOnceBeginInitialize

RtlRunOnceExecuteOnce

RtlRunOnceInitialize

RunOnceInitialization