CmIsDeviceSafeRemovalRequired
char __fastcall CmIsDeviceSafeRemovalRequired(__int64 a1, const wchar_t *a2, __int64 a3){
bool v6;
char v7;
int DeviceRegProp;
int v9;
char v10;
WCHAR *i;
int v13;
int v14;
UINT64 dwFlags;
unsigned int v16;
char v17[4];
ULONG v18;
int v19;
int v20;
int v21;
int v22;
int v23;
int v24;
int v25[4];
wchar_t pszSrc[200];
wchar_t pszDest[200];
v21 = 0;
v22 = 0;
v19 = 0;
v6 = 0;
v17[0] = 0;
v20 = 0;
v24 = 0;
v23 = 0;
if( (int)CmGetDeviceStatus(a1, a2, a3, &v20, &v24, &v23, v16) >= 0 )
{
v7 = v20;
v18 = 4;
DeviceRegProp = CmGetDeviceRegProp(a1, a2, a3, 16, (__int64)&v22, (__int64)&v19, (__int64)&v18, 0);
v9 = v19;
if( DeviceRegProp < 0 )
v9 = 0;
v19 = v9;
v10 = v9 & 4;
if( (v7 & 8) != 0 || (v9 & 2) != 0 )
{
v18 = 1;
v6 = (v9 & 0x80u) == 0;
if( !(unsigned int)PnpGetObjectProperty(
a1,
(__int64)a2,
1i64,
a3,
0i64,
(__int64)&DEVPKEY_Device_SafeRemovalRequiredOverride,
&v21,
(unsigned __int64)v17,
1,
&v18,
0)
&& v21 == 17
&& v18 == 1 )
{
v6 = v17[0] != 0;
}
if( !v10 && v6 )
{
v6 = 0;
for( i = (WCHAR *)a2; ; i = pszSrc )
{
LODWORD(dwFlags) = 2048;
if( (int)RtlStringCchCopyExW(pszDest, 0xC8ui64, i, 0i64, 0i64, dwFlags) < 0 )
break;
v25[0] = 200;
if( (int)CmGetDeviceParent(a1, pszDest, pszSrc, (ULONG *)v25) < 0 )
return v10;
v18 = 4;
v13 = CmGetDeviceRegProp(a1, pszSrc, 0i64, 16, (__int64)&v22, (__int64)&v19, (__int64)&v18, 0);
v14 = v19;
if( v13 < 0 )
v14 = 0;
v19 = v14;
v10 = v14 & 4;
if( v10 )
return v10;
}
}
}
}
return v6;
}Referenced by:
CmGetDeviceMappedPropertyFromComposite