forked from Mirrors/wine-wine
server/ntdll: Simplistic implementation of NtQueryObject(ObjectBasicInformation).
parent
fad936c7c5
commit
bae75024a4
|
@ -63,6 +63,28 @@ NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
|
||||||
|
|
||||||
switch (info_class)
|
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:
|
case ObjectDataInformation:
|
||||||
{
|
{
|
||||||
OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr;
|
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
|
enum request
|
||||||
{
|
{
|
||||||
REQ_new_process,
|
REQ_new_process,
|
||||||
|
@ -4183,6 +4197,7 @@ enum request
|
||||||
REQ_create_symlink,
|
REQ_create_symlink,
|
||||||
REQ_open_symlink,
|
REQ_open_symlink,
|
||||||
REQ_query_symlink,
|
REQ_query_symlink,
|
||||||
|
REQ_get_object_info,
|
||||||
REQ_NB_REQUESTS
|
REQ_NB_REQUESTS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4404,6 +4419,7 @@ union generic_request
|
||||||
struct create_symlink_request create_symlink_request;
|
struct create_symlink_request create_symlink_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;
|
||||||
};
|
};
|
||||||
union generic_reply
|
union generic_reply
|
||||||
{
|
{
|
||||||
|
@ -4623,8 +4639,9 @@ union generic_reply
|
||||||
struct create_symlink_reply create_symlink_reply;
|
struct create_symlink_reply create_symlink_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;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 274
|
#define SERVER_PROTOCOL_VERSION 275
|
||||||
|
|
||||||
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
|
#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;
|
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;
|
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 */
|
/* find the first inherited handle of the given type */
|
||||||
|
@ -540,3 +540,14 @@ DECL_HANDLER(dup_handle)
|
||||||
release_object( src );
|
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
|
@REPLY
|
||||||
VARARG(target_name,unicode_str); /* target name */
|
VARARG(target_name,unicode_str); /* target name */
|
||||||
@END
|
@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(create_symlink);
|
||||||
DECL_HANDLER(open_symlink);
|
DECL_HANDLER(open_symlink);
|
||||||
DECL_HANDLER(query_symlink);
|
DECL_HANDLER(query_symlink);
|
||||||
|
DECL_HANDLER(get_object_info);
|
||||||
|
|
||||||
#ifdef WANT_REQUEST_HANDLERS
|
#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_create_symlink,
|
||||||
(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,
|
||||||
};
|
};
|
||||||
#endif /* WANT_REQUEST_HANDLERS */
|
#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 );
|
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] = {
|
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_new_process_request,
|
(dump_func)dump_new_process_request,
|
||||||
(dump_func)dump_get_new_process_info_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_create_symlink_request,
|
||||||
(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,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
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_create_symlink_reply,
|
||||||
(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,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const req_names[REQ_NB_REQUESTS] = {
|
static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
|
@ -4073,6 +4086,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
"create_symlink",
|
"create_symlink",
|
||||||
"open_symlink",
|
"open_symlink",
|
||||||
"query_symlink",
|
"query_symlink",
|
||||||
|
"get_object_info",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
|
|
Loading…
Reference in New Issue