IopIsReportedAlready
UINT8 __stdcall IopIsReportedAlready(
_UNICODE_STRING *InstanceName,
VOID *Handle,
_UNICODE_STRING *ServiceName,
_HANDLE ResourceList,
UINT64 *MatchingKey,
INT64 a6,
INT64 a7,
UINT64 a8){
char *v8;
_KEY_VALUE_FULL_INFORMATION *v9;
_KEY_VALUE_FULL_INFORMATION *v10;
UINT8 v11;
_DWORD *v12;
wchar_t *Buffer;
VOID *v16;
NTSTATUS RegistryValue;
bool v19;
NTSTATUS v20;
UINT64 *CmRegPropType;
UINT64 *CmRegPropTypea;
UINT8 *PropertyBuffer;
UINT64 Flags;
VOID *KeyHandle;
UINT64 PropertySize;
int Data;
VOID *DeviceKey;
_KEY_VALUE_FULL_INFORMATION *Information;
_KEY_VALUE_FULL_INFORMATION *v30;
_UNICODE_STRING DestinationString;
_UNICODE_STRING *String1;
UINT8 v33[512];
LODWORD(Flags) = 0;
v8 = 0i64;
v9 = 0i64;
v30 = 0i64;
v10 = 0i64;
Information = 0i64;
*(_DWORD *)MatchingKey = 0;
v11 = 0;
DeviceKey = 0i64;
v12 = *(_DWORD **)&ResourceList;
KeyHandle = 0i64;
Data = 0;
PropertySize = 0x20000000000i64;
String1 = ServiceName;
Buffer = InstanceName->Buffer;
DestinationString = 0i64;
if( CmGetDeviceRegProp(
*(&stru_140CF2E80 + 607),
Buffer,
Handle,
5i64,
&PropertySize,
v33,
(UINT64 *)((char *)&PropertySize + 4),
Flags) < 0
|| (_DWORD)PropertySize != 1
|| !HIDWORD(PropertySize)
|| RtlInitUnicodeStringEx(&DestinationString, (WCHAR *)v33) < 0
|| !(unsigned __int8)RtlEqualUnicodeString(String1, &DestinationString, 1u) )
{
goto LABEL_10;
}
LODWORD(CmRegPropType) = 131097;
if( CmOpenDeviceRegKey(
*(&stru_140CF2E80 + 607),
InstanceName->Buffer,
CM_KEY_TYPE_DEVICE_LOGCONF,
0i64,
(UINT64)CmRegPropType,
0,
&DeviceKey,
0i64) < 0
|| (RegistryValue = IopGetRegistryValue(DeviceKey, (PWCHAR)L"BootConfig", 0i64, &Information),
ZwClose((_HANDLE)DeviceKey),
v19 = RegistryValue < 0,
v10 = Information,
v19)
|| Information->Type != 8
|| !Information->DataLength )
{
LABEL_7:
if( v12 )
goto LABEL_10;
goto LABEL_8;
}
v8 = (char *)Information + Information->DataOffset;
if( v12 )
{
if( v8
&& (unsigned int)PnpIsDuplicateDevice(v12, (ULONG *)((char *)&Information->TitleIndex + Information->DataOffset)) )
{
*(_DWORD *)MatchingKey = 1;
}
goto LABEL_7;
}
LABEL_8:
if( !v8 )
*(_DWORD *)MatchingKey = 1;
LABEL_10:
LODWORD(CmRegPropType) = 983103;
if( CmOpenDeviceRegKey(
*(&stru_140CF2E80 + 607),
InstanceName->Buffer,
CM_KEY_TYPE_DEVICE_CONTROL,
0i64,
(UINT64)CmRegPropType,
0,
&KeyHandle,
0i64) < 0
|| (v20 = IopGetRegistryValue(KeyHandle, (PWCHAR)L"DeviceReported", 0i64, &v30), v9 = v30, v20 < 0) )
{
if( *(_DWORD *)MatchingKey )
{
v16 = KeyHandle;
if( !KeyHandle )
{
LODWORD(CmRegPropTypea) = 983103;
if( CmOpenDeviceRegKey(
*(&stru_140CF2E80 + 607),
InstanceName->Buffer,
CM_KEY_TYPE_DEVICE_CONTROL,
0i64,
(UINT64)CmRegPropTypea,
1u,
&KeyHandle,
0i64) < 0 )
goto LABEL_17;
v16 = KeyHandle;
}
*(_DWORD *)&DestinationString.Length = 1966108;
LODWORD(PropertyBuffer) = 4;
DestinationString.Buffer = (wchar_t *)L"DeviceReported";
Data = 1;
if( ZwSetValueKey(v16, &DestinationString, 0i64, 4ui64, &Data, (UINT64)PropertyBuffer) >= 0 )
v11 = 1;
}
}
LABEL_17:
if( KeyHandle )
ZwClose((_HANDLE)KeyHandle);
if( v9 )
ExFreePoolWithTag(v9, 0);
if( v10 )
ExFreePoolWithTag(v10, 0);
return v11;
}Referenced by:
IoReportDetectedDevice