Author: janderwald
Date: Tue Jan 27 06:43:33 2009
New Revision: 39132
URL:
http://svn.reactos.org/svn/reactos?rev=39132&view=rev
Log:
- Rename device context struct
- patch by Chris
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/adapter.c [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -102,7 +102,7 @@
NTSTATUS status = STATUS_UNSUCCESSFUL;
PDEVICE_OBJECT fdo = NULL;
PDEVICE_OBJECT PrevDeviceObject;
- PCExtension* portcls_ext;
+ PPCLASS_DEVICE_EXTENSION portcls_ext;
DPRINT1("PcAddAdapterDevice called\n");
@@ -140,7 +140,7 @@
}
/* Obtain the new device extension */
- portcls_ext = (PCExtension*) fdo->DeviceExtension;
+ portcls_ext = (PPCLASS_DEVICE_EXTENSION) fdo->DeviceExtension;
/* initialize the device extension */
RtlZeroMemory(portcls_ext, DeviceExtensionSize);
/* allocate create item */
@@ -208,14 +208,14 @@
NTSTATUS Status;
ISubdevice * SubDevice;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
SUBDEVICE_ENTRY * Entry;
KSDISPATCH_TABLE DispatchTable;
DPRINT1("PortClsSysControl called\n");
SubDevice = (ISubdevice*)Irp->Tail.Overlay.DriverContext[3];
- DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (!SubDevice || !DeviceExt)
{
@@ -257,7 +257,7 @@
IN PWCHAR Name,
IN PUNKNOWN Unknown)
{
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
ISubdevice *SubDevice;
UNICODE_STRING SymbolicLinkName;
@@ -272,7 +272,7 @@
return STATUS_INVALID_PARAMETER;
}
- DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
if (!DeviceExt)
return STATUS_UNSUCCESSFUL;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/connection.c [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -25,9 +25,9 @@
UNICODE_STRING ToUnicodeString = {0, 0, 0};
ISubdevice * FromSubDevice = NULL;
ISubdevice * ToSubDevice = NULL;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
- DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
NTSTATUS Status = STATUS_SUCCESS;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -486,7 +486,7 @@
ULONG MapRegisters;
INTERFACE_TYPE BusType;
ULONG ResultLength;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
IDmaChannelSlaveImpl * This;
@@ -499,7 +499,7 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
- DeviceExt = (PCExtension*) DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
Status = IoGetDeviceProperty(DeviceObject, DevicePropertyLegacyBusType,
sizeof(BusType), (PVOID)&BusType, &ResultLength);
if (NT_SUCCESS(Status))
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irp.c [iso-8859-1] Tue Jan 27 06:43:33
2009
@@ -51,7 +51,7 @@
/* TODO */
- Irp->IoStatus.Status = STATUS_SUCCESS;
+ Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
@@ -69,94 +69,89 @@
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
- NTSTATUS status;
- PCExtension* portcls_ext;
- PIO_STACK_LOCATION irp_stack;
+ NTSTATUS Status;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
+ PIO_STACK_LOCATION IoStack;
+ IResourceList* resource_list = NULL;
DPRINT1("PortClsPnp called\n");
- portcls_ext = (PCExtension*) DeviceObject->DeviceExtension;
- irp_stack = IoGetCurrentIrpStackLocation(Irp);
-
- ASSERT(portcls_ext);
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ ASSERT(DeviceExt);
/*
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
routine.
*/
- if ( irp_stack->MinorFunction == IRP_MN_START_DEVICE )
+ switch (IoStack->MinorFunction)
{
- IResourceList* resource_list;
- DPRINT("IRP_MN_START_DEVICE\n");
-
- /* Create the resource list */
- status = PcNewResourceList(
- &resource_list,
- NULL,
- PagedPool,
- irp_stack->Parameters.StartDevice.AllocatedResourcesTranslated,
- irp_stack->Parameters.StartDevice.AllocatedResources);
-
- if ( ! NT_SUCCESS(status) )
- {
- DPRINT("PcNewResourceList failed [0x%8x]\n", status);
- Irp->IoStatus.Status = status;
+ case IRP_MN_START_DEVICE:
+ DPRINT("IRP_MN_START_DEVICE\n");
+
+ /* Create the resource list */
+ Status = PcNewResourceList(
+ &resource_list,
+ NULL,
+ PagedPool,
+ IoStack->Parameters.StartDevice.AllocatedResourcesTranslated,
+ IoStack->Parameters.StartDevice.AllocatedResources);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("PcNewResourceList failed [0x%8x]\n", Status);
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return Status;
+ }
+
+ /* Assign the resource list to our extension */
+ DeviceExt->resources = resource_list;
+
+ ASSERT(DeviceExt->StartDevice);
+
+ /* Call the StartDevice routine */
+ DPRINT("Calling StartDevice at 0x%8p\n",
DeviceExt->StartDevice);
+ Status = DeviceExt->StartDevice(DeviceObject, Irp, resource_list);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("StartDevice returned a failure code [0x%8x]\n",
Status);
+ //resource_list->lpVtbl->Release(resource_list);
+
+ Irp->IoStatus.Status = Status;
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+ return Status;
+ }
+
+ Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return status;
- }
-
- /* Assign the resource list to our extension */
- portcls_ext->resources = resource_list;
-
- ASSERT(portcls_ext->StartDevice);
-
- /* Call the StartDevice routine */
- DPRINT("Calling StartDevice at 0x%8p\n", portcls_ext->StartDevice);
- status = portcls_ext->StartDevice(DeviceObject, Irp, resource_list);
-
- if ( ! NT_SUCCESS(status) )
- {
- DPRINT("StartDevice returned a failure code [0x%8x]\n", status);
- //resource_list->lpVtbl->Release(resource_list);
-
- Irp->IoStatus.Status = status;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
-
- return status;
- }
-
- Irp->IoStatus.Status = STATUS_SUCCESS;
- IoCompleteRequest(Irp, IO_NO_INCREMENT);
- return status;
+ return Status;
+
+ case IRP_MN_REMOVE_DEVICE:
+ /* Clean up */
+ DPRINT("IRP_MN_REMOVE_DEVICE\n");
+
+ DeviceExt->resources->lpVtbl->Release(DeviceExt->resources);
+ IoDeleteDevice(DeviceObject);
+
+ /* Do not complete? */
+ Irp->IoStatus.Status = STATUS_SUCCESS;
+ return STATUS_SUCCESS;
+
+ case IRP_MN_QUERY_INTERFACE:
+ DPRINT1("FIXME: IRP_MN_QUERY_INTERFACE: call next lower device
object\n");
+ /* FIXME
+ * call next lower device object */
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ return Irp->IoStatus.Status;
+
+ case IRP_MN_QUERY_DEVICE_RELATIONS:
+ Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
+ return Irp->IoStatus.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);
-
- IoDeleteDevice(DeviceObject);
-
- /* Do not complete? */
- Irp->IoStatus.Status = STATUS_SUCCESS;
- return STATUS_SUCCESS;
- }
- else if ( irp_stack->MinorFunction == IRP_MN_QUERY_INTERFACE )
- {
- //FIXME
- // call next lower device object
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- return Irp->IoStatus.Status;
- }
- else if ( irp_stack->MinorFunction == IRP_MN_QUERY_DEVICE_RELATIONS)
- {
- Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
- return Irp->IoStatus.Status;
- }
-
- DPRINT1("unhandled function %u\n", irp_stack->MinorFunction);
+
+ DPRINT1("unhandled function %u\n", IoStack->MinorFunction);
return STATUS_SUCCESS;
}
@@ -218,13 +213,13 @@
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
- PIO_STACK_LOCATION irp_stack;
+ PIO_STACK_LOCATION IoStack;
DPRINT1("PcDispatchIrp called - handling IRP in PortCls\n");
- irp_stack = IoGetCurrentIrpStackLocation(Irp);
-
- switch ( irp_stack->MajorFunction )
+ IoStack = IoGetCurrentIrpStackLocation(Irp);
+
+ switch ( IoStack->MajorFunction )
{
/* PortCls */
case IRP_MJ_CREATE :
@@ -298,12 +293,12 @@
IN PIRP Irp)
{
KEVENT Event;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
NTSTATUS Status;
DPRINT1("PcForwardIrpSynchronous\n");
- DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
return STATUS_SUCCESS;
/* initialize the notification event */
KeInitializeEvent(&Event, NotificationEvent, FALSE);
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/power.c [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -14,7 +14,7 @@
{
NTSTATUS Status;
PDEVICE_OBJECT pDeviceObject;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
IAdapterPowerManagement * pPower;
DPRINT1("PcRegisterAdapterPowerManagement pUnknown %p pvContext %p\n",
pUnknown, pvContext);
@@ -24,7 +24,7 @@
pDeviceObject = (PDEVICE_OBJECT)pvContext;
- DeviceExt = (PCExtension*)pDeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)pDeviceObject->DeviceExtension;
Status = pUnknown->lpVtbl->QueryInterface(pUnknown,
&IID_IAdapterPowerManagement, (PVOID*)&pPower);
if (!NT_SUCCESS(Status))
@@ -64,12 +64,12 @@
KEVENT Event;
NTSTATUS Status;
POWER_STATE PowerState;
- PCExtension* DeviceExt;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
if (!DeviceObject || !RequestedNewState)
return STATUS_INVALID_PARAMETER;
- DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
KeInitializeEvent(&Event, SynchronizationEvent, FALSE);
PowerState.DeviceState = RequestedNewState;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/private.h [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -131,7 +131,7 @@
LIST_ENTRY SubDeviceList;
LIST_ENTRY PhysicalConnectionList;
-} PCExtension;
+} PCLASS_DEVICE_EXTENSION, *PPCLASS_DEVICE_EXTENSION;
NTSTATUS
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/registry.c [iso-8859-1] Tue Jan 27
06:43:33 2009
@@ -239,7 +239,7 @@
HANDLE hHandle;
NTSTATUS Status = STATUS_UNSUCCESSFUL;
IRegistryKeyImpl * This;
- PCExtension* portcls_ext;
+ PPCLASS_DEVICE_EXTENSION DeviceExt;
DPRINT1("PcNewRegistryKey entered\n");
@@ -279,9 +279,9 @@
}
/* obtain the new device extension */
- portcls_ext = (PCExtension*) ((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
-
- Status = IoOpenDeviceRegistryKey(portcls_ext->PhysicalDeviceObject,
RegistryKeyType, DesiredAccess, &hHandle);
+ DeviceExt = (PPCLASS_DEVICE_EXTENSION)
((PDEVICE_OBJECT)DeviceObject)->DeviceExtension;
+
+ Status = IoOpenDeviceRegistryKey(DeviceExt->PhysicalDeviceObject,
RegistryKeyType, DesiredAccess, &hHandle);
}
else if (RegistryKeyType == DeviceInterfaceRegistryKey)
{