Zebediah Figura : server: Use a separate request to retrieve the object name.
Alexandre Julliard
julliard at winehq.org
Thu Jul 1 15:53:49 CDT 2021
Module: wine
Branch: master
Commit: e759da260eb87f464b4964c6f4a00b16226e834f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e759da260eb87f464b4964c6f4a00b16226e834f
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Jun 30 22:08:08 2021 -0500
server: Use a separate request to retrieve the object name.
A deleted key returns STATUS_KEY_DELETED when ObjectNameInformation is
requested, but succeeds when ObjectBasicInformation is requested.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/file.c | 2 +-
include/wine/server_protocol.h | 19 ++++++++++++++++++-
server/handle.c | 11 ++++++++++-
server/protocol.def | 7 +++++++
server/request.h | 7 ++++++-
server/trace.c | 14 +++++++++++++-
6 files changed, 55 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 1a57a112a59..21bcb215385 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -6772,7 +6772,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
/* not a file, treat as a generic object */
- SERVER_START_REQ( get_object_info )
+ SERVER_START_REQ( get_object_name )
{
req->handle = wine_server_obj_handle( handle );
if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 1720eef506e..d73f493edd3 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -4687,8 +4687,22 @@ struct get_object_info_reply
unsigned int access;
unsigned int ref_count;
unsigned int handle_count;
+ char __pad_20[4];
+};
+
+
+
+struct get_object_name_request
+{
+ struct request_header __header;
+ obj_handle_t handle;
+};
+struct get_object_name_reply
+{
+ struct reply_header __header;
data_size_t total;
/* VARARG(name,unicode_str); */
+ char __pad_12[4];
};
@@ -5626,6 +5640,7 @@ enum request
REQ_open_symlink,
REQ_query_symlink,
REQ_get_object_info,
+ REQ_get_object_name,
REQ_get_object_type,
REQ_get_object_types,
REQ_allocate_locally_unique_id,
@@ -5906,6 +5921,7 @@ union generic_request
struct open_symlink_request open_symlink_request;
struct query_symlink_request query_symlink_request;
struct get_object_info_request get_object_info_request;
+ struct get_object_name_request get_object_name_request;
struct get_object_type_request get_object_type_request;
struct get_object_types_request get_object_types_request;
struct allocate_locally_unique_id_request allocate_locally_unique_id_request;
@@ -6184,6 +6200,7 @@ union generic_reply
struct open_symlink_reply open_symlink_reply;
struct query_symlink_reply query_symlink_reply;
struct get_object_info_reply get_object_info_reply;
+ struct get_object_name_reply get_object_name_reply;
struct get_object_type_reply get_object_type_reply;
struct get_object_types_reply get_object_types_reply;
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
@@ -6234,7 +6251,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 719
+#define SERVER_PROTOCOL_VERSION 720
/* ### protocol_version end ### */
diff --git a/server/handle.c b/server/handle.c
index d86f0960ccf..6efd82f2ff9 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -686,13 +686,22 @@ DECL_HANDLER(dup_handle)
DECL_HANDLER(get_object_info)
{
struct object *obj;
- WCHAR *name;
if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
reply->access = get_handle_access( current->process, req->handle );
reply->ref_count = obj->refcount;
reply->handle_count = obj->handle_count;
+ release_object( obj );
+}
+
+DECL_HANDLER(get_object_name)
+{
+ struct object *obj;
+ WCHAR *name;
+
+ if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
+
if ((name = obj->ops->get_full_name( obj, &reply->total )))
set_reply_data_ptr( name, min( reply->total, get_reply_max_size() ));
release_object( obj );
diff --git a/server/protocol.def b/server/protocol.def
index 762be1fa7c0..59ed5632503 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3299,6 +3299,13 @@ struct handle_info
unsigned int access; /* granted access mask */
unsigned int ref_count; /* object ref count */
unsigned int handle_count; /* object handle count */
+ at END
+
+
+/* Query the full name of an object */
+ at REQ(get_object_name)
+ obj_handle_t handle; /* handle to the object */
+ at REPLY
data_size_t total; /* total needed size for name */
VARARG(name,unicode_str); /* object name */
@END
diff --git a/server/request.h b/server/request.h
index 1c45ac34cc7..63b09358612 100644
--- a/server/request.h
+++ b/server/request.h
@@ -346,6 +346,7 @@ DECL_HANDLER(create_symlink);
DECL_HANDLER(open_symlink);
DECL_HANDLER(query_symlink);
DECL_HANDLER(get_object_info);
+DECL_HANDLER(get_object_name);
DECL_HANDLER(get_object_type);
DECL_HANDLER(get_object_types);
DECL_HANDLER(allocate_locally_unique_id);
@@ -625,6 +626,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_open_symlink,
(req_handler)req_query_symlink,
(req_handler)req_get_object_info,
+ (req_handler)req_get_object_name,
(req_handler)req_get_object_type,
(req_handler)req_get_object_types,
(req_handler)req_allocate_locally_unique_id,
@@ -2018,8 +2020,11 @@ C_ASSERT( sizeof(struct get_object_info_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_object_info_reply, access) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_object_info_reply, ref_count) == 12 );
C_ASSERT( FIELD_OFFSET(struct get_object_info_reply, handle_count) == 16 );
-C_ASSERT( FIELD_OFFSET(struct get_object_info_reply, total) == 20 );
C_ASSERT( sizeof(struct get_object_info_reply) == 24 );
+C_ASSERT( FIELD_OFFSET(struct get_object_name_request, handle) == 12 );
+C_ASSERT( sizeof(struct get_object_name_request) == 16 );
+C_ASSERT( FIELD_OFFSET(struct get_object_name_reply, total) == 8 );
+C_ASSERT( sizeof(struct get_object_name_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_object_type_request, handle) == 12 );
C_ASSERT( sizeof(struct get_object_type_request) == 16 );
C_ASSERT( sizeof(struct get_object_type_reply) == 8 );
diff --git a/server/trace.c b/server/trace.c
index 55068d1179b..b3eea846453 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -4103,7 +4103,16 @@ static void dump_get_object_info_reply( const struct get_object_info_reply *req
fprintf( stderr, " access=%08x", req->access );
fprintf( stderr, ", ref_count=%08x", req->ref_count );
fprintf( stderr, ", handle_count=%08x", req->handle_count );
- fprintf( stderr, ", total=%u", req->total );
+}
+
+static void dump_get_object_name_request( const struct get_object_name_request *req )
+{
+ fprintf( stderr, " handle=%04x", req->handle );
+}
+
+static void dump_get_object_name_reply( const struct get_object_name_reply *req )
+{
+ fprintf( stderr, " total=%u", req->total );
dump_varargs_unicode_str( ", name=", cur_size );
}
@@ -4771,6 +4780,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_symlink_request,
(dump_func)dump_query_symlink_request,
(dump_func)dump_get_object_info_request,
+ (dump_func)dump_get_object_name_request,
(dump_func)dump_get_object_type_request,
(dump_func)dump_get_object_types_request,
(dump_func)dump_allocate_locally_unique_id_request,
@@ -5047,6 +5057,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_symlink_reply,
(dump_func)dump_query_symlink_reply,
(dump_func)dump_get_object_info_reply,
+ (dump_func)dump_get_object_name_reply,
(dump_func)dump_get_object_type_reply,
(dump_func)dump_get_object_types_reply,
(dump_func)dump_allocate_locally_unique_id_reply,
@@ -5323,6 +5334,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"open_symlink",
"query_symlink",
"get_object_info",
+ "get_object_name",
"get_object_type",
"get_object_types",
"allocate_locally_unique_id",
More information about the wine-cvs
mailing list