Skip to content

Commit f1332c7

Browse files
committed
[UMPNPMGR] Implement PNP_RegisterDeviceClassAssociation
1 parent 4164b8a commit f1332c7

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

base/services/umpnpmgr/rpcserver.c

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,8 +2788,50 @@ PNP_RegisterDeviceClassAssociation(
27882788
PNP_RPC_STRING_LEN *pulTransferLen,
27892789
DWORD ulFlags)
27902790
{
2791-
UNIMPLEMENTED;
2792-
return CR_CALL_NOT_IMPLEMENTED;
2791+
PLUGPLAY_CONTROL_CLASS_ASSOCIATION_DATA PlugPlayData;
2792+
NTSTATUS Status;
2793+
CONFIGRET ret = CR_SUCCESS;
2794+
2795+
UNREFERENCED_PARAMETER(hBinding);
2796+
2797+
DPRINT1("PNP_RegisterDeviceClassAssociation(%p %S %p %S %S %p %p 0x%08lx)\n",
2798+
hBinding, pszDeviceID, InterfaceGuid, pszReference, pszSymLink,
2799+
pulLength, pulTransferLen, ulFlags);
2800+
2801+
if ((InterfaceGuid == NULL) ||
2802+
(pszSymLink == NULL) ||
2803+
(pulLength == NULL) ||
2804+
(pulTransferLen == NULL))
2805+
return CR_INVALID_POINTER;
2806+
2807+
if (ulFlags != 0)
2808+
return CR_INVALID_FLAG;
2809+
2810+
if (!IsValidDeviceInstanceID(pszDeviceID))
2811+
return CR_INVALID_DEVINST;
2812+
2813+
RtlInitUnicodeString(&PlugPlayData.DeviceInstance, pszDeviceID);
2814+
PlugPlayData.InterfaceGuid = InterfaceGuid;
2815+
RtlInitUnicodeString(&PlugPlayData.Reference, pszReference);
2816+
PlugPlayData.Register = TRUE;
2817+
PlugPlayData.SymbolicLinkName = pszSymLink;
2818+
PlugPlayData.SymbolicLinkNameLength = *pulLength;
2819+
2820+
Status = NtPlugPlayControl(PlugPlayControlDeviceClassAssociation,
2821+
&PlugPlayData,
2822+
sizeof(PLUGPLAY_CONTROL_CLASS_ASSOCIATION_DATA));
2823+
if (NT_SUCCESS(Status))
2824+
{
2825+
*pulLength = PlugPlayData.SymbolicLinkNameLength;
2826+
*pulTransferLen = *pulLength;
2827+
}
2828+
else
2829+
{
2830+
*pulLength = 0;
2831+
ret = NtStatusToCrError(Status);
2832+
}
2833+
2834+
return ret;
27932835
}
27942836

27952837

0 commit comments

Comments
 (0)