PipServiceInstanceToDeviceInstance
NTSTATUS __stdcall PipServiceInstanceToDeviceInstance(
VOID *ServiceKeyHandle,
_UNICODE_STRING *ServiceKeyName,
UINT64 ServiceInstanceOrdinal,
_UNICODE_STRING *DeviceInstanceRegistryPath,
VOID **DeviceInstanceHandle,
UINT64 DesiredAccess){
NTSTATUS result;
int RegistryValue;
_KEY_VALUE_FULL_INFORMATION *v9;
unsigned int DataLength;
_WORD *v11;
INT64 CreateEnum;
INT64 v13;
_KEY_VALUE_FULL_INFORMATION *Information;
VOID *KeyHandle;
_UNICODE_STRING SourceString;
_OBJECT_ATTRIBUTES ObjectAttributes;
WCHAR pszDest[20];
Information = 0i64;
KeyHandle = 0i64;
SourceString = 0i64;
if( ServiceKeyHandle )
{
ObjectAttributes.RootDirectory = ServiceKeyHandle;
SourceString.Buffer = (wchar_t *)&stru_1407D01E0._Xmm7;
*(_DWORD *)&SourceString.Length = 655368;
ObjectAttributes.ObjectName = &SourceString;
*(_QWORD *)&ObjectAttributes.Length = 48i64;
*(_QWORD *)&ObjectAttributes.Attributes = 576i64;
*(_OWORD *)&ObjectAttributes.SecurityDescriptor = 0i64;
result = ZwOpenKey(
&KeyHandle,
0x20019ui64,
&ObjectAttributes,
(INT64)DeviceInstanceRegistryPath,
CreateEnum,
v13,
(INT64)Information,
(INT64)KeyHandle);
}
else
{
result = PipOpenServiceEnumKeys(ServiceKeyName, 0x20019ui64, 0i64, &KeyHandle, 0);
}
if( result >= 0 )
{
RtlStringCbPrintfW(pszDest, 0x28ui64, (WCHAR *)L"%u");
RegistryValue = IopGetRegistryValue(KeyHandle, pszDest, 0x64ui64, &Information);
ZwClose((_HANDLE)KeyHandle);
if( RegistryValue >= 0 )
{
v9 = Information;
if( Information->Type == 1 )
{
DataLength = Information->DataLength;
v11 = (_WORD *)((char *)Information + Information->DataOffset);
LODWORD(Information) = 0;
PnpRegSzToString(v11, DataLength, (int *)&Information);
SourceString.Length = (unsigned __int16)Information;
SourceString.MaximumLength = v9->DataLength;
SourceString.Buffer = (wchar_t *)((char *)v9 + v9->DataOffset);
if( !(_WORD)Information )
RegistryValue = -1073741766;
}
else
{
RegistryValue = -1073741215;
}
if( RegistryValue >= 0 )
{
if( DeviceInstanceRegistryPath )
RegistryValue = PnpConcatenateUnicodeStrings(DeviceInstanceRegistryPath, &SourceString);
}
ExFreePoolWithTag(v9, 0);
}
return RegistryValue;
}
return result;
}Referenced by:
PnpDriverLoadingFailed