IopIsReportedAlready
UINT8 __stdcall IopIsReportedAlready(
UNICODE_STRING *InstanceName,
PVOID Handle,
UNICODE_STRING *ServiceName,
CM_RESOURCE_LIST *ResourceList,
UINT64 *MatchingKey){
char *v5;
KEY_VALUE_FULL_INFORMATION *v6;
KEY_VALUE_FULL_INFORMATION *v7;
UINT8 v8;
wchar_t *Buffer;
HANDLE v13;
NTSTATUS RegistryValue;
HAL_BUS_INFORMATION *v16;
HAL_BUS_INFORMATION *v17;
bool v18;
NTSTATUS v19;
BYTE *Data;
UINT64 DataSize;
HANDLE KeyHandle;
int v23;
int v24;
int v25;
HANDLE Handlea;
KEY_VALUE_FULL_INFORMATION *Information;
KEY_VALUE_FULL_INFORMATION *v28;
struct _UNICODE_STRING DestinationString;
PCUNICODE_STRING String1;
WCHAR SourceString[256];
v5 = 0i64;
v6 = 0i64;
v28 = 0i64;
v7 = 0i64;
Information = 0i64;
*(_DWORD *)MatchingKey = 0;
v8 = 0;
Handlea = 0i64;
KeyHandle = 0i64;
v25 = 0;
v23 = 0;
String1 = ServiceName;
Buffer = InstanceName->Buffer;
DestinationString = 0i64;
v24 = 512;
if( (int)CmGetDeviceRegProp(
PiPnpRtlCtx,
Buffer,
(__int64)Handle,
5,
(__int64)&v23,
(__int64)SourceString,
(__int64)&v24,
0) < 0
|| v23 != 1
|| !v24
|| (int)RtlInitUnicodeStringEx(&DestinationString, SourceString) < 0
|| !RtlEqualUnicodeString((UNICODE_STRING *)String1, &DestinationString, 1u) )
{
goto LABEL_10;
}
if( (int)CmOpenDeviceRegKey(PiPnpRtlCtx, InstanceName->Buffer, 20, 0, 131097, 0, (__int64)&Handlea, 0i64) < 0
|| (RegistryValue = IopGetRegistryValue(Handlea, (PWCHAR)L"BootConfig", 0i64, &Information),
ZwClose(Handlea),
v18 = RegistryValue < 0,
v7 = Information,
v18)
|| Information->Type != 8
|| !Information->DataLength )
{
LABEL_7:
if( ResourceList )
goto LABEL_10;
goto LABEL_8;
}
v5 = (char *)Information + Information->DataOffset;
if( ResourceList )
{
if( v5
&& (unsigned int)PnpIsDuplicateDevice(
ResourceList,
(CM_RESOURCE_LIST *)((char *)Information + Information->DataOffset),
v16,
v17,
Data) )
{
*(_DWORD *)MatchingKey = 1;
}
goto LABEL_7;
}
LABEL_8:
if( !v5 )
*(_DWORD *)MatchingKey = 1;
LABEL_10:
if( (int)CmOpenDeviceRegKey(PiPnpRtlCtx, InstanceName->Buffer, 19, 0, 983103, 0, (__int64)&KeyHandle, 0i64) < 0
|| (v19 = IopGetRegistryValue(KeyHandle, (PWCHAR)L"DeviceReported", 0i64, &v28), v6 = v28, v19 < 0) )
{
if( *(_DWORD *)MatchingKey )
{
v13 = KeyHandle;
if( !KeyHandle )
{
if( (int)CmOpenDeviceRegKey(PiPnpRtlCtx, InstanceName->Buffer, 19, 0, 983103, 1, (__int64)&KeyHandle, 0i64) < 0 )
goto LABEL_17;
v13 = KeyHandle;
}
*(_DWORD *)&DestinationString.Length = 1966108;
LODWORD(DataSize) = 4;
DestinationString.Buffer = (wchar_t *)L"DeviceReported";
v25 = 1;
if( ZwSetValueKey(v13, &DestinationString, 0i64, 4ui64, &v25, DataSize) >= 0 )
v8 = 1;
}
}
LABEL_17:
if( KeyHandle )
ZwClose(KeyHandle);
if( v6 )
ExFreePoolWithTag(v6, 0);
if( v7 )
ExFreePoolWithTag(v7, 0);
return v8;
}Referenced by:
IoReportDetectedDevice