DrvDbGetDriverDatabaseMappedPropertyKeys
NTSTATUS __stdcall DrvDbGetDriverDatabaseMappedPropertyKeys(
_DRVDB_CONTEXT *pDrvDbCtx,
WCHAR *DatabaseNodeId,
VOID *ObjectBaseKey,
_DEVPROPKEY *PropertyKeys,
UINT64 BufferLength,
UINT64 *PropertyCount){
UINT64 *v6;
unsigned int v7;
WCHAR *v8;
_DEVPROPKEY *v9;
_DRVDB_CONTEXT *v10;
unsigned int v11;
signed int CompositeMappedPropertyKeys;
__int64 v13;
__int64 v14;
__int64 v15;
INT64 v16;
INT64 v17;
VOID *v18;
__int64(**v19)[3];
unsigned int v20;
const wchar_t *v21;
signed int Value;
_GUID *v23;
VOID *v24;
__int64 v25;
_DEVPROPKEY **v26;
unsigned int v27;
const wchar_t *v28;
signed int v29;
_DEVPROPKEY *v30;
__int64 v31;
unsigned int v32;
int v33;
UINT64 v35;
INT64 v36;
UINT64 *BaseKeyHandlea;
INT64 BaseKeyHandle;
VOID **Disposition;
INT64 v40;
__int64 v41;
_DRVDB_NODE *DatabaseNode;
VOID *hKey;
VOID *KeyHandle;
VOID *v45;
v6 = PropertyCount;
v7 = BufferLength;
v8 = DatabaseNodeId;
BaseKeyHandlea = PropertyCount;
v9 = PropertyKeys;
DatabaseNode = 0i64;
hKey = 0i64;
v10 = pDrvDbCtx;
KeyHandle = 0i64;
v11 = 0;
*(_DWORD *)PropertyCount = 0;
LODWORD(v35) = BufferLength;
CompositeMappedPropertyKeys = DrvDbGetCompositeMappedPropertyKeys(
pDrvDbCtx,
(const _DEVPROPKEY **)&stru_140C00F40 + 934,
7ui64,
PropertyKeys,
v35,
BaseKeyHandlea);
if( CompositeMappedPropertyKeys < 0 )
return CompositeMappedPropertyKeys;
v14 = *(unsigned int *)v6;
if( (_DWORD)v14 )
{
if( v13 )
v9 = (_DEVPROPKEY *)(v13 + 20 * v14);
v7 = BufferLength - v14;
}
CompositeMappedPropertyKeys = DrvDbFindDatabaseNode(v10, v8, &DatabaseNode);
if( CompositeMappedPropertyKeys < 0 )
return CompositeMappedPropertyKeys;
if( (DatabaseNode[14] & 0x10) != 0 )
{
CompositeMappedPropertyKeys = DrvDbOpenObjectRegKey(
v10,
*((_UNICODE_STRING **)v10 + 4),
DRVDB_BASE_KEY_TYPE_NODES,
v8,
1,
0,
&KeyHandle,
0i64);
if( CompositeMappedPropertyKeys < 0 )
goto LABEL_47;
v18 = KeyHandle;
v19 = &off_140009A30;
LODWORD(PropertyCount) = 0;
v45 = KeyHandle;
v20 = 0;
while( 1 )
{
v21 = (const wchar_t *)v19[2];
LODWORD(v41) = 0;
Value = RegRtlQueryValue(v18, v21, 0i64, 0i64, (__int64)&v41);
CompositeMappedPropertyKeys = Value;
if( Value != -1073741772 )
{
if( Value && Value != -1073741789 )
goto LABEL_22;
if( v9 )
{
v16 = (unsigned int)PropertyCount;
if( (unsigned int)PropertyCount < v7 )
{
v23 = (_GUID *)*v19;
v15 = 5i64 * (unsigned int)PropertyCount;
v16 = (unsigned int)((_DWORD)PropertyCount + 1);
LODWORD(PropertyCount) = (_DWORD)PropertyCount + 1;
*(_GUID *)((char *)&v9->fmtid + 4 * v15) = *v23;
*(&v9->pid + v15) = v23[1].Data1;
}
}
if( v11 + 1 < v11 )
{
CompositeMappedPropertyKeys = -1073741675;
v11 = 0;
goto LABEL_22;
}
++v11;
}
++v20;
v19 += 5;
if( v20 >= 4 )
break;
v18 = v45;
}
CompositeMappedPropertyKeys = 0;
LABEL_22:
if( CompositeMappedPropertyKeys < 0 )
goto LABEL_47;
if( v11 )
{
if( v9 )
{
v15 = 5i64 * v11;
v9 += v11;
}
v7 -= v11;
}
if( (DatabaseNode[14] & 4) != 0 )
{
CompositeMappedPropertyKeys = 0;
goto LABEL_47;
}
v10 = pDrvDbCtx;
v8 = DatabaseNodeId;
}
v24 = ObjectBaseKey;
if( !ObjectBaseKey )
{
CompositeMappedPropertyKeys = DrvDbOpenDriverDatabaseRegKey((_UNICODE_STRING **)v10, v8, 1ui64, 0, &hKey, 0i64);
if( CompositeMappedPropertyKeys < 0 )
goto LABEL_47;
v24 = hKey;
ObjectBaseKey = hKey;
}
v25 = 0i64;
v26 = &off_140001FC0;
v27 = 0;
while( 1 )
{
v28 = (const wchar_t *)v26[2];
LODWORD(PropertyCount) = 0;
v29 = RegRtlQueryValue(v24, v28, 0i64, 0i64, (__int64)&PropertyCount);
CompositeMappedPropertyKeys = v29;
if( v29 == -1073741772 )
{
CompositeMappedPropertyKeys = 0;
goto LABEL_44;
}
if( v29 && v29 != -1073741789 )
goto LABEL_47;
if( v9 && (unsigned int)v25 < v7 )
{
v30 = *v26;
v31 = v25;
v25 = (unsigned int)(v25 + 1);
v9[v31].fmtid = (*v26)->fmtid;
v9[v31].pid = v30->pid;
}
v32 = *(_DWORD *)v6;
v33 = -1;
v15 = (unsigned int)(*(_DWORD *)v6 + 1);
if( (unsigned int)v15 >= *(_DWORD *)v6 )
v33 = *(_DWORD *)v6 + 1;
CompositeMappedPropertyKeys = (unsigned int)v15 < v32 ? 0xC0000095 : 0;
*(_DWORD *)v6 = v33;
if( (unsigned int)v15 < v32 )
break;
LABEL_44:
v24 = ObjectBaseKey;
++v27;
v26 += 5;
if( v27 >= 0xC )
goto LABEL_47;
}
*(_DWORD *)v6 = 0;
LABEL_47:
if( hKey )
PnpCtxRegCloseKey((HPNPCTX *)v15, hKey, v16, v17, v36, BaseKeyHandle, (INT64)Disposition, v40);
if( KeyHandle )
PnpCtxRegCloseKey((HPNPCTX *)v15, KeyHandle, v16, v17, v36, BaseKeyHandle, (INT64)Disposition, v40);
return CompositeMappedPropertyKeys;
}Referenced by:
DrvDbDispatchDriverDatabase