RtlRunOnceBeginInitialize - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

_Must_inspect_result_
NTSYSAPI
NTSTATUS
NTAPI
RtlRunOnceBeginInitialize(
    _Inout_ PRTL_RUN_ONCE RunOnce,
    _In_ ULONG Flags,
    _Outptr_opt_result_maybenull_ PVOID *Context
    );

#endif

View code on GitHub
// ntddk.h

NTSYSAPI NTSTATUS RtlRunOnceBeginInitialize(
  [in, out] PRTL_RUN_ONCE RunOnce,
  [in]      ULONG         Flags,
  [out]     PVOID         *Context
);
View the official Windows Driver Kit DDI reference

NtDoc

This function is documented in Windows Driver Kit.

Windows Driver Kit DDI reference (nf-ntddk-rtlrunoncebegininitialize)

RtlRunOnceBeginInitialize function

Description

The RtlRunOnceBeginInitialize routine begins a one-time initialization.

Parameters

RunOnce [in, out]

Pointer to the RTL_RUN_ONCE one-time initialization structure.

Flags [in]

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

RTL_RUN_ONCE_ASYNC

Perform initialization asynchronously. The driver can perform multiple completion attempts in parallel. If this flag is used, subsequent calls to this routine will fail unless this flag is also specified.

RTL_RUN_ONCE_CHECK_ONLY

Do not begin initialization, but check to determine if initialization has already occurred. If RtlRunOnceBeginInitialize returns STATUS_SUCCESS, the initialization succeeded, and *Context contains the initialized data.

Context [out]

Specifies a pointer to a PVOID variable that receives the initialized data. The value of *Context is valid only when the routine returns STATUS_SUCCESS.

Return value

RtlRunOnceBeginInitialize returns one of the following NTSTATUS values:

Return code Description
STATUS_SUCCESS The one-time initialization has already completed. The initialized data is stored in the memory location that Context points to.
STATUS_PENDING The caller has successfully begun one-time initialization. The caller now performs the driver-specific initialization steps and then calls RtlRunOnceComplete to complete the initialization.

Remarks

Drivers can alternatively perform one-time initialization by calling RtlRunOnceExecuteOnce and supplying a RunOnceInitialization routine.

See also

RTL_RUN_ONCE

RtlRunOnceComplete

RtlRunOnceExecuteOnce

RtlRunOnceInitialize

RunOnceInitialization