[PATCH 4/6] dlls/nsiproxy.sys: don't use long types for local types (struct and local variables)

Eric Pouech eric.pouech at gmail.com
Sat Apr 23 02:32:59 CDT 2022


Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/nsiproxy.sys/device.c    |    6 ++---
 dlls/nsiproxy.sys/icmp_echo.c |    2 +-
 dlls/nsiproxy.sys/ip.c        |   50 +++++++++++++++++++++--------------------
 dlls/nsiproxy.sys/ndis.c      |   30 ++++++++++++-------------
 dlls/nsiproxy.sys/nsi.c       |    4 ++-
 dlls/nsiproxy.sys/tcp.c       |   10 ++++----
 dlls/nsiproxy.sys/udp.c       |    6 ++---
 7 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/dlls/nsiproxy.sys/device.c b/dlls/nsiproxy.sys/device.c
index 9e0a1d1f6a13..cc9b00d33590 100644
--- a/dlls/nsiproxy.sys/device.c
+++ b/dlls/nsiproxy.sys/device.c
@@ -79,7 +79,7 @@ static NTSTATUS nsiproxy_enumerate_all( IRP *irp )
 
     if (in_len != sizeof(*in)) return STATUS_INVALID_PARAMETER;
 
-    if (out_len < sizeof(DWORD) + (in->key_size + in->rw_size + in->dynamic_size + in->static_size) * in->count)
+    if (out_len < sizeof(UINT) + (in->key_size + in->rw_size + in->dynamic_size + in->static_size) * in->count)
         return STATUS_INVALID_PARAMETER;
 
     enum_all.unknown[0] = 0;
@@ -88,7 +88,7 @@ static NTSTATUS nsiproxy_enumerate_all( IRP *irp )
     enum_all.second_arg = in->second_arg;
     enum_all.module = &in->module;
     enum_all.table = in->table;
-    enum_all.key_data = (BYTE *)out + sizeof(DWORD);
+    enum_all.key_data = (BYTE *)out + sizeof(UINT);
     enum_all.key_size = in->key_size;
     enum_all.rw_data = (BYTE *)enum_all.key_data + in->key_size * in->count;
     enum_all.rw_size = in->rw_size;
@@ -102,7 +102,7 @@ static NTSTATUS nsiproxy_enumerate_all( IRP *irp )
     if (status == STATUS_SUCCESS || status == STATUS_BUFFER_OVERFLOW)
     {
         irp->IoStatus.Information = out_len;
-        *(DWORD *)out = enum_all.count;
+        *(UINT *)out = enum_all.count;
     }
     else irp->IoStatus.Information = 0;
 
diff --git a/dlls/nsiproxy.sys/icmp_echo.c b/dlls/nsiproxy.sys/icmp_echo.c
index 5f2b776745a9..c3ce841c003e 100644
--- a/dlls/nsiproxy.sys/icmp_echo.c
+++ b/dlls/nsiproxy.sys/icmp_echo.c
@@ -666,7 +666,7 @@ NTSTATUS icmp_send_echo( void *args )
     return params->handle ? STATUS_PENDING : STATUS_NO_MEMORY;
 }
 
-static int get_timeout( LARGE_INTEGER start, DWORD timeout )
+static int get_timeout( LARGE_INTEGER start, UINT timeout )
 {
     LARGE_INTEGER now, end;
 
diff --git a/dlls/nsiproxy.sys/ip.c b/dlls/nsiproxy.sys/ip.c
index 15c039858084..b8fff704f385 100644
--- a/dlls/nsiproxy.sys/ip.c
+++ b/dlls/nsiproxy.sys/ip.c
@@ -99,7 +99,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(nsi);
 
-static inline DWORD nsi_popcount( DWORD m )
+static inline UINT nsi_popcount( UINT m )
 {
 #ifdef HAVE___BUILTIN_POPCOUNT
     return __builtin_popcount( m );
@@ -110,19 +110,19 @@ static inline DWORD nsi_popcount( DWORD m )
 #endif
 }
 
-static DWORD mask_v4_to_prefix( struct in_addr *addr )
+static UINT mask_v4_to_prefix( struct in_addr *addr )
 {
     return nsi_popcount( addr->s_addr );
 }
 
-static DWORD mask_v6_to_prefix( struct in6_addr *addr )
+static UINT mask_v6_to_prefix( struct in6_addr *addr )
 {
-    DWORD ret;
+    UINT ret;
 
-    ret = nsi_popcount( *(DWORD *)addr->s6_addr );
-    ret += nsi_popcount( *(DWORD *)(addr->s6_addr + 4) );
-    ret += nsi_popcount( *(DWORD *)(addr->s6_addr + 8) );
-    ret += nsi_popcount( *(DWORD *)(addr->s6_addr + 12) );
+    ret = nsi_popcount( *(UINT *)addr->s6_addr );
+    ret += nsi_popcount( *(UINT *)(addr->s6_addr + 4) );
+    ret += nsi_popcount( *(UINT *)(addr->s6_addr + 8) );
+    ret += nsi_popcount( *(UINT *)(addr->s6_addr + 12) );
     return ret;
 }
 
@@ -159,7 +159,7 @@ static NTSTATUS ip_cmpt_get_all_parameters( UINT fam, const UINT *key, UINT key_
     const NPI_MODULEID *ip_mod = (fam == AF_INET) ? &NPI_MS_IPV4_MODULEID : &NPI_MS_IPV6_MODULEID;
     struct nsi_ip_cmpt_rw rw;
     struct nsi_ip_cmpt_dynamic dyn;
-    DWORD count;
+    UINT count;
 
     memset( &rw, 0, sizeof(rw) );
     memset( &dyn, 0, sizeof(dyn) );
@@ -367,7 +367,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, UINT key_siz
         struct data
         {
             const char *name;
-            DWORD pos;
+            UINT pos;
         };
         static const struct data in_list[] =
         {
@@ -406,7 +406,7 @@ static NTSTATUS ipv6_icmpstats_get_all_parameters( const void *key, UINT key_siz
             { "Icmp6OutMLDv2Reports",           ICMP6_V2_MEMBERSHIP_REPORT },
         };
         char buf[512], *ptr, *value;
-        DWORD res, i;
+        UINT res, i;
         FILE *fp;
 
         if (!(fp = fopen( "/proc/net/snmp6", "r" ))) return STATUS_NOT_SUPPORTED;
@@ -506,7 +506,7 @@ static NTSTATUS ipv4_ipstats_get_all_parameters( const void *key, UINT key_size,
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
             if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
-                DWORD in_recv, in_hdr_errs, fwd_dgrams, in_delivers, out_reqs;
+                UINT in_recv, in_hdr_errs, fwd_dgrams, in_delivers, out_reqs;
                 ptr += sizeof(hdr);
                 sscanf( ptr, "%*u %*u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u",
                         &in_recv,
@@ -625,7 +625,7 @@ static NTSTATUS ipv6_ipstats_get_all_parameters( const void *key, UINT key_size,
         };
         NTSTATUS status = STATUS_NOT_SUPPORTED;
         char buf[512], *ptr, *value;
-        DWORD i;
+        UINT i;
         FILE *fp;
 
         if (!(fp = fopen( "/proc/net/snmp6", "r" ))) return STATUS_NOT_SUPPORTED;
@@ -665,7 +665,7 @@ static void unicast_fill_entry( struct ifaddrs *entry, void *key, struct nsi_ip_
 {
     struct nsi_ipv6_unicast_key placeholder, *key6 = key;
     struct nsi_ipv4_unicast_key *key4 = key;
-    DWORD scope_id = 0;
+    UINT scope_id = 0;
 
     if (!key)
     {
@@ -723,7 +723,7 @@ static NTSTATUS ip_unicast_enumerate_all( int family, void *key_data, UINT key_s
                                           void *dynamic_data, UINT dynamic_size,
                                           void *static_data, UINT static_size, UINT_PTR *count )
 {
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
     struct ifaddrs *addrs, *entry;
@@ -815,7 +815,7 @@ struct ipv4_neighbour_data
     UINT if_index;
     struct in_addr addr;
     BYTE phys_addr[IF_MAX_PHYS_ADDRESS_LENGTH];
-    DWORD state;
+    UINT state;
     USHORT phys_addr_len;
     BOOL is_router;
     BOOL is_unreachable;
@@ -854,7 +854,7 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, UINT key_size, voi
                                               void *dynamic_data, UINT dynamic_size,
                                               void *static_data, UINT static_size, UINT_PTR *count )
 {
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
     struct ipv4_neighbour_data entry;
@@ -865,7 +865,7 @@ static NTSTATUS ipv4_neighbour_enumerate_all( void *key_data, UINT key_size, voi
 #ifdef __linux__
     {
         char buf[512], *ptr;
-        DWORD atf_flags;
+        UINT atf_flags;
         FILE *fp;
 
         if (!(fp = fopen( "/proc/net/arp", "r" ))) return STATUS_NOT_SUPPORTED;
@@ -1005,10 +1005,10 @@ struct ipv4_route_data
     NET_LUID luid;
     UINT if_index;
     struct in_addr prefix;
-    DWORD prefix_len;
+    UINT prefix_len;
     struct in_addr next_hop;
-    DWORD metric;
-    DWORD protocol;
+    UINT metric;
+    UINT protocol;
     BYTE loopback;
 };
 
@@ -1060,7 +1060,7 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, UINT key_size, void
                                             void *dynamic_data, UINT dynamic_size,
                                             void *static_data, UINT static_size, UINT_PTR *count )
 {
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
     struct ipv4_route_data entry;
@@ -1072,7 +1072,7 @@ static NTSTATUS ipv4_forward_enumerate_all( void *key_data, UINT key_size, void
     {
         char buf[512], *ptr;
         struct in_addr mask;
-        DWORD rtf_flags;
+        UINT rtf_flags;
         FILE *fp;
 
         if (!(fp = fopen( "/proc/net/route", "r" ))) return STATUS_NOT_SUPPORTED;
@@ -1249,7 +1249,7 @@ static struct module_table ipv4_tables[] =
     {
         NSI_IP_COMPARTMENT_TABLE,
         {
-            sizeof(DWORD), sizeof(struct nsi_ip_cmpt_rw),
+            sizeof(UINT), sizeof(struct nsi_ip_cmpt_rw),
             sizeof(struct nsi_ip_cmpt_dynamic), 0
         },
         NULL,
@@ -1314,7 +1314,7 @@ static struct module_table ipv6_tables[] =
     {
         NSI_IP_COMPARTMENT_TABLE,
         {
-            sizeof(DWORD), sizeof(struct nsi_ip_cmpt_rw),
+            sizeof(UINT), sizeof(struct nsi_ip_cmpt_rw),
             sizeof(struct nsi_ip_cmpt_dynamic), 0
         },
         NULL,
diff --git a/dlls/nsiproxy.sys/ndis.c b/dlls/nsiproxy.sys/ndis.c
index 34d20b4be7fe..ba4933ff16b9 100644
--- a/dlls/nsiproxy.sys/ndis.c
+++ b/dlls/nsiproxy.sys/ndis.c
@@ -95,14 +95,14 @@ struct if_entry
     WCHAR *if_name;
     char if_unix_name[IFNAMSIZ];
     IF_PHYSICAL_ADDRESS if_phys_addr;
-    DWORD if_index;
-    DWORD if_type;
+    UINT if_index;
+    UINT if_type;
 };
 
 static struct list if_list = LIST_INIT( if_list );
 static pthread_mutex_t if_list_lock = PTHREAD_MUTEX_INITIALIZER;
 
-static struct if_entry *find_entry_from_index( DWORD index )
+static struct if_entry *find_entry_from_index( UINT index )
 {
     struct if_entry *entry;
 
@@ -123,7 +123,7 @@ static struct if_entry *find_entry_from_luid( const NET_LUID *luid )
 }
 
 #if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
-static NTSTATUS if_get_physical( const char *name, DWORD *type, IF_PHYSICAL_ADDRESS *phys_addr )
+static NTSTATUS if_get_physical( const char *name, UINT *type, IF_PHYSICAL_ADDRESS *phys_addr )
 {
     int fd, size, i;
     struct ifreq ifr;
@@ -132,7 +132,7 @@ static NTSTATUS if_get_physical( const char *name, DWORD *type, IF_PHYSICAL_ADDR
     {
         unsigned short ifi_type;
         IFTYPE mib_type;
-        DWORD addr_len;
+        UINT addr_len;
     } types[] =
     {
         { ARPHRD_LOOPBACK, MIB_IF_TYPE_LOOPBACK, 0 },
@@ -177,7 +177,7 @@ err:
 
 #elif defined (HAVE_SYS_SYSCTL_H) && defined (HAVE_NET_IF_DL_H)
 
-static NTSTATUS if_get_physical( const char *name, DWORD *type, IF_PHYSICAL_ADDRESS *phys_addr )
+static NTSTATUS if_get_physical( const char *name, UINT *type, IF_PHYSICAL_ADDRESS *phys_addr )
 {
     struct if_msghdr *ifm;
     struct sockaddr_dl *sdl;
@@ -245,7 +245,7 @@ static NTSTATUS if_get_physical( const char *name, DWORD *type, IF_PHYSICAL_ADDR
 static WCHAR *strdupAtoW( const char *str )
 {
     WCHAR *ret = NULL;
-    DWORD len;
+    SIZE_T len;
 
     if (!str) return ret;
     len = strlen( str ) + 1;
@@ -254,7 +254,7 @@ static WCHAR *strdupAtoW( const char *str )
     return ret;
 }
 
-static struct if_entry *add_entry( DWORD index, char *name )
+static struct if_entry *add_entry( UINT index, char *name )
 {
     struct if_entry *entry;
     int name_len = strlen( name );
@@ -451,7 +451,7 @@ static NTSTATUS ifinfo_enumerate_all( void *key_data, UINT key_size, void *rw_da
                                       void *static_data, UINT static_size, UINT_PTR *count )
 {
     struct if_entry *entry;
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
 
@@ -509,7 +509,7 @@ static NTSTATUS ifinfo_get_all_parameters( const void *key, UINT key_size, void
     return status;
 }
 
-static NTSTATUS ifinfo_get_rw_parameter( struct if_entry *entry, void *data, DWORD data_size, DWORD data_offset )
+static NTSTATUS ifinfo_get_rw_parameter( struct if_entry *entry, void *data, UINT data_size, UINT data_offset )
 {
     switch (data_offset)
     {
@@ -527,13 +527,13 @@ static NTSTATUS ifinfo_get_rw_parameter( struct if_entry *entry, void *data, DWO
     return STATUS_INVALID_PARAMETER;
 }
 
-static NTSTATUS ifinfo_get_static_parameter( struct if_entry *entry, void *data, DWORD data_size, DWORD data_offset )
+static NTSTATUS ifinfo_get_static_parameter( struct if_entry *entry, void *data, UINT data_size, UINT data_offset )
 {
     switch (data_offset)
     {
     case FIELD_OFFSET( struct nsi_ndis_ifinfo_static, if_index ):
-        if (data_size != sizeof(DWORD)) return STATUS_INVALID_PARAMETER;
-        *(DWORD *)data = entry->if_index;
+        if (data_size != sizeof(UINT)) return STATUS_INVALID_PARAMETER;
+        *(UINT *)data = entry->if_index;
         return STATUS_SUCCESS;
 
     case FIELD_OFFSET( struct nsi_ndis_ifinfo_static, if_guid ):
@@ -593,7 +593,7 @@ static NTSTATUS index_luid_get_parameter( const void *key, UINT key_size, UINT p
 
     update_if_table();
 
-    entry = find_entry_from_index( *(DWORD *)key );
+    entry = find_entry_from_index( *(UINT *)key );
     if (entry)
     {
         *(NET_LUID *)data = entry->if_luid;
@@ -660,7 +660,7 @@ static const struct module_table tables[] =
     {
         NSI_NDIS_INDEX_LUID_TABLE,
         {
-            sizeof(DWORD), 0,
+            sizeof(UINT), 0,
             0, sizeof(NET_LUID)
         },
         NULL,
diff --git a/dlls/nsiproxy.sys/nsi.c b/dlls/nsiproxy.sys/nsi.c
index fa997d2fe360..b9b04e635455 100644
--- a/dlls/nsiproxy.sys/nsi.c
+++ b/dlls/nsiproxy.sys/nsi.c
@@ -49,7 +49,7 @@ static const struct module *modules[] =
     &udp_module,
 };
 
-static const struct module_table *get_module_table( const NPI_MODULEID *id, DWORD table )
+static const struct module_table *get_module_table( const NPI_MODULEID *id, UINT table )
 {
     const struct module_table *entry;
     int i;
@@ -65,7 +65,7 @@ static const struct module_table *get_module_table( const NPI_MODULEID *id, DWOR
 NTSTATUS nsi_enumerate_all_ex( struct nsi_enumerate_all_ex *params )
 {
     const struct module_table *entry = get_module_table( params->module, params->table );
-    DWORD sizes[4] = { params->key_size, params->rw_size, params->dynamic_size, params->static_size };
+    UINT sizes[4] = { params->key_size, params->rw_size, params->dynamic_size, params->static_size };
     void *data[4] = { params->key_data, params->rw_data, params->dynamic_data, params->static_data };
     int i;
 
diff --git a/dlls/nsiproxy.sys/tcp.c b/dlls/nsiproxy.sys/tcp.c
index 95f99c06f98f..8e2d7e749a79 100644
--- a/dlls/nsiproxy.sys/tcp.c
+++ b/dlls/nsiproxy.sys/tcp.c
@@ -143,7 +143,7 @@ static NTSTATUS tcp_stats_get_all_parameters( const void *key, UINT key_size, vo
             if (!(ptr = fgets( buf, sizeof(buf), fp ))) break;
             if (!ascii_strncasecmp( buf, hdr, sizeof(hdr) - 1 ))
             {
-                DWORD in_segs, out_segs;
+                UINT in_segs, out_segs;
                 ptr += sizeof(hdr);
                 sscanf( ptr, "%u %u %u %u %u %u %u %u %u %u %u %u %u %u",
                         &stat.rto_algo,
@@ -248,7 +248,7 @@ struct ipv6_addr_scope *get_ipv6_addr_scope_table( unsigned int *size )
         while ((ptr = fgets( buf, sizeof(buf), fp )))
         {
             WORD a[8];
-            DWORD scope;
+            UINT scope;
             struct ipv6_addr_scope *entry;
             unsigned int i;
 
@@ -519,7 +519,7 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k
                                          struct nsi_tcp_conn_dynamic *dynamic_data, UINT dynamic_size,
                                          struct nsi_tcp_conn_static *static_data, UINT static_size, UINT_PTR *count )
 {
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
     struct nsi_tcp_conn_key key;
@@ -586,8 +586,8 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k
             ptr = fgets( buf, sizeof(buf), fp );
             while ((ptr = fgets( buf, sizeof(buf), fp )))
             {
-                DWORD *local_addr = (DWORD *)&key.local.Ipv6.sin6_addr;
-                DWORD *remote_addr = (DWORD *)&key.remote.Ipv6.sin6_addr;
+                UINT *local_addr = (UINT *)&key.local.Ipv6.sin6_addr;
+                UINT *remote_addr = (UINT *)&key.remote.Ipv6.sin6_addr;
 
                 if (sscanf( ptr, "%*u: %8x%8x%8x%8x:%hx %8x%8x%8x%8x:%hx %x %*s %*s %*s %*s %*s %*s %*s %d",
                             local_addr, local_addr + 1, local_addr + 2, local_addr + 3, &key.local.Ipv6.sin6_port,
diff --git a/dlls/nsiproxy.sys/udp.c b/dlls/nsiproxy.sys/udp.c
index 1bcbb2532bd0..0ba2f835e44d 100644
--- a/dlls/nsiproxy.sys/udp.c
+++ b/dlls/nsiproxy.sys/udp.c
@@ -154,7 +154,7 @@ static NTSTATUS udp_stats_get_all_parameters( const void *key, UINT key_size, vo
             { "Udp6OutDatagrams", &out_dgrams },
         };
         char buf[512], *ptr, *value;
-        DWORD res, i;
+        UINT res, i;
         FILE *fp;
 
         if (!(fp = fopen( "/proc/net/snmp6", "r" ))) return STATUS_NOT_SUPPORTED;
@@ -206,7 +206,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void
                                             void *dynamic_data, UINT dynamic_size,
                                             void *static_data, UINT static_size, UINT_PTR *count )
 {
-    DWORD num = 0;
+    UINT num = 0;
     NTSTATUS status = STATUS_SUCCESS;
     BOOL want_data = key_size || rw_size || dynamic_size || static_size;
     struct nsi_udp_endpoint_key key, *key_out = key_data;
@@ -266,7 +266,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void
             ptr = fgets( buf, sizeof(buf), fp );
             while ((ptr = fgets( buf, sizeof(buf), fp )))
             {
-                DWORD *local_addr = (DWORD *)&key.local.Ipv6.sin6_addr;
+                UINT *local_addr = (UINT *)&key.local.Ipv6.sin6_addr;
 
                 if (sscanf( ptr, "%*u: %8x%8x%8x%8x:%hx %*s %*s %*s %*s %*s %*s %*s %d",
                             local_addr, local_addr + 1, local_addr + 2, local_addr + 3,




More information about the wine-devel mailing list