This implementation is a little inefficient but without using a random access binary db as Windows does (which I am not going to advocate) it's the best we can do. Mike Hearn <mike@xxxxxxxxxxxxx> Implement RegFlushKey, NtRegFlushKey Index: dlls/advapi32/registry.c =================================================================== RCS file: /home/wine/wine/dlls/advapi32/registry.c,v retrieving revision 1.58 diff -u -r1.58 registry.c --- dlls/advapi32/registry.c 13 Dec 2003 01:34:40 -0000 1.58 +++ dlls/advapi32/registry.c 23 Dec 2003 16:50:45 -0000 @@ -1831,8 +1831,10 @@ */ DWORD WINAPI RegFlushKey( HKEY hkey ) { - FIXME( "(%p): stub\n", hkey ); - return ERROR_SUCCESS; + hkey = get_special_root_hkey( hkey ); + if (!hkey) return ERROR_INVALID_HANDLE; + + return RtlNtStatusToDosError( NtFlushKey( hkey ) ); } Index: dlls/kernel/vxd.c =================================================================== RCS file: /home/wine/wine/dlls/kernel/vxd.c,v retrieving revision 1.5 diff -u -r1.5 vxd.c --- dlls/kernel/vxd.c 8 Dec 2003 21:58:55 -0000 1.5 +++ dlls/kernel/vxd.c 23 Dec 2003 16:50:53 -0000 @@ -306,6 +306,14 @@ return RtlNtStatusToDosError( NtClose( hkey ) ); } +/****************************************************************************** + * VMM_RegFlushKey + */ +static DWORD VMM_RegFlushKey( HKEY hkey ) +{ + return RtlNtStatusToDosError( NtFlushKey( hkey ) ); +} + /****************************************************************************** * VMM_RegDeleteKeyA @@ -805,8 +813,7 @@ case 0x001C: /* RegFlushKey */ { HKEY hkey = (HKEY)stack32_pop( context ); - FIXME( "RegFlushKey(%p): stub\n", hkey ); - return ERROR_SUCCESS; + return VMM_RegFlushKey( hkey ); } case 0x001D: /* RegQueryInfoKey */ Index: dlls/ntdll/reg.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/reg.c,v retrieving revision 1.46 diff -u -r1.46 reg.c --- dlls/ntdll/reg.c 4 Dec 2003 20:52:12 -0000 1.46 +++ dlls/ntdll/reg.c 23 Dec 2003 16:51:00 -0000 @@ -542,11 +542,20 @@ * NtFlushKey [NTDLL.@] * ZwFlushKey [NTDLL.@] */ -NTSTATUS WINAPI NtFlushKey(HKEY KeyHandle) +NTSTATUS WINAPI NtFlushKey(HKEY key) { - FIXME("(%p) stub!\n", - KeyHandle); - return 1; + NTSTATUS ret; + + TRACE("key=%p\n", key); + + SERVER_START_REQ( flush_key ) + { + req->hkey = key; + ret = wine_server_call( req ); + } + SERVER_END_REQ; + + return ret; } /****************************************************************************** Index: server/protocol.def =================================================================== RCS file: /home/wine/wine/server/protocol.def,v retrieving revision 1.91 diff -u -r1.91 protocol.def --- server/protocol.def 11 Dec 2003 05:34:53 -0000 1.91 +++ server/protocol.def 23 Dec 2003 16:51:33 -0000 @@ -1294,6 +1294,11 @@ obj_handle_t hkey; /* handle to the key */ @END +/* Flush a registry key */ +@REQ(flush_key) + obj_handle_t hkey; /* handle to the key */ +@END + /* Enumerate registry subkeys */ @REQ(enum_key) Index: server/registry.c =================================================================== RCS file: /home/wine/wine/server/registry.c,v retrieving revision 1.54 diff -u -r1.54 registry.c --- server/registry.c 1 Oct 2003 03:32:16 -0000 1.54 +++ server/registry.c 23 Dec 2003 16:51:37 -0000 @@ -1707,6 +1707,31 @@ release_object( root_key ); } +/* ensure a key has been written out to disk */ +DECL_HANDLER(flush_key) +{ + struct key *key; + + key = get_hkey_obj( req->hkey, 0 ); + if (key) { + int i; + + /* locate the save branch this key belongs to, then write it out - this is the best we can do for now */ + struct key *k = key; + while (k->parent) { + for (i = 0; i < save_branch_count; i++) { + if (k == save_branch_info[i].key) { + save_branch( k, save_branch_info[i].path ); + release_object( key ); + return; + } + } + k = k->parent; + } + + release_object( key ); + } +} /* create a registry key */ DECL_HANDLER(create_key)