- Handle PcNewRegistryKey for DeviceRegistryKey, DriverRegistryKey, HwProfileRegistryKey

- Implement IPortClsVersion interface

svn path=/trunk/; revision=38156
This commit is contained in:
Johannes Anderwald 2008-12-17 16:01:32 +00:00
parent d48a47ec8a
commit ff1e60162f
3 changed files with 113 additions and 0 deletions

View file

@ -33,5 +33,6 @@
<file>miniport.c</file>
<file>miniport_dmus.c</file>
<file>miniport_fmsynth.c</file>
<file>version.c</file>
<file>portcls.rc</file>
</module>

View file

@ -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))
{

View file

@ -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;
}