[PATCH 3/3] ntdll: Fill the object type index in System(Extended)HandleInformation.

Zebediah Figura z.figura12 at gmail.com
Wed Feb 17 22:59:17 CST 2021


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ntdll/unix/system.c | 6 ++++--
 server/handle.c          | 4 ++++
 server/protocol.def      | 1 +
 server/trace.c           | 4 ++--
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index f4a879d8748..6cf044d496f 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2447,7 +2447,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
                     shi->Handle[i].HandleValue  = handle_info[i].handle;
                     shi->Handle[i].AccessMask   = handle_info[i].access;
                     shi->Handle[i].HandleFlags  = handle_info[i].attributes;
-                    /* FIXME: Fill out ObjectType, ObjectPointer */
+                    shi->Handle[i].ObjectType   = handle_info[i].type;
+                    /* FIXME: Fill out ObjectPointer */
                 }
             }
             else if (ret == STATUS_BUFFER_TOO_SMALL)
@@ -2498,7 +2499,8 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
                     shi->Handles[i].HandleValue      = handle_info[i].handle;
                     shi->Handles[i].GrantedAccess    = handle_info[i].access;
                     shi->Handles[i].HandleAttributes = handle_info[i].attributes;
-                    /* FIXME: Fill out Object, ObjectTypeIndex */
+                    shi->Handles[i].ObjectTypeIndex  = handle_info[i].type;
+                    /* FIXME: Fill out Object */
                 }
             }
             else if (ret == STATUS_BUFFER_TOO_SMALL)
diff --git a/server/handle.c b/server/handle.c
index c32b001f2e2..399cd7fa62b 100644
--- a/server/handle.c
+++ b/server/handle.c
@@ -815,6 +815,7 @@ static int enum_handles( struct process *process, void *user )
     struct handle_table *table = process->handles;
     struct handle_entry *entry;
     struct handle_info *handle;
+    struct object *obj;
     unsigned int i;
 
     if (!table)
@@ -838,6 +839,9 @@ static int enum_handles( struct process *process, void *user )
             handle->attributes |= OBJ_INHERIT;
         if (entry->access & RESERVED_CLOSE_PROTECT)
             handle->attributes |= OBJ_PROTECT_CLOSE;
+        obj = get_handle_obj( process, index_to_handle(i), 0, NULL );
+        handle->type = obj->ops->type->index;
+        release_object( obj );
         info->count--;
     }
 
diff --git a/server/protocol.def b/server/protocol.def
index 5126a9e37e5..7f3b785df51 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3198,6 +3198,7 @@ struct handle_info
     obj_handle_t handle;
     unsigned int access;
     unsigned int attributes;
+    unsigned int type;
 };
 
 /* Return a list of all opened handles */
diff --git a/server/trace.c b/server/trace.c
index 9faa3d5a443..b07935cc54b 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1342,8 +1342,8 @@ static void dump_varargs_handle_infos( const char *prefix, data_size_t size )
     while (size >= sizeof(*handle))
     {
         handle = cur_data;
-        fprintf( stderr, "{owner=%04x,handle=%04x,access=%08x,attributes=%08x}",
-                 handle->owner, handle->handle, handle->access, handle->attributes );
+        fprintf( stderr, "{owner=%04x,handle=%04x,access=%08x,attributes=%08x,type=%u}",
+                 handle->owner, handle->handle, handle->access, handle->attributes, handle->type );
         size -= sizeof(*handle);
         remove_data( sizeof(*handle) );
         if (size) fputc( ',', stderr );
-- 
2.20.1




More information about the wine-devel mailing list