CmGetDeviceContainerIdFromBase
NTSTATUS __stdcall CmGetDeviceContainerIdFromBase(
HPNPCTX *hPnpCtx,
const WCHAR *DeviceInstanceId,
const WCHAR *BaseContainerId,
WCHAR *ContainerId,
UINT64 ContainerIdLength){
unsigned int v5;
int CachedContextBaseKey;
NTSTATUS v12;
WCHAR *v13;
NTSTATUS v14;
WCHAR *DeviceInstanceIda;
UINT8 *BaseInContainer;
UINT8 *DeviceInContainer;
INT64 v18;
UINT8 v19;
UINT8 v20[7];
INT64 v21;
__int64 KeyNameLength[2];
WCHAR KeyName[40];
v5 = 0;
v21 = 0i64;
v20[0] = 0;
v19 = 0;
CachedContextBaseKey = RtlStringCchCopyW(ContainerId, 0x27ui64, (WCHAR *)BaseContainerId);
if( CachedContextBaseKey >= 0 )
{
if( wcscmp((PWCHAR)L"{00000000-0000-0000-0000-000000000000}", (PWCHAR)BaseContainerId) )
{
CachedContextBaseKey = PnpCtxGetCachedContextBaseKey(
hPnpCtx,
PNPCTX_BASE_KEY_TYPE_CRITICALDEVICEDATABASE,
(VOID **)&v21);
if( CachedContextBaseKey >= 0 )
{
CachedContextBaseKey = CmIsDeviceInContainer(
hPnpCtx,
(VOID *)v21,
(WCHAR *)BaseContainerId,
(WCHAR *)BaseContainerId,
(WCHAR *)DeviceInstanceId,
v20,
&v19);
if( CachedContextBaseKey >= 0 && !v19 )
{
while( 1 )
{
LODWORD(KeyNameLength[0]) = 39;
v12 = RegRtlEnumKey(
(VOID *)v21,
v5,
KeyName,
(UINT64 *)KeyNameLength,
(INT64)DeviceInstanceIda,
(INT64)BaseInContainer,
(INT64)DeviceInContainer,
v18);
CachedContextBaseKey = v12;
if( v12 == -2147483622 )
break;
if( v12 != -1073741789 )
{
if( v12 < 0 )
return CachedContextBaseKey;
v14 = CmValidateDeviceContainerName(v13);
CachedContextBaseKey = v14;
if( v14 != -1073741773 )
{
if( v14 < 0 )
return CachedContextBaseKey;
CachedContextBaseKey = CmIsDeviceInContainer(
hPnpCtx,
(VOID *)v21,
KeyName,
(WCHAR *)BaseContainerId,
(WCHAR *)DeviceInstanceId,
v20,
&v19);
if( CachedContextBaseKey < 0 )
return CachedContextBaseKey;
if( v20[0] )
CachedContextBaseKey = RtlStringCchCopyW(ContainerId, 0x27ui64, KeyName);
if( CachedContextBaseKey < 0 || v19 )
return CachedContextBaseKey;
}
}
++v5;
}
return 0;
}
}
}
}
return CachedContextBaseKey;
}Referenced by:
CmDeleteDeviceWorker
CmGetDeviceMappedPropertyFromComposite
PiDcHandleCustomDeviceEvent
PiDcUpdateDeviceContainerMembership