mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:26:02 +00:00
[UMPNPMGR] PNP_AddEmptyLogConf: Implement adding a resource list to an existing configuration value
This commit is contained in:
parent
79f281e74f
commit
00983aa86f
1 changed files with 80 additions and 9 deletions
|
@ -575,6 +575,41 @@ GetConfigurationData(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
PCM_FULL_RESOURCE_DESCRIPTOR
|
||||||
|
NextResourceDescriptor(
|
||||||
|
_In_ PCM_FULL_RESOURCE_DESCRIPTOR pDescriptor)
|
||||||
|
{
|
||||||
|
PBYTE pNext = NULL;
|
||||||
|
ULONG ulLastIndex = 0;
|
||||||
|
|
||||||
|
if (pDescriptor == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Skip the full resource descriptor */
|
||||||
|
pNext = (LPBYTE)pDescriptor + sizeof(CM_FULL_RESOURCE_DESCRIPTOR);
|
||||||
|
|
||||||
|
/* Skip the partial resource descriptors */
|
||||||
|
pNext += (pDescriptor->PartialResourceList.Count - 1) *
|
||||||
|
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
|
|
||||||
|
/* Skip the device specific data, if present */
|
||||||
|
if (pDescriptor->PartialResourceList.Count > 0)
|
||||||
|
{
|
||||||
|
ulLastIndex = pDescriptor->PartialResourceList.Count - 1;
|
||||||
|
|
||||||
|
if (pDescriptor->PartialResourceList.PartialDescriptors[ulLastIndex].Type ==
|
||||||
|
CmResourceTypeDeviceSpecific)
|
||||||
|
{
|
||||||
|
pNext += pDescriptor->PartialResourceList.PartialDescriptors[ulLastIndex].
|
||||||
|
u.DeviceSpecificData.DataSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (PCM_FULL_RESOURCE_DESCRIPTOR)pNext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOL
|
BOOL
|
||||||
IsCallerInteractive(
|
IsCallerInteractive(
|
||||||
|
@ -4177,8 +4212,8 @@ PNP_AddEmptyLogConf(
|
||||||
{
|
{
|
||||||
HKEY hConfigKey = NULL;
|
HKEY hConfigKey = NULL;
|
||||||
DWORD RegDataType = 0;
|
DWORD RegDataType = 0;
|
||||||
ULONG ulDataSize = 0;
|
ULONG ulDataSize = 0, ulNewSize = 0;
|
||||||
LPBYTE pDataBuffer = NULL;
|
PBYTE pDataBuffer = NULL;
|
||||||
WCHAR szValueNameBuffer[LOGCONF_NAME_BUFFER_SIZE];
|
WCHAR szValueNameBuffer[LOGCONF_NAME_BUFFER_SIZE];
|
||||||
CONFIGRET ret = CR_SUCCESS;
|
CONFIGRET ret = CR_SUCCESS;
|
||||||
|
|
||||||
|
@ -4221,7 +4256,9 @@ PNP_AddEmptyLogConf(
|
||||||
if (RegDataType == REG_RESOURCE_LIST)
|
if (RegDataType == REG_RESOURCE_LIST)
|
||||||
{
|
{
|
||||||
PCM_RESOURCE_LIST pResourceList = NULL;
|
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||||
|
PCM_FULL_RESOURCE_DESCRIPTOR pResource = NULL;
|
||||||
|
|
||||||
|
/* Allocate a buffer for the new configuration */
|
||||||
ulDataSize = sizeof(CM_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
ulDataSize = sizeof(CM_RESOURCE_LIST) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
pDataBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulDataSize);
|
pDataBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulDataSize);
|
||||||
if (pDataBuffer == NULL)
|
if (pDataBuffer == NULL)
|
||||||
|
@ -4232,11 +4269,13 @@ PNP_AddEmptyLogConf(
|
||||||
|
|
||||||
pResourceList = (PCM_RESOURCE_LIST)pDataBuffer;
|
pResourceList = (PCM_RESOURCE_LIST)pDataBuffer;
|
||||||
pResourceList->Count = 1;
|
pResourceList->Count = 1;
|
||||||
pResourceList->List[0].InterfaceType = InterfaceTypeUndefined;
|
|
||||||
pResourceList->List[0].BusNumber = 0;
|
pResource = (PCM_FULL_RESOURCE_DESCRIPTOR)&pResourceList->List[0];
|
||||||
pResourceList->List[0].PartialResourceList.Version = 1;
|
pResource->InterfaceType = InterfaceTypeUndefined;
|
||||||
pResourceList->List[0].PartialResourceList.Revision = 1;
|
pResource->BusNumber = 0;
|
||||||
pResourceList->List[0].PartialResourceList.Count = 0;
|
pResource->PartialResourceList.Version = 1;
|
||||||
|
pResource->PartialResourceList.Revision = 1;
|
||||||
|
pResource->PartialResourceList.Count = 0;
|
||||||
}
|
}
|
||||||
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
|
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
|
||||||
{
|
{
|
||||||
|
@ -4277,7 +4316,38 @@ PNP_AddEmptyLogConf(
|
||||||
{
|
{
|
||||||
if (RegDataType == REG_RESOURCE_LIST)
|
if (RegDataType == REG_RESOURCE_LIST)
|
||||||
{
|
{
|
||||||
/* FIXME */
|
PCM_RESOURCE_LIST pResourceList = NULL;
|
||||||
|
PCM_FULL_RESOURCE_DESCRIPTOR pResource = NULL;
|
||||||
|
ULONG ulIndex;
|
||||||
|
|
||||||
|
/* Reallocate a larger buffer in order to add the new configuration */
|
||||||
|
ulNewSize = sizeof(CM_FULL_RESOURCE_DESCRIPTOR) - sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
|
||||||
|
pDataBuffer = HeapReAlloc(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
pDataBuffer,
|
||||||
|
ulDataSize + ulNewSize);
|
||||||
|
if (pDataBuffer == NULL)
|
||||||
|
{
|
||||||
|
ret = CR_OUT_OF_MEMORY;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
pResourceList = (PCM_RESOURCE_LIST)pDataBuffer;
|
||||||
|
|
||||||
|
/* Get a pointer to the new (uninitialized) resource descriptor */
|
||||||
|
pResource = (PCM_FULL_RESOURCE_DESCRIPTOR)&pResourceList->List[0];
|
||||||
|
for (ulIndex = 0; ulIndex < pResourceList->Count; ulIndex++)
|
||||||
|
pResource = NextResourceDescriptor(pResource);
|
||||||
|
|
||||||
|
/* Initialize the new resource descriptor */
|
||||||
|
pResourceList->Count++;
|
||||||
|
pResource->InterfaceType= InterfaceTypeUndefined;
|
||||||
|
pResource->BusNumber = 0;
|
||||||
|
pResource->PartialResourceList.Version = 1;
|
||||||
|
pResource->PartialResourceList.Revision = 1;
|
||||||
|
pResource->PartialResourceList.Count = 0;
|
||||||
|
|
||||||
|
*pulLogConfTag = ulIndex;
|
||||||
}
|
}
|
||||||
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
|
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
|
||||||
{
|
{
|
||||||
|
@ -4290,12 +4360,13 @@ PNP_AddEmptyLogConf(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store the configuration */
|
||||||
if (RegSetValueEx(hConfigKey,
|
if (RegSetValueEx(hConfigKey,
|
||||||
szValueNameBuffer,
|
szValueNameBuffer,
|
||||||
0,
|
0,
|
||||||
RegDataType,
|
RegDataType,
|
||||||
pDataBuffer,
|
pDataBuffer,
|
||||||
ulDataSize) != ERROR_SUCCESS)
|
ulDataSize + ulNewSize) != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ret = CR_REGISTRY_ERROR;
|
ret = CR_REGISTRY_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue