The ZwFlushKey routine forces a registry key to be committed to disk.
NTSTATUS
ZwFlushKey(
IN HANDLE KeyHandle
);
Declared in ntddk.h. Include ntddk.h.
ZwFlushKey returns STATUS_SUCCESS if the key information was transferred to disk, or the appropriate error code on failure.
Changes made by ZwCreateKey or ZwSetValueKey can be flushed to disk with ZwFlushKey. This routine does not return to its caller until any changed data associated with the given KeyHandle has been written to permanent store.
Note This routine can flush the entire registry. Accordingly, it can generate a great deal of I/O. Since the system automatically flushes key changes every few seconds, it is seldom necessary to call ZwFlushKey.
Callers of ZwFlushKey must be running at IRQL = PASSIVE_LEVEL.