Commit bae75024 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

server/ntdll: Simplistic implementation of NtQueryObject(ObjectBasicInformation).

parent fad936c7
......@@ -63,6 +63,28 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
switch (info_class)
{
case ObjectBasicInformation:
{
POBJECT_BASIC_INFORMATION p = (POBJECT_BASIC_INFORMATION)ptr;
if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
SERVER_START_REQ( get_object_info )
{
req->handle = handle;
status = wine_server_call( req );
if (status == STATUS_SUCCESS)
{
memset( p, 0, sizeof(*p) );
p->GrantedAccess = reply->access;
p->PointerCount = reply->ref_count;
p->HandleCount = 1; /* at least one */
if (used_len) *used_len = sizeof(*p);
}
}
SERVER_END_REQ;
}
break;
case ObjectDataInformation:
{
OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr;
......
......@@ -3967,6 +3967,20 @@ struct query_symlink_reply
};
struct get_object_info_request
{
struct request_header __header;
obj_handle_t handle;
};
struct get_object_info_reply
{
struct reply_header __header;
unsigned int access;
unsigned int ref_count;
};
enum request
{
REQ_new_process,
......@@ -4183,6 +4197,7 @@ enum request
REQ_create_symlink,
REQ_open_symlink,
REQ_query_symlink,
REQ_get_object_info,
REQ_NB_REQUESTS
};
......@@ -4404,6 +4419,7 @@ union generic_request
struct create_symlink_request create_symlink_request;
struct open_symlink_request open_symlink_request;
struct query_symlink_request query_symlink_request;
struct get_object_info_request get_object_info_request;
};
union generic_reply
{
......@@ -4623,8 +4639,9 @@ union generic_reply
struct create_symlink_reply create_symlink_reply;
struct open_symlink_reply open_symlink_reply;
struct query_symlink_reply query_symlink_reply;
struct get_object_info_reply get_object_info_reply;
};
#define SERVER_PROTOCOL_VERSION 274
#define SERVER_PROTOCOL_VERSION 275
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
......@@ -399,9 +399,9 @@ unsigned int get_handle_access( struct process *process, obj_handle_t handle )
{
struct handle_entry *entry;
if (get_magic_handle( handle )) return ~0U; /* magic handles have all access rights */
if (get_magic_handle( handle )) return ~RESERVED_ALL; /* magic handles have all access rights */
if (!(entry = get_handle( process, handle ))) return 0;
return entry->access;
return entry->access & ~RESERVED_ALL;
}
/* find the first inherited handle of the given type */
......@@ -540,3 +540,14 @@ DECL_HANDLER(dup_handle)
release_object( src );
}
}
DECL_HANDLER(get_object_info)
{
struct object *obj;
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;
release_object( obj );
}
......@@ -2848,3 +2848,12 @@ enum message_type
@REPLY
VARARG(target_name,unicode_str); /* target name */
@END
/* Query basic object information */
@REQ(get_object_info)
obj_handle_t handle; /* handle to the object */
@REPLY
unsigned int access; /* granted access mask */
unsigned int ref_count; /* object ref count */
@END
......@@ -324,6 +324,7 @@ DECL_HANDLER(open_directory);
DECL_HANDLER(create_symlink);
DECL_HANDLER(open_symlink);
DECL_HANDLER(query_symlink);
DECL_HANDLER(get_object_info);
#ifdef WANT_REQUEST_HANDLERS
......@@ -544,6 +545,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_create_symlink,
(req_handler)req_open_symlink,
(req_handler)req_query_symlink,
(req_handler)req_get_object_info,
};
#endif /* WANT_REQUEST_HANDLERS */
......
......@@ -3424,6 +3424,17 @@ static void dump_query_symlink_reply( const struct query_symlink_reply *req )
dump_varargs_unicode_str( cur_size );
}
static void dump_get_object_info_request( const struct get_object_info_request *req )
{
fprintf( stderr, " handle=%p", req->handle );
}
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 );
}
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_new_process_request,
(dump_func)dump_get_new_process_info_request,
......@@ -3639,6 +3650,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_symlink_request,
(dump_func)dump_open_symlink_request,
(dump_func)dump_query_symlink_request,
(dump_func)dump_get_object_info_request,
};
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
......@@ -3856,6 +3868,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_create_symlink_reply,
(dump_func)dump_open_symlink_reply,
(dump_func)dump_query_symlink_reply,
(dump_func)dump_get_object_info_reply,
};
static const char * const req_names[REQ_NB_REQUESTS] = {
......@@ -4073,6 +4086,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"create_symlink",
"open_symlink",
"query_symlink",
"get_object_info",
};
static const struct
......
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