From ff1e60162fd216160798ef439671212e27d3b76d Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Wed, 17 Dec 2008 16:01:32 +0000 Subject: [PATCH] - Handle PcNewRegistryKey for DeviceRegistryKey, DriverRegistryKey, HwProfileRegistryKey - Implement IPortClsVersion interface svn path=/trunk/; revision=38156 --- .../wdm/audio/backpln/portcls/portcls.rbuild | 1 + .../wdm/audio/backpln/portcls/registry.c | 16 ++++ .../wdm/audio/backpln/portcls/version.c | 96 +++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 reactos/drivers/wdm/audio/backpln/portcls/version.c diff --git a/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild b/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild index b15f9ed89fe..24c458da344 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild +++ b/reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild @@ -33,5 +33,6 @@ miniport.c miniport_dmus.c miniport_fmsynth.c + version.c portcls.rc diff --git a/reactos/drivers/wdm/audio/backpln/portcls/registry.c b/reactos/drivers/wdm/audio/backpln/portcls/registry.c index 722860153ca..3cb7342dd27 100644 --- a/reactos/drivers/wdm/audio/backpln/portcls/registry.c +++ b/reactos/drivers/wdm/audio/backpln/portcls/registry.c @@ -253,6 +253,22 @@ PcNewRegistryKey( Status = ZwOpenKey(&hHandle, DesiredAccess, ObjectAttributes); } + else if (RegistryKeyType == DeviceRegistryKey || + RegistryKeyType == DriverRegistryKey || + RegistryKeyType == HwProfileRegistryKey) + { + if (RegistryKeyType == HwProfileRegistryKey) + { + /* IoOpenDeviceRegistryKey used different constant */ + RegistryKeyType = PLUGPLAY_REGKEY_CURRENT_HWPROFILE; + } + + Status = IoOpenDeviceRegistryKey(DeviceObject, RegistryKeyType, DesiredAccess, &hHandle); + } + else if (RegistryKeyType == DeviceInterfaceRegistryKey) + { + /* FIXME */ + } if (!NT_SUCCESS(Status)) { diff --git a/reactos/drivers/wdm/audio/backpln/portcls/version.c b/reactos/drivers/wdm/audio/backpln/portcls/version.c new file mode 100644 index 00000000000..92ea1a9a740 --- /dev/null +++ b/reactos/drivers/wdm/audio/backpln/portcls/version.c @@ -0,0 +1,96 @@ +#include "private.h" + + +typedef struct CResourceList +{ + IPortClsVersionVtbl *lpVtbl; + LONG ref; +}IPortClsVersionImpl; + +const GUID IID_IPortClsVersion; + +//--------------------------------------------------------------- +// IPortClsVersion interface functions +// + +NTSTATUS +NTAPI +IPortClsVersion_fnQueryInterface( + IPortClsVersion * iface, + IN REFIID refiid, + OUT PVOID* Output) +{ + IPortClsVersionImpl * This = (IPortClsVersionImpl*)iface; + + if (IsEqualGUIDAligned(refiid, &IID_IPortClsVersion) || + IsEqualGUIDAligned(refiid, &IID_IUnknown)) + { + *Output = &This->lpVtbl; + _InterlockedIncrement(&This->ref); + return STATUS_SUCCESS; + } + return STATUS_UNSUCCESSFUL; +} + +ULONG +NTAPI +IPortClsVersion_fnAddRef( + IPortClsVersion * iface) +{ + IPortClsVersionImpl * This = (IPortClsVersionImpl*)iface; + + return InterlockedIncrement(&This->ref); +} + +ULONG +NTAPI +IPortClsVersion_fnRelease( + IPortClsVersion * iface) +{ + IPortClsVersionImpl * This = (IPortClsVersionImpl*)iface; + + InterlockedDecrement(&This->ref); + + if (This->ref == 0) + { + ExFreePoolWithTag(This, TAG_PORTCLASS); + return 0; + } + /* Return new reference count */ + return This->ref; +} + +DWORD +NTAPI +IPortClsVersion_fnGetVersion( + IPortClsVersion * iface) +{ + return kVersionWinXP_UAAQFE; +} + +static IPortClsVersionVtbl vt_PortClsVersion = +{ + /* IUnknown methods */ + IPortClsVersion_fnQueryInterface, + IPortClsVersion_fnAddRef, + IPortClsVersion_fnRelease, + IPortClsVersion_fnGetVersion +}; + +NTSTATUS NewPortClsVersion( + OUT PPORTCLSVERSION * OutVersion) +{ + IPortClsVersionImpl * This = ExAllocatePoolWithTag(NonPagedPool, sizeof(IPortClsVersionImpl), TAG_PORTCLASS); + + if (!This) + return STATUS_INSUFFICIENT_RESOURCES; + + This->lpVtbl = &vt_PortClsVersion; + This->ref = 1; + *OutVersion = (PPORTCLSVERSION)&This->lpVtbl; + + return STATUS_SUCCESS; + +} + +