Skip to content

Commit 71b6fab

Browse files
committed
[UMPNPMGR] PNP_AddEmptyLogConf: Add resource list to an existing requirements list
1 parent bc64f3a commit 71b6fab

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

base/services/umpnpmgr/rpcserver.c

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,26 @@ NextResourceDescriptor(
613613
}
614614

615615

616+
static
617+
PIO_RESOURCE_LIST
618+
NextResourceRequirement(
619+
_In_ PIO_RESOURCE_LIST pResourceList)
620+
{
621+
LPBYTE pNext = NULL;
622+
623+
if (pResourceList == NULL)
624+
return NULL;
625+
626+
/* Skip the resource list */
627+
pNext = (LPBYTE)pResourceList + sizeof(IO_RESOURCE_LIST);
628+
629+
/* Skip the resource descriptors */
630+
pNext += (pResourceList->Count - 1) * sizeof(IO_RESOURCE_DESCRIPTOR);
631+
632+
return (PIO_RESOURCE_LIST)pNext;
633+
}
634+
635+
616636
static
617637
BOOL
618638
IsCallerInteractive(
@@ -4458,7 +4478,39 @@ PNP_AddEmptyLogConf(
44584478
}
44594479
else if (RegDataType == REG_RESOURCE_REQUIREMENTS_LIST)
44604480
{
4461-
/* FIXME */
4481+
PIO_RESOURCE_REQUIREMENTS_LIST pRequirementsList = NULL;
4482+
PIO_RESOURCE_LIST pResourceList = NULL;
4483+
ULONG ulIndex;
4484+
4485+
/* Reallocate a larger buffer in order to add the new configuration */
4486+
ulNewSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST);
4487+
pDataBuffer = HeapReAlloc(GetProcessHeap(),
4488+
0,
4489+
pDataBuffer,
4490+
ulDataSize + ulNewSize);
4491+
if (pDataBuffer == NULL)
4492+
{
4493+
ret = CR_OUT_OF_MEMORY;
4494+
goto done;
4495+
}
4496+
4497+
pRequirementsList = (PIO_RESOURCE_REQUIREMENTS_LIST)pDataBuffer;
4498+
pResourceList = (PIO_RESOURCE_LIST)&pRequirementsList->List[0];
4499+
for (ulIndex = 0; ulIndex < pRequirementsList->AlternativeLists - 1; ulIndex++)
4500+
pResourceList = NextResourceRequirement(pResourceList);
4501+
4502+
pRequirementsList->ListSize = ulDataSize + ulNewSize;
4503+
pRequirementsList->AlternativeLists++;
4504+
4505+
pResourceList->Version = 1;
4506+
pResourceList->Revision = 1;
4507+
pResourceList->Count = 1;
4508+
4509+
pResourceList->Descriptors[0].Option = IO_RESOURCE_PREFERRED;
4510+
pResourceList->Descriptors[0].Type = CmResourceTypeConfigData;
4511+
pResourceList->Descriptors[0].u.ConfigData.Priority = ulPriority;
4512+
4513+
*pulLogConfTag = ulIndex;
44624514
}
44634515
else
44644516
{

0 commit comments

Comments
 (0)