ntoskrnl.exe: Use nameless union/structs.
This commit is contained in:
parent
99159c7a0b
commit
23daba9abe
3 changed files with 38 additions and 44 deletions
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define NONAMELESSUNION
|
|
||||||
#include "windef.h"
|
#include "windef.h"
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winternl.h"
|
#include "winternl.h"
|
||||||
|
|
|
@ -23,9 +23,6 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define NONAMELESSUNION
|
|
||||||
#define NONAMELESSSTRUCT
|
|
||||||
|
|
||||||
#include "ntoskrnl_private.h"
|
#include "ntoskrnl_private.h"
|
||||||
#include "excpt.h"
|
#include "excpt.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
|
@ -466,7 +463,7 @@ static ULONG get_irp_output_size( IRP *irp )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_ERROR(irp->IoStatus.u.Status))
|
if (NT_ERROR(irp->IoStatus.Status))
|
||||||
return 0;
|
return 0;
|
||||||
return irp->IoStatus.Information;
|
return irp->IoStatus.Information;
|
||||||
}
|
}
|
||||||
|
@ -493,7 +490,7 @@ static NTSTATUS WINAPI dispatch_irp_completion( DEVICE_OBJECT *device, IRP *irp,
|
||||||
SERVER_START_REQ( set_irp_result )
|
SERVER_START_REQ( set_irp_result )
|
||||||
{
|
{
|
||||||
req->handle = wine_server_obj_handle( irp_data->handle );
|
req->handle = wine_server_obj_handle( irp_data->handle );
|
||||||
req->status = irp->IoStatus.u.Status;
|
req->status = irp->IoStatus.Status;
|
||||||
req->size = irp->IoStatus.Information;
|
req->size = irp->IoStatus.Information;
|
||||||
if (out_size) wine_server_add_data( req, irp->UserBuffer, out_size );
|
if (out_size) wine_server_add_data( req, irp->UserBuffer, out_size );
|
||||||
status = wine_server_call( req );
|
status = wine_server_call( req );
|
||||||
|
@ -973,7 +970,7 @@ NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event )
|
||||||
|
|
||||||
req->prev = wine_server_obj_handle( context.irp_data->handle );
|
req->prev = wine_server_obj_handle( context.irp_data->handle );
|
||||||
req->pending = irp->PendingReturned;
|
req->pending = irp->PendingReturned;
|
||||||
req->iosb_status = irp->IoStatus.u.Status;
|
req->iosb_status = irp->IoStatus.Status;
|
||||||
req->result = irp->IoStatus.Information;
|
req->result = irp->IoStatus.Information;
|
||||||
if (out_size) wine_server_add_data( req, irp->UserBuffer, out_size );
|
if (out_size) wine_server_add_data( req, irp->UserBuffer, out_size );
|
||||||
}
|
}
|
||||||
|
@ -1103,7 +1100,7 @@ void WINAPI IoInitializeIrp( IRP *irp, USHORT size, CCHAR stack_size )
|
||||||
InitializeListHead( &irp->ThreadListEntry );
|
InitializeListHead( &irp->ThreadListEntry );
|
||||||
irp->StackCount = stack_size;
|
irp->StackCount = stack_size;
|
||||||
irp->CurrentLocation = stack_size + 1;
|
irp->CurrentLocation = stack_size + 1;
|
||||||
irp->Tail.Overlay.s.u2.CurrentStackLocation =
|
irp->Tail.Overlay.CurrentStackLocation =
|
||||||
(PIO_STACK_LOCATION)(irp + 1) + stack_size;
|
(PIO_STACK_LOCATION)(irp + 1) + stack_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1116,7 +1113,7 @@ void WINAPI IoReuseIrp(IRP *irp, NTSTATUS iostatus)
|
||||||
AllocationFlags = irp->AllocationFlags;
|
AllocationFlags = irp->AllocationFlags;
|
||||||
IoInitializeIrp(irp, irp->Size, irp->StackCount);
|
IoInitializeIrp(irp, irp->Size, irp->StackCount);
|
||||||
irp->AllocationFlags = AllocationFlags;
|
irp->AllocationFlags = AllocationFlags;
|
||||||
irp->IoStatus.u.Status = iostatus;
|
irp->IoStatus.Status = iostatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -1508,7 +1505,7 @@ static void build_driver_keypath( const WCHAR *name, UNICODE_STRING *keypath )
|
||||||
static NTSTATUS WINAPI unhandled_irp( DEVICE_OBJECT *device, IRP *irp )
|
static NTSTATUS WINAPI unhandled_irp( DEVICE_OBJECT *device, IRP *irp )
|
||||||
{
|
{
|
||||||
TRACE( "(%p, %p)\n", device, irp );
|
TRACE( "(%p, %p)\n", device, irp );
|
||||||
irp->IoStatus.u.Status = STATUS_INVALID_DEVICE_REQUEST;
|
irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
|
||||||
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
||||||
return STATUS_INVALID_DEVICE_REQUEST;
|
return STATUS_INVALID_DEVICE_REQUEST;
|
||||||
}
|
}
|
||||||
|
@ -1845,7 +1842,7 @@ NTSTATUS WINAPI IoCallDriver( DEVICE_OBJECT *device, IRP *irp )
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
--irp->CurrentLocation;
|
--irp->CurrentLocation;
|
||||||
irpsp = --irp->Tail.Overlay.s.u2.CurrentStackLocation;
|
irpsp = --irp->Tail.Overlay.CurrentStackLocation;
|
||||||
irpsp->DeviceObject = device;
|
irpsp->DeviceObject = device;
|
||||||
dispatch = device->DriverObject->MajorFunction[irpsp->MajorFunction];
|
dispatch = device->DriverObject->MajorFunction[irpsp->MajorFunction];
|
||||||
|
|
||||||
|
@ -2057,10 +2054,10 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
|
||||||
|
|
||||||
TRACE( "%p %u\n", irp, priority_boost );
|
TRACE( "%p %u\n", irp, priority_boost );
|
||||||
|
|
||||||
status = irp->IoStatus.u.Status;
|
status = irp->IoStatus.Status;
|
||||||
while (irp->CurrentLocation <= irp->StackCount)
|
while (irp->CurrentLocation <= irp->StackCount)
|
||||||
{
|
{
|
||||||
irpsp = irp->Tail.Overlay.s.u2.CurrentStackLocation;
|
irpsp = irp->Tail.Overlay.CurrentStackLocation;
|
||||||
routine = irpsp->CompletionRoutine;
|
routine = irpsp->CompletionRoutine;
|
||||||
call_flag = 0;
|
call_flag = 0;
|
||||||
if (routine)
|
if (routine)
|
||||||
|
@ -2073,7 +2070,7 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
|
||||||
call_flag = 1;
|
call_flag = 1;
|
||||||
}
|
}
|
||||||
++irp->CurrentLocation;
|
++irp->CurrentLocation;
|
||||||
++irp->Tail.Overlay.s.u2.CurrentStackLocation;
|
++irp->Tail.Overlay.CurrentStackLocation;
|
||||||
if (irp->CurrentLocation <= irp->StackCount)
|
if (irp->CurrentLocation <= irp->StackCount)
|
||||||
device = IoGetCurrentIrpStackLocation(irp)->DeviceObject;
|
device = IoGetCurrentIrpStackLocation(irp)->DeviceObject;
|
||||||
else
|
else
|
||||||
|
@ -2308,20 +2305,20 @@ static void initialize_lookaside_list( GENERAL_LOOKASIDE *lookaside, PALLOCATE_F
|
||||||
ULONG type, SIZE_T size, ULONG tag )
|
ULONG type, SIZE_T size, ULONG tag )
|
||||||
{
|
{
|
||||||
|
|
||||||
RtlInitializeSListHead( &lookaside->u.ListHead );
|
RtlInitializeSListHead( &lookaside->ListHead );
|
||||||
lookaside->Depth = 4;
|
lookaside->Depth = 4;
|
||||||
lookaside->MaximumDepth = 256;
|
lookaside->MaximumDepth = 256;
|
||||||
lookaside->TotalAllocates = 0;
|
lookaside->TotalAllocates = 0;
|
||||||
lookaside->u2.AllocateMisses = 0;
|
lookaside->AllocateMisses = 0;
|
||||||
lookaside->TotalFrees = 0;
|
lookaside->TotalFrees = 0;
|
||||||
lookaside->u3.FreeMisses = 0;
|
lookaside->FreeMisses = 0;
|
||||||
lookaside->Type = type;
|
lookaside->Type = type;
|
||||||
lookaside->Tag = tag;
|
lookaside->Tag = tag;
|
||||||
lookaside->Size = size;
|
lookaside->Size = size;
|
||||||
lookaside->u4.Allocate = allocate ? allocate : ExAllocatePoolWithTag;
|
lookaside->Allocate = allocate ? allocate : ExAllocatePoolWithTag;
|
||||||
lookaside->u5.Free = free ? free : ExFreePool;
|
lookaside->Free = free ? free : ExFreePool;
|
||||||
lookaside->LastTotalAllocates = 0;
|
lookaside->LastTotalAllocates = 0;
|
||||||
lookaside->u6.LastAllocateMisses = 0;
|
lookaside->LastAllocateMisses = 0;
|
||||||
|
|
||||||
/* FIXME: insert in global list of lookadside lists */
|
/* FIXME: insert in global list of lookadside lists */
|
||||||
}
|
}
|
||||||
|
@ -2359,8 +2356,8 @@ void WINAPI ExInitializePagedLookasideList(PPAGED_LOOKASIDE_LIST lookaside,
|
||||||
static void delete_lookaside_list( GENERAL_LOOKASIDE *lookaside )
|
static void delete_lookaside_list( GENERAL_LOOKASIDE *lookaside )
|
||||||
{
|
{
|
||||||
void *entry;
|
void *entry;
|
||||||
while ((entry = RtlInterlockedPopEntrySList(&lookaside->u.ListHead)))
|
while ((entry = RtlInterlockedPopEntrySList(&lookaside->ListHead)))
|
||||||
lookaside->u5.FreeEx(entry, (LOOKASIDE_LIST_EX*)lookaside);
|
lookaside->FreeEx(entry, (LOOKASIDE_LIST_EX*)lookaside);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2903,7 +2900,7 @@ PHYSICAL_ADDRESS WINAPI MmGetPhysicalAddress(void *virtual_address)
|
||||||
*/
|
*/
|
||||||
PVOID WINAPI MmMapIoSpace( PHYSICAL_ADDRESS PhysicalAddress, DWORD NumberOfBytes, DWORD CacheType )
|
PVOID WINAPI MmMapIoSpace( PHYSICAL_ADDRESS PhysicalAddress, DWORD NumberOfBytes, DWORD CacheType )
|
||||||
{
|
{
|
||||||
FIXME( "stub: 0x%08lx%08lx, %ld, %ld\n", PhysicalAddress.u.HighPart, PhysicalAddress.u.LowPart, NumberOfBytes, CacheType );
|
FIXME( "stub: 0x%08lx%08lx, %ld, %ld\n", PhysicalAddress.HighPart, PhysicalAddress.LowPart, NumberOfBytes, CacheType );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3954,8 +3951,8 @@ static HMODULE load_driver( const WCHAR *driver_name, const UNICODE_STRING *keyn
|
||||||
RtlInitUnicodeString(&module_name, str);
|
RtlInitUnicodeString(&module_name, str);
|
||||||
nt = RtlImageNtHeader(module);
|
nt = RtlImageNtHeader(module);
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.u.s.ImageAddressingMode = IMAGE_ADDRESSING_MODE_32BIT;
|
info.ImageAddressingMode = IMAGE_ADDRESSING_MODE_32BIT;
|
||||||
info.u.s.SystemModeImage = TRUE;
|
info.SystemModeImage = TRUE;
|
||||||
info.ImageSize = nt->OptionalHeader.SizeOfImage;
|
info.ImageSize = nt->OptionalHeader.SizeOfImage;
|
||||||
info.ImageBase = module;
|
info.ImageBase = module;
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define NONAMELESSUNION
|
|
||||||
|
|
||||||
#include "ntoskrnl_private.h"
|
#include "ntoskrnl_private.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
|
@ -89,12 +87,12 @@ static NTSTATUS get_device_id( DEVICE_OBJECT *device, BUS_QUERY_ID_TYPE type, WC
|
||||||
irpsp->MinorFunction = IRP_MN_QUERY_ID;
|
irpsp->MinorFunction = IRP_MN_QUERY_ID;
|
||||||
irpsp->Parameters.QueryId.IdType = type;
|
irpsp->Parameters.QueryId.IdType = type;
|
||||||
|
|
||||||
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
|
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
||||||
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
||||||
|
|
||||||
*id = (WCHAR *)irp_status.Information;
|
*id = (WCHAR *)irp_status.Information;
|
||||||
return irp_status.u.Status;
|
return irp_status.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor )
|
static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor )
|
||||||
|
@ -116,11 +114,11 @@ static NTSTATUS send_pnp_irp( DEVICE_OBJECT *device, UCHAR minor )
|
||||||
irpsp->Parameters.StartDevice.AllocatedResources = NULL;
|
irpsp->Parameters.StartDevice.AllocatedResources = NULL;
|
||||||
irpsp->Parameters.StartDevice.AllocatedResourcesTranslated = NULL;
|
irpsp->Parameters.StartDevice.AllocatedResourcesTranslated = NULL;
|
||||||
|
|
||||||
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
|
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
||||||
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
||||||
|
|
||||||
return irp_status.u.Status;
|
return irp_status.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer )
|
static NTSTATUS get_device_instance_id( DEVICE_OBJECT *device, WCHAR *buffer )
|
||||||
|
@ -176,11 +174,11 @@ static NTSTATUS get_device_caps( DEVICE_OBJECT *device, DEVICE_CAPABILITIES *cap
|
||||||
irpsp->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
|
irpsp->MinorFunction = IRP_MN_QUERY_CAPABILITIES;
|
||||||
irpsp->Parameters.DeviceCapabilities.Capabilities = caps;
|
irpsp->Parameters.DeviceCapabilities.Capabilities = caps;
|
||||||
|
|
||||||
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
|
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
if (IoCallDriver( device, irp ) == STATUS_PENDING)
|
||||||
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
||||||
|
|
||||||
return irp_status.u.Status;
|
return irp_status.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void load_function_driver( DEVICE_OBJECT *device, HDEVINFO set, SP_DEVINFO_DATA *sp_device )
|
static void load_function_driver( DEVICE_OBJECT *device, HDEVINFO set, SP_DEVINFO_DATA *sp_device )
|
||||||
|
@ -435,14 +433,14 @@ static void handle_bus_relations( DEVICE_OBJECT *parent )
|
||||||
irpsp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
|
irpsp->MinorFunction = IRP_MN_QUERY_DEVICE_RELATIONS;
|
||||||
irpsp->Parameters.QueryDeviceRelations.Type = BusRelations;
|
irpsp->Parameters.QueryDeviceRelations.Type = BusRelations;
|
||||||
|
|
||||||
irp->IoStatus.u.Status = STATUS_NOT_SUPPORTED;
|
irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
|
||||||
if (IoCallDriver( parent, irp ) == STATUS_PENDING)
|
if (IoCallDriver( parent, irp ) == STATUS_PENDING)
|
||||||
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
KeWaitForSingleObject( &event, Executive, KernelMode, FALSE, NULL );
|
||||||
|
|
||||||
relations = (DEVICE_RELATIONS *)irp_status.Information;
|
relations = (DEVICE_RELATIONS *)irp_status.Information;
|
||||||
if (irp_status.u.Status)
|
if (irp_status.Status)
|
||||||
{
|
{
|
||||||
ERR("Failed to enumerate child devices, status %#lx.\n", irp_status.u.Status);
|
ERR("Failed to enumerate child devices, status %#lx.\n", irp_status.Status);
|
||||||
SetupDiDestroyDeviceInfoList( set );
|
SetupDiDestroyDeviceInfoList( set );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1047,14 +1045,14 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
|
||||||
case IRP_MN_START_DEVICE:
|
case IRP_MN_START_DEVICE:
|
||||||
case IRP_MN_SURPRISE_REMOVAL:
|
case IRP_MN_SURPRISE_REMOVAL:
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
irp->IoStatus.u.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
case IRP_MN_REMOVE_DEVICE:
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
list_remove( &root_device->entry );
|
list_remove( &root_device->entry );
|
||||||
irp->IoStatus.u.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
case IRP_MN_QUERY_CAPABILITIES:
|
case IRP_MN_QUERY_CAPABILITIES:
|
||||||
irp->IoStatus.u.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
break;
|
break;
|
||||||
case IRP_MN_QUERY_ID:
|
case IRP_MN_QUERY_ID:
|
||||||
{
|
{
|
||||||
|
@ -1072,12 +1070,12 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
|
||||||
memcpy( id, root_device->id, (p - root_device->id) * sizeof(WCHAR) );
|
memcpy( id, root_device->id, (p - root_device->id) * sizeof(WCHAR) );
|
||||||
id[p - root_device->id] = 0;
|
id[p - root_device->id] = 0;
|
||||||
irp->IoStatus.Information = (ULONG_PTR)id;
|
irp->IoStatus.Information = (ULONG_PTR)id;
|
||||||
irp->IoStatus.u.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
irp->IoStatus.Information = 0;
|
irp->IoStatus.Information = 0;
|
||||||
irp->IoStatus.u.Status = STATUS_NO_MEMORY;
|
irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BusQueryInstanceID:
|
case BusQueryInstanceID:
|
||||||
|
@ -1086,12 +1084,12 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
|
||||||
{
|
{
|
||||||
wcscpy( id, p + 1 );
|
wcscpy( id, p + 1 );
|
||||||
irp->IoStatus.Information = (ULONG_PTR)id;
|
irp->IoStatus.Information = (ULONG_PTR)id;
|
||||||
irp->IoStatus.u.Status = STATUS_SUCCESS;
|
irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
irp->IoStatus.Information = 0;
|
irp->IoStatus.Information = 0;
|
||||||
irp->IoStatus.u.Status = STATUS_NO_MEMORY;
|
irp->IoStatus.Status = STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1103,7 +1101,7 @@ static NTSTATUS WINAPI pnp_manager_device_pnp( DEVICE_OBJECT *device, IRP *irp )
|
||||||
FIXME("Unhandled PnP request %#x.\n", stack->MinorFunction);
|
FIXME("Unhandled PnP request %#x.\n", stack->MinorFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = irp->IoStatus.u.Status;
|
status = irp->IoStatus.Status;
|
||||||
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
IoCompleteRequest( irp, IO_NO_INCREMENT );
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue