mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
- Rename device context struct
- patch by Chris svn path=/trunk/; revision=39132
This commit is contained in:
parent
16a9e8d714
commit
42bd582bfe
|
@ -102,7 +102,7 @@ PcAddAdapterDevice(
|
||||||
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
NTSTATUS status = STATUS_UNSUCCESSFUL;
|
||||||
PDEVICE_OBJECT fdo = NULL;
|
PDEVICE_OBJECT fdo = NULL;
|
||||||
PDEVICE_OBJECT PrevDeviceObject;
|
PDEVICE_OBJECT PrevDeviceObject;
|
||||||
PCExtension* portcls_ext;
|
PPCLASS_DEVICE_EXTENSION portcls_ext;
|
||||||
|
|
||||||
DPRINT1("PcAddAdapterDevice called\n");
|
DPRINT1("PcAddAdapterDevice called\n");
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ PcAddAdapterDevice(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Obtain the new device extension */
|
/* Obtain the new device extension */
|
||||||
portcls_ext = (PCExtension*) fdo->DeviceExtension;
|
portcls_ext = (PPCLASS_DEVICE_EXTENSION) fdo->DeviceExtension;
|
||||||
/* initialize the device extension */
|
/* initialize the device extension */
|
||||||
RtlZeroMemory(portcls_ext, DeviceExtensionSize);
|
RtlZeroMemory(portcls_ext, DeviceExtensionSize);
|
||||||
/* allocate create item */
|
/* allocate create item */
|
||||||
|
@ -208,14 +208,14 @@ PciDriverDispatch(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
ISubdevice * SubDevice;
|
ISubdevice * SubDevice;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
SUBDEVICE_ENTRY * Entry;
|
SUBDEVICE_ENTRY * Entry;
|
||||||
KSDISPATCH_TABLE DispatchTable;
|
KSDISPATCH_TABLE DispatchTable;
|
||||||
|
|
||||||
DPRINT1("PortClsSysControl called\n");
|
DPRINT1("PortClsSysControl called\n");
|
||||||
|
|
||||||
SubDevice = (ISubdevice*)Irp->Tail.Overlay.DriverContext[3];
|
SubDevice = (ISubdevice*)Irp->Tail.Overlay.DriverContext[3];
|
||||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
if (!SubDevice || !DeviceExt)
|
if (!SubDevice || !DeviceExt)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +257,7 @@ PcRegisterSubdevice(
|
||||||
IN PWCHAR Name,
|
IN PWCHAR Name,
|
||||||
IN PUNKNOWN Unknown)
|
IN PUNKNOWN Unknown)
|
||||||
{
|
{
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ISubdevice *SubDevice;
|
ISubdevice *SubDevice;
|
||||||
UNICODE_STRING SymbolicLinkName;
|
UNICODE_STRING SymbolicLinkName;
|
||||||
|
@ -272,7 +272,7 @@ PcRegisterSubdevice(
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
if (!DeviceExt)
|
if (!DeviceExt)
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ RegisterConnection(
|
||||||
UNICODE_STRING ToUnicodeString = {0, 0, 0};
|
UNICODE_STRING ToUnicodeString = {0, 0, 0};
|
||||||
ISubdevice * FromSubDevice = NULL;
|
ISubdevice * FromSubDevice = NULL;
|
||||||
ISubdevice * ToSubDevice = NULL;
|
ISubdevice * ToSubDevice = NULL;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
|
@ -486,7 +486,7 @@ PcNewDmaChannel(
|
||||||
ULONG MapRegisters;
|
ULONG MapRegisters;
|
||||||
INTERFACE_TYPE BusType;
|
INTERFACE_TYPE BusType;
|
||||||
ULONG ResultLength;
|
ULONG ResultLength;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
IDmaChannelSlaveImpl * This;
|
IDmaChannelSlaveImpl * This;
|
||||||
|
|
||||||
|
@ -499,7 +499,7 @@ PcNewDmaChannel(
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceExt = (PCExtension*) DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyLegacyBusType, sizeof(BusType), (PVOID)&BusType, &ResultLength);
|
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyLegacyBusType, sizeof(BusType), (PVOID)&BusType, &ResultLength);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
|
|
@ -69,94 +69,89 @@ PortClsPnp(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS Status;
|
||||||
PCExtension* portcls_ext;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
PIO_STACK_LOCATION irp_stack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
|
IResourceList* resource_list = NULL;
|
||||||
|
|
||||||
DPRINT1("PortClsPnp called\n");
|
DPRINT1("PortClsPnp called\n");
|
||||||
|
|
||||||
portcls_ext = (PCExtension*) DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
|
||||||
irp_stack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
ASSERT(portcls_ext);
|
ASSERT(DeviceExt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if IRP_MN_START_DEVICE, call the driver's customer start device routine.
|
if IRP_MN_START_DEVICE, call the driver's customer start device routine.
|
||||||
Before we do so, we must create a ResourceList to pass to the Start
|
Before we do so, we must create a ResourceList to pass to the Start
|
||||||
routine.
|
routine.
|
||||||
*/
|
*/
|
||||||
if ( irp_stack->MinorFunction == IRP_MN_START_DEVICE )
|
switch (IoStack->MinorFunction)
|
||||||
{
|
{
|
||||||
IResourceList* resource_list;
|
case IRP_MN_START_DEVICE:
|
||||||
DPRINT("IRP_MN_START_DEVICE\n");
|
DPRINT("IRP_MN_START_DEVICE\n");
|
||||||
|
|
||||||
/* Create the resource list */
|
/* Create the resource list */
|
||||||
status = PcNewResourceList(
|
Status = PcNewResourceList(
|
||||||
&resource_list,
|
&resource_list,
|
||||||
NULL,
|
NULL,
|
||||||
PagedPool,
|
PagedPool,
|
||||||
irp_stack->Parameters.StartDevice.AllocatedResourcesTranslated,
|
IoStack->Parameters.StartDevice.AllocatedResourcesTranslated,
|
||||||
irp_stack->Parameters.StartDevice.AllocatedResources);
|
IoStack->Parameters.StartDevice.AllocatedResources);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
if ( ! NT_SUCCESS(status) )
|
|
||||||
{
|
{
|
||||||
DPRINT("PcNewResourceList failed [0x%8x]\n", status);
|
DPRINT("PcNewResourceList failed [0x%8x]\n", Status);
|
||||||
Irp->IoStatus.Status = status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
return Status;
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assign the resource list to our extension */
|
/* Assign the resource list to our extension */
|
||||||
portcls_ext->resources = resource_list;
|
DeviceExt->resources = resource_list;
|
||||||
|
|
||||||
ASSERT(portcls_ext->StartDevice);
|
ASSERT(DeviceExt->StartDevice);
|
||||||
|
|
||||||
/* Call the StartDevice routine */
|
/* Call the StartDevice routine */
|
||||||
DPRINT("Calling StartDevice at 0x%8p\n", portcls_ext->StartDevice);
|
DPRINT("Calling StartDevice at 0x%8p\n", DeviceExt->StartDevice);
|
||||||
status = portcls_ext->StartDevice(DeviceObject, Irp, resource_list);
|
Status = DeviceExt->StartDevice(DeviceObject, Irp, resource_list);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
if ( ! NT_SUCCESS(status) )
|
|
||||||
{
|
{
|
||||||
DPRINT("StartDevice returned a failure code [0x%8x]\n", status);
|
DPRINT("StartDevice returned a failure code [0x%8x]\n", Status);
|
||||||
//resource_list->lpVtbl->Release(resource_list);
|
//resource_list->lpVtbl->Release(resource_list);
|
||||||
|
|
||||||
Irp->IoStatus.Status = status;
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
return Status;
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return status;
|
return Status;
|
||||||
}
|
|
||||||
else if ( irp_stack->MinorFunction == IRP_MN_REMOVE_DEVICE )
|
|
||||||
{
|
|
||||||
DPRINT("IRP_MN_REMOVE_DEVICE\n");
|
|
||||||
/* Clean up */
|
|
||||||
portcls_ext->resources->lpVtbl->Release(portcls_ext->resources);
|
|
||||||
|
|
||||||
|
case IRP_MN_REMOVE_DEVICE:
|
||||||
|
/* Clean up */
|
||||||
|
DPRINT("IRP_MN_REMOVE_DEVICE\n");
|
||||||
|
|
||||||
|
DeviceExt->resources->lpVtbl->Release(DeviceExt->resources);
|
||||||
IoDeleteDevice(DeviceObject);
|
IoDeleteDevice(DeviceObject);
|
||||||
|
|
||||||
/* Do not complete? */
|
/* Do not complete? */
|
||||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
|
||||||
else if ( irp_stack->MinorFunction == IRP_MN_QUERY_INTERFACE )
|
case IRP_MN_QUERY_INTERFACE:
|
||||||
{
|
DPRINT1("FIXME: IRP_MN_QUERY_INTERFACE: call next lower device object\n");
|
||||||
//FIXME
|
/* FIXME
|
||||||
// call next lower device object
|
* call next lower device object */
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
return Irp->IoStatus.Status;
|
return Irp->IoStatus.Status;
|
||||||
}
|
|
||||||
else if ( irp_stack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS)
|
case IRP_MN_QUERY_DEVICE_RELATIONS:
|
||||||
{
|
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
return Irp->IoStatus.Status;
|
return Irp->IoStatus.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT1("unhandled function %u\n", irp_stack->MinorFunction);
|
DPRINT1("unhandled function %u\n", IoStack->MinorFunction);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,13 +213,13 @@ PcDispatchIrp(
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
IN PDEVICE_OBJECT DeviceObject,
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION irp_stack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
|
|
||||||
DPRINT1("PcDispatchIrp called - handling IRP in PortCls\n");
|
DPRINT1("PcDispatchIrp called - handling IRP in PortCls\n");
|
||||||
|
|
||||||
irp_stack = IoGetCurrentIrpStackLocation(Irp);
|
IoStack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
switch ( irp_stack->MajorFunction )
|
switch ( IoStack->MajorFunction )
|
||||||
{
|
{
|
||||||
/* PortCls */
|
/* PortCls */
|
||||||
case IRP_MJ_CREATE :
|
case IRP_MJ_CREATE :
|
||||||
|
@ -298,12 +293,12 @@ PcForwardIrpSynchronous(
|
||||||
IN PIRP Irp)
|
IN PIRP Irp)
|
||||||
{
|
{
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT1("PcForwardIrpSynchronous\n");
|
DPRINT1("PcForwardIrpSynchronous\n");
|
||||||
|
|
||||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
/* initialize the notification event */
|
/* initialize the notification event */
|
||||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||||
|
|
|
@ -14,7 +14,7 @@ PcRegisterAdapterPowerManagement(
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_OBJECT pDeviceObject;
|
PDEVICE_OBJECT pDeviceObject;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
IAdapterPowerManagement * pPower;
|
IAdapterPowerManagement * pPower;
|
||||||
|
|
||||||
DPRINT1("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n", pUnknown, pvContext);
|
DPRINT1("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n", pUnknown, pvContext);
|
||||||
|
@ -24,7 +24,7 @@ PcRegisterAdapterPowerManagement(
|
||||||
|
|
||||||
|
|
||||||
pDeviceObject = (PDEVICE_OBJECT)pvContext;
|
pDeviceObject = (PDEVICE_OBJECT)pvContext;
|
||||||
DeviceExt = (PCExtension*)pDeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)pDeviceObject->DeviceExtension;
|
||||||
|
|
||||||
Status = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IAdapterPowerManagement, (PVOID*)&pPower);
|
Status = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IAdapterPowerManagement, (PVOID*)&pPower);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -64,12 +64,12 @@ PcRequestNewPowerState(
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
POWER_STATE PowerState;
|
POWER_STATE PowerState;
|
||||||
PCExtension* DeviceExt;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
if (!DeviceObject || !RequestedNewState)
|
if (!DeviceObject || !RequestedNewState)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||||
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
|
||||||
|
|
||||||
PowerState.DeviceState = RequestedNewState;
|
PowerState.DeviceState = RequestedNewState;
|
||||||
|
|
|
@ -131,7 +131,7 @@ typedef struct
|
||||||
LIST_ENTRY SubDeviceList;
|
LIST_ENTRY SubDeviceList;
|
||||||
LIST_ENTRY PhysicalConnectionList;
|
LIST_ENTRY PhysicalConnectionList;
|
||||||
|
|
||||||
} PCExtension;
|
} PCLASS_DEVICE_EXTENSION, *PPCLASS_DEVICE_EXTENSION;
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
|
|
@ -239,7 +239,7 @@ PcNewRegistryKey(
|
||||||
HANDLE hHandle;
|
HANDLE hHandle;
|
||||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||||
IRegistryKeyImpl * This;
|
IRegistryKeyImpl * This;
|
||||||
PCExtension* portcls_ext;
|
PPCLASS_DEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
DPRINT1("PcNewRegistryKey entered\n");
|
DPRINT1("PcNewRegistryKey entered\n");
|
||||||
|
|
||||||
|
@ -279,9 +279,9 @@ PcNewRegistryKey(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* obtain the new device extension */
|
/* obtain the new device extension */
|
||||||
portcls_ext = (PCExtension*) ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
|
DeviceExt = (PPCLASS_DEVICE_EXTENSION) ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
|
||||||
|
|
||||||
Status = IoOpenDeviceRegistryKey(portcls_ext->PhysicalDeviceObject, RegistryKeyType, DesiredAccess, &hHandle);
|
Status = IoOpenDeviceRegistryKey(DeviceExt->PhysicalDeviceObject, RegistryKeyType, DesiredAccess, &hHandle);
|
||||||
}
|
}
|
||||||
else if (RegistryKeyType == DeviceInterfaceRegistryKey)
|
else if (RegistryKeyType == DeviceInterfaceRegistryKey)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue