NtFlushKey - NtDoc

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

/**
 * Flushes the changes to a registry key.
 *
 * @param[in] KeyHandle A handle to the key to be flushed.
 * @return NTSTATUS Successful or errant status.
 */
NTSYSCALLAPI
NTSTATUS
NTAPI
NtFlushKey(
    _In_ HANDLE KeyHandle
    );

#endif

View code on GitHub
#ifndef _NTZWAPI_H

NTSYSCALLAPI
NTSTATUS
NTAPI
ZwFlushKey(
    _In_ HANDLE KeyHandle
    );

#endif

View code on GitHub
// wdm.h

NTSYSAPI NTSTATUS ZwFlushKey(
  [in] HANDLE KeyHandle
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-zwflushkey)

Description

The ZwFlushKey routine forces a registry key to be committed to disk.

Parameters

KeyHandle [in]

Handle to the registry key to be flushed to disk. This handle is created by a successful call to ZwCreateKey or ZwOpenKey.

Return value

ZwFlushKey returns STATUS_SUCCESS if the key information was transferred to disk, or the appropriate error code on failure.

Remarks

You can flush changes made by ZwCreateKey or ZwSetValueKey by calling ZwFlushKey. This routine does not return until all the changed data that is associated with KeyHandle has been written to disk. ZwFlushKey flushes the entire registry hive for the key, which includes every subkey of the key specified.

This routine can flush the entire registry. Accordingly, it can generate a great deal of I/O. Since the system flushes key changes automatically every few seconds, you seldom need to call ZwFlushKey.

For more information about working with registry keys, see Using the Registry in a Driver.

If the call to this function occurs in user mode, you should use the name "NtFlushKey" instead of "ZwFlushKey".

For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.

See also

Using Nt and Zw Versions of the Native System Services Routines

ZwCreateKey

ZwOpenKey

ZwSetValueKey


NTinternals.net (undocumented.ntinternals.net)

This function is documented in Windows Driver Kit.


See ZwFlushKey in NT DDK or 2000 DDK for detailed description.

See also