From f532b9f75c17998ff83bf91cd719e5ee0d51d7b5 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Wed, 20 Nov 2024 20:47:36 +0100
Subject: [PATCH] server: Use an explicit struct instead of a typedef for
 generic access mappings.

---
 include/wine/server_protocol.h | 8 ++++----
 server/object.h                | 4 ++--
 server/protocol.def            | 8 ++++----
 server/request_handlers.h      | 2 +-
 server/request_trace.h         | 2 +-
 server/token.c                 | 4 ++--
 server/trace.c                 | 2 +-
 tools/make_requests            | 2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 5c35f372e9b..f8dec50dd99 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -389,13 +389,13 @@ struct sid
     unsigned int  sub_auth[15];
 };
 
-typedef struct
+struct generic_map
 {
     unsigned int read;
     unsigned int write;
     unsigned int exec;
     unsigned int all;
-} generic_map_t;
+};
 
 #define MAX_ACL_LEN 65535
 
@@ -431,7 +431,7 @@ struct object_type_info
     unsigned int  obj_max;
     unsigned int  handle_max;
     unsigned int  valid_access;
-    generic_map_t mapping;
+    struct generic_map mapping;
 
 };
 
@@ -4744,7 +4744,7 @@ struct access_check_request
     struct request_header __header;
     obj_handle_t    handle;
     unsigned int    desired_access;
-    generic_map_t   mapping;
+    struct generic_map mapping;
     /* VARARG(sd,security_descriptor); */
     char __pad_36[4];
 };
diff --git a/server/object.h b/server/object.h
index 6222e3352ed..7555f564a08 100644
--- a/server/object.h
+++ b/server/object.h
@@ -55,7 +55,7 @@ struct type_descr
 {
     struct unicode_str name;          /* type name */
     unsigned int       valid_access;  /* mask for valid access bits */
-    generic_map_t      mapping;       /* generic access mapping */
+    struct generic_map mapping;       /* generic access mapping */
     unsigned int       index;         /* index in global array of types */
     unsigned int       obj_count;     /* count of objects of this type */
     unsigned int       handle_count;  /* count of handles of this type */
@@ -193,7 +193,7 @@ extern void close_objects(void);
 static inline void make_object_permanent( struct object *obj ) { obj->is_permanent = 1; }
 static inline void make_object_temporary( struct object *obj ) { obj->is_permanent = 0; }
 
-static inline unsigned int map_access( unsigned int access, const generic_map_t *mapping )
+static inline unsigned int map_access( unsigned int access, const struct generic_map *mapping )
 {
     if (access & GENERIC_READ)    access |= mapping->read;
     if (access & GENERIC_WRITE)   access |= mapping->write;
diff --git a/server/protocol.def b/server/protocol.def
index cec50449ca6..b8f7d862800 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -405,13 +405,13 @@ struct sid
     unsigned int  sub_auth[15];
 };
 
-typedef struct
+struct generic_map
 {
     unsigned int read;
     unsigned int write;
     unsigned int exec;
     unsigned int all;
-} generic_map_t;
+};
 
 #define MAX_ACL_LEN 65535
 
@@ -447,7 +447,7 @@ struct object_type_info
     unsigned int  obj_max;       /* max count of objects of this type */
     unsigned int  handle_max;    /* max count of handles of this type */
     unsigned int  valid_access;  /* mask for valid access bits */
-    generic_map_t mapping;       /* generic access mappings */
+    struct generic_map mapping;  /* generic access mappings */
     /* VARARG(name,unicode_str); */
 };
 
@@ -3378,7 +3378,7 @@ enum caret_state
 @REQ(access_check)
     obj_handle_t    handle; /* handle to the token */
     unsigned int    desired_access; /* desired access to the object */
-    generic_map_t   mapping;        /* mapping to specific rights */
+    struct generic_map mapping;     /* mapping to specific rights */
     VARARG(sd,security_descriptor); /* security descriptor to check */
 @REPLY
     unsigned int    access_granted; /* access rights actually granted */
diff --git a/server/request_handlers.h b/server/request_handlers.h
index 66aa6395c0c..a0b51079545 100644
--- a/server/request_handlers.h
+++ b/server/request_handlers.h
@@ -603,7 +603,6 @@ C_ASSERT( sizeof(context_t) == 1728 );
 C_ASSERT( sizeof(cursor_pos_t) == 24 );
 C_ASSERT( sizeof(data_size_t) == 4 );
 C_ASSERT( sizeof(file_pos_t) == 8 );
-C_ASSERT( sizeof(generic_map_t) == 16 );
 C_ASSERT( sizeof(int) == 4 );
 C_ASSERT( sizeof(ioctl_code_t) == 4 );
 C_ASSERT( sizeof(lparam_t) == 8 );
@@ -620,6 +619,7 @@ C_ASSERT( sizeof(short int) == 2 );
 C_ASSERT( sizeof(startup_info_t) == 96 );
 C_ASSERT( sizeof(struct async_data) == 40 );
 C_ASSERT( sizeof(struct filesystem_event) == 12 );
+C_ASSERT( sizeof(struct generic_map) == 16 );
 C_ASSERT( sizeof(struct handle_info) == 20 );
 C_ASSERT( sizeof(struct luid) == 8 );
 C_ASSERT( sizeof(struct luid_attr) == 12 );
diff --git a/server/request_trace.h b/server/request_trace.h
index 9a180c9d6fc..c099d709fe7 100644
--- a/server/request_trace.h
+++ b/server/request_trace.h
@@ -8,7 +8,7 @@
 static void dump_abstime( const char *prefix, const abstime_t *val );
 static void dump_apc_result( const char *prefix, const union apc_result *val );
 static void dump_async_data( const char *prefix, const struct async_data *val );
-static void dump_generic_map( const char *prefix, const generic_map_t *val );
+static void dump_generic_map( const char *prefix, const struct generic_map *val );
 static void dump_hw_input( const char *prefix, const union hw_input *val );
 static void dump_ioctl_code( const char *prefix, const ioctl_code_t *val );
 static void dump_irp_params( const char *prefix, const union irp_params *val );
diff --git a/server/token.c b/server/token.c
index 48ee1eca8fe..a6cf64e34bd 100644
--- a/server/token.c
+++ b/server/token.c
@@ -917,7 +917,7 @@ static unsigned int token_access_check( struct token *token,
                                  unsigned int desired_access,
                                  struct luid_attr *privs,
                                  unsigned int *priv_count,
-                                 const generic_map_t *mapping,
+                                 const struct generic_map *mapping,
                                  unsigned int *granted_access,
                                  unsigned int *status )
 {
@@ -1085,7 +1085,7 @@ unsigned int token_get_session_id( struct token *token )
 
 int check_object_access(struct token *token, struct object *obj, unsigned int *access)
 {
-    generic_map_t mapping;
+    struct generic_map mapping;
     unsigned int status;
     int res;
 
diff --git a/server/trace.c b/server/trace.c
index 9d0c25b6630..1fc0e72cfd7 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -503,7 +503,7 @@ static void dump_luid( const char *prefix, const struct luid *luid )
     fprintf( stderr, "%s%d.%u", prefix, luid->high_part, luid->low_part );
 }
 
-static void dump_generic_map( const char *prefix, const generic_map_t *map )
+static void dump_generic_map( const char *prefix, const struct generic_map *map )
 {
     fprintf( stderr, "%s{r=%08x,w=%08x,x=%08x,a=%08x}",
              prefix, map->read, map->write, map->exec, map->all );
diff --git a/tools/make_requests b/tools/make_requests
index 0a38e81c066..0115f035f0b 100755
--- a/tools/make_requests
+++ b/tools/make_requests
@@ -38,7 +38,6 @@ my %formats =
     "timeout_t"     => [  8,   8 ],
     "abstime_t"     => [  8,   8 ],
     "rectangle_t"   => [  16,  4 ],
-    "generic_map_t" => [  16,  4 ],
     "ioctl_code_t"  => [  4,   4 ],
     "obj_locator_t" => [  16,  8 ],
     # varargs-only structures
@@ -54,6 +53,7 @@ my %formats =
     "struct async_data"        => [ 40, 8 ],
     "union debug_event_data"   => [ 160, 8 ],
     "struct filesystem_event"  => [ 12, 4 ],
+    "struct generic_map"       => [ 16, 4 ],
     "struct handle_info"       => [ 20, 4 ],
     "union hw_input"           => [ 40, 8 ],
     "union irp_params"         => [ 32, 8 ],
-- 
GitLab