From 43cb03be3a71ba8821546049a72c86a127e103d3 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Sat, 3 Jan 2004 00:38:30 +0000 Subject: [PATCH] Implemented RegFlushKey and NtFlushKey. --- dlls/advapi32/registry.c | 6 ++++-- dlls/kernel/vxd.c | 11 +++++++++-- dlls/ntdll/reg.c | 17 +++++++++++++---- include/wine/server_protocol.h | 17 ++++++++++++++++- server/protocol.def | 6 ++++++ server/registry.c | 11 +++++++++++ server/request.h | 2 ++ server/trace.c | 8 ++++++++ 8 files changed, 69 insertions(+), 9 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 016c1094698..8adef90d963 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -1831,8 +1831,10 @@ LONG WINAPI RegGetKeySecurity( HKEY hkey, SECURITY_INFORMATION SecurityInformati */ 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 ) ); } diff --git a/dlls/kernel/vxd.c b/dlls/kernel/vxd.c index de8d01da37f..bddbf5a2e64 100644 --- a/dlls/kernel/vxd.c +++ b/dlls/kernel/vxd.c @@ -306,6 +306,14 @@ static DWORD VMM_RegCloseKey( HKEY hkey ) return RtlNtStatusToDosError( NtClose( hkey ) ); } +/****************************************************************************** + * VMM_RegFlushKey + */ +static DWORD VMM_RegFlushKey( HKEY hkey ) +{ + return RtlNtStatusToDosError( NtFlushKey( hkey ) ); +} + /****************************************************************************** * VMM_RegDeleteKeyA @@ -805,8 +813,7 @@ static DWORD VxDCall_VMM( DWORD service, CONTEXT86 *context ) 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 */ diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index 8f61fa0334c..7ab80bdbdce 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -542,11 +542,20 @@ NTSTATUS WINAPI RtlpNtQueryValueKey( HKEY handle, ULONG *result_type, PBYTE dest * 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; } /****************************************************************************** diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index eb10a862798..fa435a47515 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -1795,6 +1795,18 @@ struct delete_key_reply +struct flush_key_request +{ + struct request_header __header; + obj_handle_t hkey; +}; +struct flush_key_reply +{ + struct reply_header __header; +}; + + + struct enum_key_request { struct request_header __header; @@ -3284,6 +3296,7 @@ enum request REQ_create_key, REQ_open_key, REQ_delete_key, + REQ_flush_key, REQ_enum_key, REQ_set_key_value, REQ_get_key_value, @@ -3473,6 +3486,7 @@ union generic_request struct create_key_request create_key_request; struct open_key_request open_key_request; struct delete_key_request delete_key_request; + struct flush_key_request flush_key_request; struct enum_key_request enum_key_request; struct set_key_value_request set_key_value_request; struct get_key_value_request get_key_value_request; @@ -3660,6 +3674,7 @@ union generic_reply struct create_key_reply create_key_reply; struct open_key_reply open_key_reply; struct delete_key_reply delete_key_reply; + struct flush_key_reply flush_key_reply; struct enum_key_reply enum_key_reply; struct set_key_value_reply set_key_value_reply; struct get_key_value_reply get_key_value_reply; @@ -3747,6 +3762,6 @@ union generic_reply struct set_global_windows_reply set_global_windows_reply; }; -#define SERVER_PROTOCOL_VERSION 130 +#define SERVER_PROTOCOL_VERSION 131 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/server/protocol.def b/server/protocol.def index f6e40eb29fe..f8384782a28 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1295,6 +1295,12 @@ enum char_info_mode @END +/* Flush a registry key */ +@REQ(flush_key) + obj_handle_t hkey; /* handle to the key */ +@END + + /* Enumerate registry subkeys */ @REQ(enum_key) obj_handle_t hkey; /* handle to registry key */ diff --git a/server/registry.c b/server/registry.c index 5b2344d4c65..93e49b980f9 100644 --- a/server/registry.c +++ b/server/registry.c @@ -1777,6 +1777,17 @@ DECL_HANDLER(delete_key) } } +/* flush a registry key */ +DECL_HANDLER(flush_key) +{ + struct key *key = get_hkey_obj( req->hkey, 0 ); + if (key) + { + /* we don't need to do anything here with the current implementation */ + release_object( key ); + } +} + /* enumerate registry subkeys */ DECL_HANDLER(enum_key) { diff --git a/server/request.h b/server/request.h index ec2d5a1d943..fcd95ab8d6e 100644 --- a/server/request.h +++ b/server/request.h @@ -200,6 +200,7 @@ DECL_HANDLER(write_process_memory); DECL_HANDLER(create_key); DECL_HANDLER(open_key); DECL_HANDLER(delete_key); +DECL_HANDLER(flush_key); DECL_HANDLER(enum_key); DECL_HANDLER(set_key_value); DECL_HANDLER(get_key_value); @@ -388,6 +389,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = (req_handler)req_create_key, (req_handler)req_open_key, (req_handler)req_delete_key, + (req_handler)req_flush_key, (req_handler)req_enum_key, (req_handler)req_set_key_value, (req_handler)req_get_key_value, diff --git a/server/trace.c b/server/trace.c index 20697008f1b..4319f6dd158 100644 --- a/server/trace.c +++ b/server/trace.c @@ -1563,6 +1563,11 @@ static void dump_delete_key_request( const struct delete_key_request *req ) fprintf( stderr, " hkey=%p", req->hkey ); } +static void dump_flush_key_request( const struct flush_key_request *req ) +{ + fprintf( stderr, " hkey=%p", req->hkey ); +} + static void dump_enum_key_request( const struct enum_key_request *req ) { fprintf( stderr, " hkey=%p,", req->hkey ); @@ -2694,6 +2699,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_create_key_request, (dump_func)dump_open_key_request, (dump_func)dump_delete_key_request, + (dump_func)dump_flush_key_request, (dump_func)dump_enum_key_request, (dump_func)dump_set_key_value_request, (dump_func)dump_get_key_value_request, @@ -2879,6 +2885,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_create_key_reply, (dump_func)dump_open_key_reply, (dump_func)0, + (dump_func)0, (dump_func)dump_enum_key_reply, (dump_func)0, (dump_func)dump_get_key_value_reply, @@ -3064,6 +3071,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { "create_key", "open_key", "delete_key", + "flush_key", "enum_key", "set_key_value", "get_key_value",