PiCMDeleteDeviceKey
NTSTATUS __stdcall PiCMDeleteDeviceKey(
VOID *IoctlInputBuffer,
UINT64 IoctlInputBufferSize,
VOID *IoctlOutputBuffer,
UINT64 IoctlOutputBufferSize,
UINT64 *BytesUsed){
unsigned int v5;
int v7;
NTSTATUS v8;
__int16 v9;
__int64 v10;
unsigned int v11;
NTSTATUS inited;
INT64 a5;
INT64 a6;
INT64 PnpRtlKeyType;
VOID *Value_4;
VOID *hKey;
_CMAPI_DEVICE_KEY_TYPE CmapiKeyType[4];
UINT64 v20[2];
UINT64 ExpectedOutputSize;
_UNICODE_STRING DestinationString;
WCHAR KeyName[8];
UINT64 *v24;
Value_4 = 0i64;
v5 = IoctlOutputBufferSize;
hKey = 0i64;
HIDWORD(PnpRtlKeyType) = 0;
*(_DWORD *)v24 = 0;
*(_OWORD *)CmapiKeyType = 0i64;
ExpectedOutputSize = 0i64;
*(_OWORD *)v20 = 0i64;
LODWORD(PnpRtlKeyType) = 0;
DestinationString = 0i64;
v7 = PiCMCaptureObjectInputData(
IoctlInputBuffer,
IoctlInputBufferSize,
(_CMAPI_INPUT_OBJECT_DATA *)(unsigned int)BytesUsed);
if( v7 >= 0 )
{
if( PiAuDoesClientHaveAccess(2ui64) )
{
if( v20[0] && CmapiKeyType[2] == 1 && IoctlOutputBuffer && v5 >= 8 )
{
v8 = PiCMConvertDeviceKeyType(CmapiKeyType[1], (_CM_KEY_TYPE *)&PnpRtlKeyType);
if( v8 >= 0 )
{
if( (v9 & 0xFF00) == 512 && HIDWORD(v20[1]) == -1 )
{
if( PnpCtxGetCachedContextBaseKey(*(&stru_140CF2E80 + 607), PNPCTX_BASE_KEY_TYPE_CONTROLSET, &Value_4) >= 0 )
{
v10 = 0i64;
if( *(&stru_140CF2E80 + 607) )
v10 = *(_QWORD *)(*(&stru_140CF2E80 + 607) + 224i64);
v11 = 0;
if( SysCtxRegOpenKey(v10, Value_4, L"Control\\IDConfigDB\\Hardware Profiles", 0, 8u, &hKey) >= 0 )
{
do
{
if( v8 < 0 )
break;
LODWORD(Value_4) = 5;
inited = RegRtlEnumKey(hKey, v11, KeyName, (UINT64 *)&Value_4, a5, a6, PnpRtlKeyType, (INT64)Value_4);
if( inited >= 0 )
{
inited = RtlInitUnicodeStringEx(&DestinationString, KeyName);
if( inited >= 0 )
{
inited = RtlUnicodeStringToInteger(
&DestinationString,
0i64,
(UINT64 *)((char *)&PnpRtlKeyType + 4));
if( inited >= 0 )
{
v8 = CmDeleteDeviceRegKey(
*(&stru_140CF2E80 + 607),
(WCHAR *)v20[0],
(unsigned int)PnpRtlKeyType,
HIDWORD(PnpRtlKeyType));
if( v8 == -1073741772 )
v8 = 0;
}
}
}
++v11;
}
while( inited >= 0 );
}
}
}
else
{
v8 = CmDeleteDeviceRegKey(
*(&stru_140CF2E80 + 607),
(WCHAR *)v20[0],
(unsigned int)PnpRtlKeyType,
HIDWORD(v20[1]));
}
}
}
else
{
v8 = -1073741811;
}
}
else
{
v8 = -1073741790;
}
if( hKey )
ZwClose((_HANDLE)hKey);
v7 = PiCMReturnBasicResultData(
(unsigned int)v8,
(unsigned int)ExpectedOutputSize,
IoctlOutputBuffer,
v5,
v24,
a6,
PnpRtlKeyType,
(INT64)Value_4);
}
PiCMReleaseObjectInputData((_CMAPI_INPUT_OBJECT_DATA *)CmapiKeyType);
return v7;
}Referenced by:
PiCMHandleIoctl