__int64 __fastcall CmUpdateDevicePanel(__int64 a1, const WCHAR *a2, __int64 a3){
__int64 v3;
_DWORD *v4;
wchar_t *v5;
HANDLE v6;
int v9;
int ParentDeviceContainerId;
void *v11;
int ObjectProperty;
const WCHAR *v13;
unsigned __int16 *v14;
_DWORD *v15;
int v16;
char v18;
__int64 v19;
int v20;
wchar_t *PoolWithTag;
int v22;
int v23;
UINT64 i;
void *v25;
PVOID v26;
__int64 *v27;
int v28;
__int64 v29;
int v30;
__int64 v31;
int v32;
int v33;
unsigned int v34;
__int64 v35;
int v36;
int v37;
unsigned int v38;
int v39;
unsigned int v40;
int v41;
__int64 v42;
wchar_t *v43;
int v44;
int v45;
__int64 v46;
int v47;
__int64 v48;
unsigned int v49;
unsigned int v50;
unsigned int v51;
unsigned int v52;
char v53;
char v54;
char v55;
PVOID v56;
char v57[4];
ULONG v58;
int v59;
PVOID P;
int DevicePanelGroup;
int v62;
_DWORD *v63;
ULONG v64;
unsigned int v65;
unsigned int v66;
ULONG v67;
int v68;
int v69;
PVOID v70;
PVOID v71;
__int64 v72;
PVOID v73;
__int128 v74;
__int128 v75;
int v76;
__int128 v77;
int v78;
v3 = PiPnpRtlCtx;
v73 = 0i64;
v69 = 0;
v63 = 0i64;
v68 = 0;
v71 = 0i64;
v4 = 0i64;
v64 = 0;
v5 = 0i64;
v56 = 0i64;
v6 = 0i64;
v74 = 0i64;
v55 = 0;
DevicePanelGroup = 0;
v62 = 0;
P = 0i64;
v70 = 0i64;
v54 = 0;
v75 = 0i64;
v76 = 0;
v77 = 0i64;
v78 = 0;
v72 = 0i64;
v53 = 0;
v52 = 0;
v65 = 0;
v66 = 0;
v57[0] = 0;
v58 = 0;
v59 = 1;
if( CmIsRootDevice(a2) )
return(unsigned int)-1073741637;
v9 = CmQueryDevicePanelPldProperty(
v3,
(__int64)a2,
1u,
a3,
(__int64)&DEVPKEY_Device_PhysicalDeviceLocation,
&v73,
&v69,
&v63,
&v68);
ParentDeviceContainerId = v9;
if( v9 == -1073741275 )
{
v63 = 0i64;
goto LABEL_4;
}
if( v9 >= 0 )
{
v4 = v63;
if( !v63 )
goto LABEL_4;
ParentDeviceContainerId = CmGetParentDeviceContainerId(v3, a2, (unsigned __int64)&v74);
if( ParentDeviceContainerId >= 0 )
{
v55 = 1;
DevicePanelGroup = CmGetDevicePanelGroup((__int64)v4);
v20 = 0;
if( ((v4[2] >> 3) & 7) != 7 )
v20 = dword_14001F7D0[(v4[2] >> 3) & 7];
v62 = v20;
PoolWithTag = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x72ui64, 0x52504E50ui64);
v5 = PoolWithTag;
if( PoolWithTag )
{
CmBuildDevicePanelId((int *)&v74, DevicePanelGroup, v62, PoolWithTag);
ParentDeviceContainerId = v22;
if( v22 < 0 )
goto LABEL_28;
v23 = 16;
for( i = 16i64; ; i = v58 )
{
v67 = v23;
v25 = ExAllocatePoolWithTag(PagedPool, i, 0x52504E50ui64);
v56 = v25;
if( !v25 )
goto LABEL_115;
ParentDeviceContainerId = PnpGetObjectProperty(
v3,
(__int64)a2,
1i64,
a3,
0i64,
(__int64)DEVPKEY_Device_PhysicalDeviceLocationSpatial,
&v59,
(unsigned __int64)v25,
v23,
&v58,
0);
if( ParentDeviceContainerId != -1073741789 )
goto LABEL_75;
if( v58 <= v67 )
break;
ExFreePoolWithTag(v56, 0);
v23 = v58;
}
ParentDeviceContainerId = -1073741823;
LABEL_75:
if( ParentDeviceContainerId == -1073741275 )
{
v26 = v56;
}
else
{
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v26 = v56;
if( v59 == 4099 && v58 >= 0x10 && (*(_BYTE *)v56 & 0x1F) != 0 )
goto LABEL_4;
}
ExFreePoolWithTag(v26, 0);
v56 = 0i64;
LABEL_4:
v11 = ExAllocatePoolWithTag(PagedPool, 0x72ui64, 0x52504E50ui64);
P = v11;
if( !v11 )
{
LABEL_115:
ParentDeviceContainerId = -1073741801;
goto LABEL_28;
}
ObjectProperty = PnpGetObjectProperty(
v3,
(__int64)a2,
1i64,
a3,
0i64,
(__int64)&DEVPKEY_Device_PanelId,
&v59,
(unsigned __int64)v11,
114,
&v58,
0);
ParentDeviceContainerId = ObjectProperty;
if( ObjectProperty == -1073741275 )
goto LABEL_6;
if( ObjectProperty < 0 )
goto LABEL_28;
if( v59 != 18 || v58 < 2 )
{
LABEL_6:
ExFreePoolWithTag(P, 0);
v13 = 0i64;
P = 0i64;
}
else
{
v13 = (const WCHAR *)P;
}
if( v5 )
{
if( v13 && !wcsicmp(v13, v5) )
{
v18 = 0;
LABEL_45:
if( v13 && v18 )
{
ParentDeviceContainerId = CmRemovePanelDevice(v3, v13, (__int64)a2);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
}
if( v5 )
{
v19 = -1i64;
do
++v19;
while( v5[v19] );
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)&DEVPKEY_Device_PanelId,
18,
(__int64)v5,
2 * (int)v19 + 2,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelGroup,
7,
(__int64)&DevicePanelGroup,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelSide,
7,
(__int64)&v62,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
}
else
{
if( !v13 )
goto LABEL_9;
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)&DEVPKEY_Device_PanelId, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelGroup, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelSide, 0, 0i64, 0, 0);
}
if( v5 && v4 )
{
if( v56 )
{
v52 = (unsigned __int16)*((_DWORD *)v56 + 1);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelWidth,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = *((unsigned __int16 *)v56 + 3);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelHeight,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = (unsigned __int16)*((_DWORD *)v56 + 2);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelLength,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
}
else
{
v52 = (unsigned __int16)v4[1];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelWidth,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = *((unsigned __int16 *)v4 + 3);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelHeight,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
if( P )
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelLength,
0,
0i64,
0,
0);
}
}
else if( v13 )
{
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelWidth, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelHeight, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelLength, 0, 0i64, 0, 0);
}
if( v5 && v4 && *((_WORD *)v4 + 9) != 0xFFFF && (unsigned __int16)v4[4] != 0xFFFF )
{
v14 = (unsigned __int16 *)v56;
goto LABEL_129;
}
LABEL_9:
v14 = (unsigned __int16 *)v56;
if( !v56 )
{
if( !v13 )
{
LABEL_11:
if( v5 && v4 )
{
if( v14 )
{
v52 = ((*(_DWORD *)v14 >> 5) & 0x1FFu) % 0x168;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationX,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = ((*(_DWORD *)v56 >> 14) & 0x1FFu) % 0x168;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationY,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = (*(_DWORD *)v56 >> 23) % 0x168u;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationZ,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
goto LABEL_13;
}
v52 = 45 * ((v4[3] >> 19) & 0xFu) % 0x168;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationZ,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
if( !P )
goto LABEL_13;
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationX,
0,
0i64,
0,
0);
v27 = DEVPKEY_Device_PanelRotationY;
}
else
{
if( !v13 )
goto LABEL_13;
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationX,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelRotationY,
0,
0i64,
0,
0);
v27 = DEVPKEY_Device_PanelRotationZ;
}
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)v27, 0, 0i64, 0, 0);
LABEL_13:
if( !v5 || !v4 || (*v4 & 0x80u) != 0 )
{
if( v13 )
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelColor,
0,
0i64,
0,
0);
LABEL_16:
if( v5 && v4 )
{
v28 = 0;
v29 = (v4[2] >> 10) & 0xF;
if( (unsigned int)v29 < 9 )
v28 = dword_14001F7F0[v29];
v52 = v28;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelShape,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
}
else if( v13 )
{
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelShape,
0,
0i64,
0,
0);
}
if( v5 && v4 )
{
v57[0] = -((v4[2] & 1) != 0);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelVisible,
17,
(__int64)v57,
1u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
}
else if( v13 )
{
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelVisible,
0,
0i64,
0,
0);
}
if( v5 )
{
if( v54 )
{
v30 = CmAddPanelDevice(v3, v5, (__int64)a2);
ParentDeviceContainerId = v30;
if( v30 < 0 )
goto LABEL_28;
}
}
v15 = 0i64;
v76 = 2;
v75 = DEVPKEY_Device_PhysicalDeviceLocationPanel;
v78 = 2;
v77 = DEVPKEY_Device_PhysicalDeviceLocationJoint;
while( 2 )
{
v16 = CmQueryDevicePanelPldProperty(v3, (__int64)a2, 1u, a3, (__int64)&v75, &v73, &v69, &v63, &v68);
ParentDeviceContainerId = v16;
if( v16 == -1073741275 )
{
ParentDeviceContainerId = 0;
goto LABEL_26;
}
if( v16 < 0 )
goto LABEL_26;
if( !v55 )
{
ParentDeviceContainerId = CmGetParentDeviceContainerId(v3, a2, (unsigned __int64)&v74);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v55 = 1;
}
DevicePanelGroup = CmGetDevicePanelGroup((__int64)v63);
v32 = DevicePanelGroup;
v33 = 0;
v34 = (*(_DWORD *)(v31 + 8) >> 3) & 7;
if( v34 < 7 )
v33 = dword_14001F7D0[v34];
v62 = v33;
if( !v5 )
{
v5 = (wchar_t *)ExAllocatePoolWithTag(PagedPool, 0x72ui64, 0x52504E50ui64);
if( !v5 )
break;
v32 = DevicePanelGroup;
v33 = v62;
}
CmBuildDevicePanelId((int *)&v74, v32, v33, v5);
ParentDeviceContainerId = v36;
if( v36 < 0 )
goto LABEL_26;
v37 = CmCreateDevicePanel(v3, v5, v35, (HANDLE *)&v72, &v53);
v6 = (HANDLE)v72;
ParentDeviceContainerId = v37;
if( v37 < 0 )
goto LABEL_26;
v52 = (unsigned __int16)v63[1];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
v72,
0i64,
(__int64)DEVPKEY_DevicePanel_Width,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v52 = *((unsigned __int16 *)v63 + 3);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_Height,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
if( (*v63 & 0x80u) != 0 )
{
if( !v53 )
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_Color,
0,
0i64,
0,
0);
}
else
{
v52 = (unsigned __int8)BYTE1(*v63) | (((*((unsigned __int8 *)v63 + 3) << 8) | (unsigned __int8)BYTE2(*v63)) << 8) | 0xFF000000;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_Color,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
}
v38 = v64;
if( !v15 )
v38 = 16;
while( 1 )
{
v64 = v38;
if( !v15 )
{
v71 = ExAllocatePoolWithTag(PagedPool, v38, 0x52504E50ui64);
v15 = v71;
if( !v71 )
goto LABEL_229;
}
ParentDeviceContainerId = PnpGetObjectProperty(
v3,
(__int64)a2,
1i64,
a3,
0i64,
(__int64)&v77,
&v59,
(unsigned __int64)v15,
v38,
&v58,
0);
if( ParentDeviceContainerId != -1073741789 )
goto LABEL_172;
if( v58 <= v64 )
break;
ExFreePoolWithTag(v15, 0);
v38 = v58;
v15 = 0i64;
v71 = 0i64;
}
ParentDeviceContainerId = -1073741823;
LABEL_172:
if( ParentDeviceContainerId == -1073741275 )
{
*v15 &= 0xFFFFFFE0;
}
else
{
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
if( v59 != 4099 || v58 < 0x10 )
*v15 &= 0xFFFFFFE0;
}
if( (*v15 & 0x1F) == 0 )
{
if( v53 )
goto LABEL_228;
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointType,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePanelEdge,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPanelId,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPanelEdge,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionX,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionY,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionZ,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionX,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionY,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionZ,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetRotationX,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetRotationY,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetRotationZ,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementOrientation,
0,
0i64,
0,
0);
goto LABEL_227;
}
v39 = 0;
v40 = (*v15 >> 5) & 0xF;
if( v40 < 5 )
v39 = dword_1400401E0[v40];
v52 = v39;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointType,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v41 = 0;
v42 = (*v15 >> 9) & 7;
if( (unsigned int)v42 < 5 )
v41 = dword_1400401F8[v42];
v52 = v41;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePanelEdge,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v43 = (wchar_t *)v70;
if( v70
|| (v70 = ExAllocatePoolWithTag(PagedPool, 0x72ui64, 0x52504E50ui64),
(v43 = (wchar_t *)v70) != 0i64) )
{
v44 = 0;
if( ((*v15 >> 20) & 7) != 7 )
v44 = dword_14001F7D0[(*v15 >> 20) & 7];
v52 = v44;
CmBuildDevicePanelId((int *)&v74, (unsigned __int8)(*v15 >> 12), v44, v43);
ParentDeviceContainerId = v45;
if( v45 < 0 )
goto LABEL_26;
v46 = -1i64;
do
++v46;
while( *((_WORD *)v70 + v46) );
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPanelId,
18,
(__int64)v70,
2 * (int)v46 + 2,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v47 = 0;
v48 = (*v15 >> 23) & 7;
if( (unsigned int)v48 < 5 )
v47 = dword_1400401F8[v48];
v52 = v47;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPanelEdge,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
if( *((_WORD *)v63 + 9) == 0xFFFF || (unsigned __int16)v63[4] == 0xFFFF )
{
if( !v53 )
{
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionX,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionY,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionZ,
0,
0i64,
0,
0);
}
}
else
{
v52 = *((unsigned __int16 *)v63 + 9);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionX,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
v52 = (unsigned __int16)v63[4];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionY,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_26;
if( !v53 )
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointSourcePositionZ,
0,
0i64,
0,
0);
}
v52 = (unsigned __int16)v15[2];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionX,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
v52 = *((unsigned __int16 *)v15 + 5);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionY,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
v52 = (unsigned __int16)v15[3];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetPositionZ,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
v52 = (*((_WORD *)v15 + 7) & 0x1FFu) % 0x168;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointTargetRotationZ,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
v52 = dword_140040210[(unsigned __int64)(unsigned int)*v15 >> 31];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementOrientation,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
if( (*v15 & 0x1E0) != 0 && (*v15 & 0x1E0u) <= 0x80 )
{
v52 = 0;
if( (int)PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionMin,
7,
(__int64)&v52,
4u,
0) >= 0 )
{
v49 = *((unsigned __int16 *)v15 + 3);
v50 = (unsigned __int16)v15[1];
if( (*v15 & 0x1E0) != 32 )
{
v49 %= 0x168u;
v50 %= 0x168u;
}
v65 = v50 + v49;
if( (int)PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionMax,
7,
(__int64)&v65,
4u,
0) >= 0 )
{
v51 = *((unsigned __int16 *)v15 + 3);
if( (*v15 & 0x1E0) != 32 )
v51 %= 0x168u;
v66 = v51;
if( (int)PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionStart,
7,
(__int64)&v66,
4u,
0) >= 0
&& ((int)PnpGetObjectProperty(
v3,
(__int64)v5,
6i64,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPosition,
&v59,
(unsigned __int64)&v52,
4,
&v58,
0) < 0
|| v59 != 7
|| v58 != 4
|| v52 > v65) )
{
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPosition,
7,
(__int64)&v66,
4u,
0);
}
}
}
goto LABEL_228;
}
if( v53 )
{
LABEL_228:
++v76;
++v78;
continue;
}
LABEL_227:
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionMin,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionMax,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPositionStart,
0,
0i64,
0,
0);
PnpSetObjectProperty(
v3,
(__int64)v5,
6u,
(__int64)v6,
0i64,
(__int64)DEVPKEY_DevicePanel_JointMovementPosition,
0,
0i64,
0,
0);
goto LABEL_228;
}
}
}
}
}
LABEL_26:
if( v6 )
ZwClose(v6);
goto LABEL_28;
}
break;
}
LABEL_229:
ParentDeviceContainerId = -1073741801;
goto LABEL_26;
}
v52 = (unsigned __int8)BYTE1(*v4) | (((*((unsigned __int8 *)v4 + 3) << 8) | (unsigned __int8)BYTE2(*v4)) << 8) | 0xFF000000;
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelColor,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId >= 0 )
{
v13 = (const WCHAR *)P;
goto LABEL_16;
}
LABEL_28:
if( v5 )
ExFreePoolWithTag(v5, 0);
if( P )
ExFreePoolWithTag(P, 0);
if( v70 )
ExFreePoolWithTag(v70, 0);
v4 = v56;
goto LABEL_35;
}
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelPositionX, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelPositionY, 0, 0i64, 0, 0);
PnpSetObjectProperty(v3, (__int64)a2, 1u, a3, 0i64, (__int64)DEVPKEY_Device_PanelPositionZ, 0, 0i64, 0, 0);
LABEL_83:
v14 = (unsigned __int16 *)v56;
goto LABEL_11;
}
LABEL_129:
if( v14 )
{
v52 = v14[5];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionX,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = (unsigned __int16)*((_DWORD *)v56 + 3);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionY,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = *((unsigned __int16 *)v56 + 7);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionZ,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
}
else
{
v52 = *((unsigned __int16 *)v4 + 9);
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionX,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v52 = (unsigned __int16)v4[4];
ParentDeviceContainerId = PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionY,
7,
(__int64)&v52,
4u,
0);
if( ParentDeviceContainerId < 0 )
goto LABEL_28;
v13 = (const WCHAR *)P;
if( P )
PnpSetObjectProperty(
v3,
(__int64)a2,
1u,
a3,
0i64,
(__int64)DEVPKEY_Device_PanelPositionZ,
0,
0i64,
0,
0);
}
goto LABEL_83;
}
}
else if( !v13 )
{
goto LABEL_9;
}
v18 = 1;
v54 = 1;
goto LABEL_45;
}
ParentDeviceContainerId = -1073741801;
}
v4 = 0i64;
}
LABEL_35:
if( v73 )
ExFreePoolWithTag(v73, 0);
if( v4 )
ExFreePoolWithTag(v4, 0);
if( v71 )
ExFreePoolWithTag(v71, 0);
return(unsigned int)ParentDeviceContainerId;
}