mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
- Use FILE_DEVICE_KS when creating new device object
- Partly implement PcNewRegistryKey, PcRegisterSubdevice - DPC event is a Synchronization event- Implement PcRegisterAdapterPowerManagement svn path=/trunk/; revision=38011
This commit is contained in:
parent
ce51a7b299
commit
d56dde4a07
7 changed files with 154 additions and 35 deletions
|
@ -144,7 +144,7 @@ PcAddAdapterDevice(
|
|||
status = IoCreateDevice(DriverObject,
|
||||
DeviceExtensionSize,
|
||||
NULL,
|
||||
PhysicalDeviceObject->DeviceType, /* FILE_DEVICE_KS ? */
|
||||
FILE_DEVICE_KS,
|
||||
PhysicalDeviceObject->Characteristics, /* TODO: Check */
|
||||
FALSE,
|
||||
&fdo);
|
||||
|
@ -161,9 +161,56 @@ PcAddAdapterDevice(
|
|||
ASSERT(portcls_ext);
|
||||
|
||||
/* Initialize */
|
||||
RtlZeroMemory(portcls_ext, sizeof(PCExtension));
|
||||
portcls_ext->StartDevice = StartDevice;
|
||||
|
||||
status = KsAllocateDeviceHeader(&portcls_ext->KsDeviceHeader, 0, NULL);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
IoDeleteDevice(fdo);
|
||||
return status;
|
||||
}
|
||||
|
||||
DPRINT("PcAddAdapterDriver succeeded\n");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PciDriverDispatch(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp)
|
||||
{
|
||||
DPRINT1("PortClsSysControl called\n");
|
||||
|
||||
/* TODO */
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS NTAPI
|
||||
PcRegisterSubdevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PWCHAR Name,
|
||||
IN PUNKNOWN Unknown)
|
||||
{
|
||||
PCExtension* DeviceExt;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (!DeviceObject || !Name || !Unknown)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
DeviceExt = (PCExtension*)DeviceObject->DeviceExtension;
|
||||
if (!DeviceExt)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
|
||||
Status = KsAddObjectCreateItemToDeviceHeader(DeviceExt->KsDeviceHeader, PciDriverDispatch, (PVOID)Unknown, Name, NULL);
|
||||
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
<file>registry.c</file>
|
||||
<file>service_group.c</file>
|
||||
<file>port.c</file>
|
||||
<file>power.c</file>
|
||||
<file>port_dmus.c</file>
|
||||
<file>port_midi.c</file>
|
||||
<file>port_topology.c</file>
|
||||
|
|
38
reactos/drivers/wdm/audio/backpln/portcls/power.c
Normal file
38
reactos/drivers/wdm/audio/backpln/portcls/power.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include "private.h"
|
||||
|
||||
const GUID IID_IAdapterPowerManagement;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
PcRegisterAdapterPowerManagement(
|
||||
IN PUNKNOWN pUnknown,
|
||||
IN PVOID pvContext)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PDEVICE_OBJECT pDeviceObject;
|
||||
PCExtension* DeviceExt;
|
||||
IAdapterPowerManagement * pPower;
|
||||
|
||||
if (!pUnknown || !pvContext)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
Status = pUnknown->lpVtbl->QueryInterface(pUnknown, &IID_IAdapterPowerManagement, (PVOID*)&pPower);
|
||||
if (!NT_SUCCESS(Status))
|
||||
return Status;
|
||||
|
||||
pDeviceObject = (PDEVICE_OBJECT)pvContext;
|
||||
DeviceExt = (PCExtension*)pDeviceObject->DeviceExtension;
|
||||
|
||||
if (DeviceExt->AdapterPowerManagement)
|
||||
{
|
||||
pPower->lpVtbl->Release(pPower);
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
DeviceExt->AdapterPowerManagement = pPower;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
|
@ -69,9 +69,17 @@ NTSTATUS NewPortWaveCyclic(
|
|||
NTSTATUS NewPortWavePci(
|
||||
OUT PPORT* OutPort);
|
||||
|
||||
NTSTATUS NewDmaChannelSlave(
|
||||
IN PDEVICE_DESCRIPTION DeviceDesc,
|
||||
IN PDMA_ADAPTER Adapter,
|
||||
OUT PDMACHANNELSLAVE* DmaChannel);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PCPFNSTARTDEVICE StartDevice;
|
||||
KSDEVICE_HEADER KsDeviceHeader;
|
||||
IAdapterPowerManagement * AdapterPowerManagement;
|
||||
|
||||
IResourceList* resources;
|
||||
} PCExtension;
|
||||
|
|
|
@ -198,6 +198,22 @@ IRegistryKey_fnSetValueKey(
|
|||
return ZwSetValueKey(This->hKey, ValueName, 0, Type, Data, DataSize);
|
||||
}
|
||||
|
||||
static IRegistryKeyVtbl vt_IRegistryKey =
|
||||
{
|
||||
/* IUnknown methods */
|
||||
IRegistryKey_fnQueryInterface,
|
||||
IRegistryKey_fnAddRef,
|
||||
IRegistryKey_fnRelease,
|
||||
/* IRegistryKey methods */
|
||||
IRegistryKey_fnQueryKey,
|
||||
IRegistryKey_fnEnumerateKey,
|
||||
IRegistryKey_fnQueryValueKey,
|
||||
IRegistryKey_fnEnumerateKeyValue,
|
||||
IRegistryKey_fnSetValueKey,
|
||||
IRegistryKey_fnQueryRegistryValues,
|
||||
IRegistryKey_fnNewSubKey,
|
||||
IRegistryKey_fnDeleteKey
|
||||
};
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
|
@ -214,9 +230,47 @@ PcNewRegistryKey(
|
|||
IN ULONG CreateOptions OPTIONAL,
|
||||
OUT PULONG Disposition OPTIONAL)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
//IoGetDeviceProperty
|
||||
HANDLE hHandle;
|
||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||
IRegistryKeyImpl * This;
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
if (!OutRegistryKey)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
if (RegistryKeyType != GeneralRegistryKey &&
|
||||
RegistryKeyType != DeviceRegistryKey &&
|
||||
RegistryKeyType != DriverRegistryKey &&
|
||||
RegistryKeyType != HwProfileRegistryKey &&
|
||||
RegistryKeyType != DeviceInterfaceRegistryKey)
|
||||
{
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (RegistryKeyType == GeneralRegistryKey)
|
||||
{
|
||||
if (!ObjectAttributes)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
|
||||
Status = ZwOpenKey(&hHandle, DesiredAccess, ObjectAttributes);
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
|
||||
This = ExAllocatePoolWithTag(NonPagedPool, sizeof(IRegistryKeyImpl), TAG_PORTCLASS);
|
||||
if (!This)
|
||||
{
|
||||
ZwClose(hHandle);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
This->hKey = hHandle;
|
||||
This->lpVtbl = &vt_IRegistryKey;
|
||||
This->ref = 1;
|
||||
|
||||
*OutRegistryKey = (PREGISTRYKEY)&This->lpVtbl;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ IServiceGroup_fnSupportDelayedService(
|
|||
|
||||
if (!This->Initialized)
|
||||
{
|
||||
KeInitializeEvent(&This->DpcEvent, NotificationEvent, FALSE);
|
||||
KeInitializeEvent(&This->DpcEvent, SynchronizationEvent, FALSE);
|
||||
KeInitializeTimerEx(&This->Timer, NotificationTimer);
|
||||
KeInitializeDpc(&This->Dpc, IServiceGroupDpc, (PVOID)This);
|
||||
This->Initialized = TRUE;
|
||||
|
@ -263,8 +263,5 @@ PcNewServiceGroup(
|
|||
This->Initialized = FALSE;
|
||||
*OutServiceGroup = (PSERVICEGROUP)&This->lpVtbl;
|
||||
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -32,18 +32,6 @@ PcNewDmaChannel(
|
|||
Power Management
|
||||
*/
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
PcRegisterAdapterPowerManagement(
|
||||
IN PUNKNOWN pUnknown,
|
||||
IN PVOID pvContext1)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -130,17 +118,3 @@ PcRegisterPhysicalConnectionToExternal(
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
NTSTATUS NTAPI
|
||||
PcRegisterSubdevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PWCHAR Name,
|
||||
IN PUNKNOWN Unknown)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue