ZwFlushKey routine

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

Syntax


NTSTATUS ZwFlushKey(
  _In_ HANDLE KeyHandle
);

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.

Note   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.

Note  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.

Requirements

Target platform

Universal

Version

Available in Windows 2000 and later versions of Windows.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

PASSIVE_LEVEL

DDI compliance rules

IrqlZwPassive, ZwRegistryCreate, ZwRegistryOpen, HwStorPortProhibitedDDIs, ZwRegistryCreate(storport), ZwRegistryOpen(storport)

See also

Using Nt and Zw Versions of the Native System Services Routines
ZwCreateKey
ZwOpenKey
ZwSetValueKey

 

 

Send comments about this topic to Microsoft

Show: