PiCMDeleteDeviceKey
INT64 __stdcall PiCMDeleteDeviceKey(
PVOID IoctlInputBuffer,
UINT64 IoctlInputBufferSize,
PVOID IoctlOutputBuffer,
UINT64 IoctlOutputBufferSize,
UINT64 *BytesUsed){
unsigned int v5;
int v7;
int v8;
__int16 v9;
__int64 v10;
unsigned int v11;
int inited;
INT64 v14;
char *v15;
HANDLE Handle;
INT64 v17[2];
__int128 v18;
UINT64 ExpectedOutputSize;
struct _UNICODE_STRING DestinationString;
WCHAR SourceString[8];
UINT64 *v22;
v15 = 0i64;
v5 = IoctlOutputBufferSize;
Handle = 0i64;
HIDWORD(v14) = 0;
*(_DWORD *)v22 = 0;
*(_OWORD *)v17 = 0i64;
ExpectedOutputSize = 0i64;
v18 = 0i64;
LODWORD(v14) = 0;
DestinationString = 0i64;
v7 = PiCMCaptureObjectInputData((UINT64)IoctlInputBuffer, IoctlInputBufferSize, (unsigned int)BytesUsed, (INT64)v17);
if( v7 >= 0 )
{
if( PiAuDoesClientHaveAccess(2ui64) )
{
if( (_QWORD)v18 && LODWORD(v17[1]) == 1 && IoctlOutputBuffer && v5 >= 8 )
{
v8 = PiCMConvertDeviceKeyType(SWORD2(v17[0]), &v14);
if( v8 >= 0 )
{
if( (v9 & 0xFF00) == 512 && HIDWORD(v18) == -1 )
{
if( (int)PnpCtxGetCachedContextBaseKey(PiPnpRtlCtx, 4, (__int64 *)&v15) >= 0 )
{
v10 = 0i64;
if( PiPnpRtlCtx )
v10 = *(_QWORD *)(PiPnpRtlCtx + 224);
v11 = 0;
if( (int)SysCtxRegOpenKey(v10, v15, L"Control\\IDConfigDB\\Hardware Profiles", 0, 8u, &Handle) >= 0 )
{
do
{
if( v8 < 0 )
break;
LODWORD(v15) = 5;
inited = RegRtlEnumKey(Handle, v11, (char *)SourceString, (unsigned int *)&v15);
if( inited >= 0 )
{
inited = RtlInitUnicodeStringEx(&DestinationString, SourceString);
if( inited >= 0 )
{
inited = RtlUnicodeStringToInteger(&DestinationString, 0i64, (UINT64 *)((char *)&v14 + 4));
if( inited >= 0 )
{
v8 = CmDeleteDeviceRegKey(PiPnpRtlCtx, (const wchar_t *)v18, v14, SHIDWORD(v14));
if( v8 == -1073741772 )
v8 = 0;
}
}
}
++v11;
}
while( inited >= 0 );
}
}
}
else
{
v8 = CmDeleteDeviceRegKey(PiPnpRtlCtx, (const wchar_t *)v18, v14, SHIDWORD(v18));
}
}
}
else
{
v8 = -1073741811;
}
}
else
{
v8 = -1073741790;
}
if( Handle )
ZwClose(Handle);
v7 = PiCMReturnBasicResultData((unsigned int)v8, (unsigned int)ExpectedOutputSize, IoctlOutputBuffer, v5, v22);
}
PiCMReleaseObjectInputData((INT64)v17);
return(unsigned int)v7;
}Referenced by:
No references.