Commit e759da26 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e82332f2
...@@ -6772,7 +6772,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas ...@@ -6772,7 +6772,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
/* not a file, treat as a generic object */ /* 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 ); req->handle = wine_server_obj_handle( handle );
if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) ); if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
......
...@@ -4687,8 +4687,22 @@ struct get_object_info_reply ...@@ -4687,8 +4687,22 @@ struct get_object_info_reply
unsigned int access; unsigned int access;
unsigned int ref_count; unsigned int ref_count;
unsigned int handle_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; data_size_t total;
/* VARARG(name,unicode_str); */ /* VARARG(name,unicode_str); */
char __pad_12[4];
}; };
...@@ -5626,6 +5640,7 @@ enum request ...@@ -5626,6 +5640,7 @@ enum request
REQ_open_symlink, REQ_open_symlink,
REQ_query_symlink, REQ_query_symlink,
REQ_get_object_info, REQ_get_object_info,
REQ_get_object_name,
REQ_get_object_type, REQ_get_object_type,
REQ_get_object_types, REQ_get_object_types,
REQ_allocate_locally_unique_id, REQ_allocate_locally_unique_id,
...@@ -5906,6 +5921,7 @@ union generic_request ...@@ -5906,6 +5921,7 @@ union generic_request
struct open_symlink_request open_symlink_request; struct open_symlink_request open_symlink_request;
struct query_symlink_request query_symlink_request; struct query_symlink_request query_symlink_request;
struct get_object_info_request get_object_info_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_type_request get_object_type_request;
struct get_object_types_request get_object_types_request; struct get_object_types_request get_object_types_request;
struct allocate_locally_unique_id_request allocate_locally_unique_id_request; struct allocate_locally_unique_id_request allocate_locally_unique_id_request;
...@@ -6184,6 +6200,7 @@ union generic_reply ...@@ -6184,6 +6200,7 @@ union generic_reply
struct open_symlink_reply open_symlink_reply; struct open_symlink_reply open_symlink_reply;
struct query_symlink_reply query_symlink_reply; struct query_symlink_reply query_symlink_reply;
struct get_object_info_reply get_object_info_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_type_reply get_object_type_reply;
struct get_object_types_reply get_object_types_reply; struct get_object_types_reply get_object_types_reply;
struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply; struct allocate_locally_unique_id_reply allocate_locally_unique_id_reply;
...@@ -6234,7 +6251,7 @@ union generic_reply ...@@ -6234,7 +6251,7 @@ union generic_reply
/* ### protocol_version begin ### */ /* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 719 #define SERVER_PROTOCOL_VERSION 720
/* ### protocol_version end ### */ /* ### protocol_version end ### */
......
...@@ -686,13 +686,22 @@ DECL_HANDLER(dup_handle) ...@@ -686,13 +686,22 @@ DECL_HANDLER(dup_handle)
DECL_HANDLER(get_object_info) DECL_HANDLER(get_object_info)
{ {
struct object *obj; struct object *obj;
WCHAR *name;
if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return; if (!(obj = get_handle_obj( current->process, req->handle, 0, NULL ))) return;
reply->access = get_handle_access( current->process, req->handle ); reply->access = get_handle_access( current->process, req->handle );
reply->ref_count = obj->refcount; reply->ref_count = obj->refcount;
reply->handle_count = obj->handle_count; 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 ))) if ((name = obj->ops->get_full_name( obj, &reply->total )))
set_reply_data_ptr( name, min( reply->total, get_reply_max_size() )); set_reply_data_ptr( name, min( reply->total, get_reply_max_size() ));
release_object( obj ); release_object( obj );
......
...@@ -3299,6 +3299,13 @@ struct handle_info ...@@ -3299,6 +3299,13 @@ struct handle_info
unsigned int access; /* granted access mask */ unsigned int access; /* granted access mask */
unsigned int ref_count; /* object ref count */ unsigned int ref_count; /* object ref count */
unsigned int handle_count; /* object handle count */ unsigned int handle_count; /* object handle count */
@END
/* Query the full name of an object */
@REQ(get_object_name)
obj_handle_t handle; /* handle to the object */
@REPLY
data_size_t total; /* total needed size for name */ data_size_t total; /* total needed size for name */
VARARG(name,unicode_str); /* object name */ VARARG(name,unicode_str); /* object name */
@END @END
......
...@@ -346,6 +346,7 @@ DECL_HANDLER(create_symlink); ...@@ -346,6 +346,7 @@ DECL_HANDLER(create_symlink);
DECL_HANDLER(open_symlink); DECL_HANDLER(open_symlink);
DECL_HANDLER(query_symlink); DECL_HANDLER(query_symlink);
DECL_HANDLER(get_object_info); DECL_HANDLER(get_object_info);
DECL_HANDLER(get_object_name);
DECL_HANDLER(get_object_type); DECL_HANDLER(get_object_type);
DECL_HANDLER(get_object_types); DECL_HANDLER(get_object_types);
DECL_HANDLER(allocate_locally_unique_id); DECL_HANDLER(allocate_locally_unique_id);
...@@ -625,6 +626,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = ...@@ -625,6 +626,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_open_symlink, (req_handler)req_open_symlink,
(req_handler)req_query_symlink, (req_handler)req_query_symlink,
(req_handler)req_get_object_info, (req_handler)req_get_object_info,
(req_handler)req_get_object_name,
(req_handler)req_get_object_type, (req_handler)req_get_object_type,
(req_handler)req_get_object_types, (req_handler)req_get_object_types,
(req_handler)req_allocate_locally_unique_id, (req_handler)req_allocate_locally_unique_id,
...@@ -2018,8 +2020,11 @@ C_ASSERT( sizeof(struct get_object_info_request) == 16 ); ...@@ -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, access) == 8 );
C_ASSERT( FIELD_OFFSET(struct get_object_info_reply, ref_count) == 12 ); 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, 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( 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( 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_request) == 16 );
C_ASSERT( sizeof(struct get_object_type_reply) == 8 ); C_ASSERT( sizeof(struct get_object_type_reply) == 8 );
......
...@@ -4103,7 +4103,16 @@ static void dump_get_object_info_reply( const struct get_object_info_reply *req ...@@ -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, " access=%08x", req->access );
fprintf( stderr, ", ref_count=%08x", req->ref_count ); fprintf( stderr, ", ref_count=%08x", req->ref_count );
fprintf( stderr, ", handle_count=%08x", req->handle_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 ); dump_varargs_unicode_str( ", name=", cur_size );
} }
...@@ -4771,6 +4780,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { ...@@ -4771,6 +4780,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_symlink_request, (dump_func)dump_open_symlink_request,
(dump_func)dump_query_symlink_request, (dump_func)dump_query_symlink_request,
(dump_func)dump_get_object_info_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_type_request,
(dump_func)dump_get_object_types_request, (dump_func)dump_get_object_types_request,
(dump_func)dump_allocate_locally_unique_id_request, (dump_func)dump_allocate_locally_unique_id_request,
...@@ -5047,6 +5057,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { ...@@ -5047,6 +5057,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_symlink_reply, (dump_func)dump_open_symlink_reply,
(dump_func)dump_query_symlink_reply, (dump_func)dump_query_symlink_reply,
(dump_func)dump_get_object_info_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_type_reply,
(dump_func)dump_get_object_types_reply, (dump_func)dump_get_object_types_reply,
(dump_func)dump_allocate_locally_unique_id_reply, (dump_func)dump_allocate_locally_unique_id_reply,
...@@ -5323,6 +5334,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { ...@@ -5323,6 +5334,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"open_symlink", "open_symlink",
"query_symlink", "query_symlink",
"get_object_info", "get_object_info",
"get_object_name",
"get_object_type", "get_object_type",
"get_object_types", "get_object_types",
"allocate_locally_unique_id", "allocate_locally_unique_id",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment