ndis.sys: Use nameless unions/structs.

This commit is contained in:
Alexandre Julliard 2023-07-14 09:25:19 +02:00
parent 194b4025b0
commit 240df39c1c

View file

@ -21,7 +21,6 @@
#include <stdarg.h> #include <stdarg.h>
#define NONAMELESSUNION
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "windef.h" #include "windef.h"
@ -48,7 +47,7 @@ static void query_global_stats(IRP *irp, const MIB_IF_ROW2 *netdev)
if (irpsp->Parameters.DeviceIoControl.InputBufferLength != sizeof(oid)) if (irpsp->Parameters.DeviceIoControl.InputBufferLength != sizeof(oid))
{ {
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER; irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
return; return;
} }
oid = *(DWORD *)irp->AssociatedIrp.SystemBuffer; oid = *(DWORD *)irp->AssociatedIrp.SystemBuffer;
@ -60,19 +59,19 @@ static void query_global_stats(IRP *irp, const MIB_IF_ROW2 *netdev)
{ {
if (len < sizeof(NDIS_MEDIUM)) if (len < sizeof(NDIS_MEDIUM))
{ {
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER; irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break; break;
} }
*(NDIS_MEDIUM *)response = netdev->MediaType; *(NDIS_MEDIUM *)response = netdev->MediaType;
irp->IoStatus.Information = sizeof(netdev->MediaType); irp->IoStatus.Information = sizeof(netdev->MediaType);
irp->IoStatus.u.Status = STATUS_SUCCESS; irp->IoStatus.Status = STATUS_SUCCESS;
break; break;
} }
case OID_802_3_PERMANENT_ADDRESS: case OID_802_3_PERMANENT_ADDRESS:
{ {
irp->IoStatus.Information = netdev->PhysicalAddressLength; irp->IoStatus.Information = netdev->PhysicalAddressLength;
if (len < netdev->PhysicalAddressLength) if (len < netdev->PhysicalAddressLength)
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER; irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
else else
memcpy( response, netdev->PermanentPhysicalAddress, sizeof(netdev->PermanentPhysicalAddress) ); memcpy( response, netdev->PermanentPhysicalAddress, sizeof(netdev->PermanentPhysicalAddress) );
break; break;
@ -81,7 +80,7 @@ static void query_global_stats(IRP *irp, const MIB_IF_ROW2 *netdev)
{ {
irp->IoStatus.Information = netdev->PhysicalAddressLength; irp->IoStatus.Information = netdev->PhysicalAddressLength;
if (len < netdev->PhysicalAddressLength) if (len < netdev->PhysicalAddressLength)
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER; irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
else else
memcpy( response, netdev->PhysicalAddress, sizeof(netdev->PhysicalAddress) ); memcpy( response, netdev->PhysicalAddress, sizeof(netdev->PhysicalAddress) );
break; break;
@ -89,7 +88,7 @@ static void query_global_stats(IRP *irp, const MIB_IF_ROW2 *netdev)
} }
default: default:
FIXME( "Unsupported OID %lx\n", oid ); FIXME( "Unsupported OID %lx\n", oid );
irp->IoStatus.u.Status = STATUS_INVALID_PARAMETER; irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
break; break;
} }
} }
@ -112,11 +111,11 @@ static NTSTATUS WINAPI ndis_ioctl(DEVICE_OBJECT *device, IRP *irp)
break; break;
default: default:
FIXME( "ioctl %lx not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode ); FIXME( "ioctl %lx not supported\n", irpsp->Parameters.DeviceIoControl.IoControlCode );
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED; irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
break; break;
} }
status = irp->IoStatus.u.Status; status = irp->IoStatus.Status;
IoCompleteRequest( irp, IO_NO_INCREMENT ); IoCompleteRequest( irp, IO_NO_INCREMENT );
return status; return status;
} }