SshpGenerateDeviceFriendlyName
INT64 __stdcall SshpGenerateDeviceFriendlyName(PDEVICE_OBJECT DeviceObject){
unsigned int *v1;
ULONG v2;
_UNICODE_STRING *v3;
__int64 v4;
ULONG v5;
_UNICODE_STRING *v6;
unsigned int *v7;
const _UNICODE_STRING *v9;
void *v10;
int v11;
NTSTATUS DeviceProperty;
ULONG v13;
__int64 v14;
int v15;
__int64 v16;
VOID *PoolWithTag;
__int64 v18;
_WORD *v19;
signed int v20;
int v21;
__int64 v22;
_WORD *v23;
int v24;
ULONG Tag;
ULONG BufferLength;
struct _UNICODE_STRING DestinationString;
char v29;
v4 = *((_QWORD *)DeviceObject + 39);
v5 = 0;
BufferLength = 0;
v6 = v3;
Tag = v2;
v7 = v1;
v9 = *(const _UNICODE_STRING **)(v4 + 40);
v10 = 0i64;
DestinationString = 0i64;
if( !v9 )
{
v11 = -1073741811;
goto LABEL_46;
}
DeviceProperty = IoGetDeviceProperty(DeviceObject, DevicePropertyDeviceDescription, 0, 0i64, &BufferLength);
v11 = DeviceProperty;
if( DeviceProperty == -1073741789 )
{
if( BufferLength > 0xFFFF )
{
v11 = -2147483643;
goto LABEL_45;
}
v5 = BufferLength + 4;
}
else if( DeviceProperty != -1073741772 )
{
goto LABEL_44;
}
v13 = v9[8].Length + v5;
if( v7 )
{
v14 = *v7;
DestinationString.Buffer = (wchar_t *)&v29;
*(_DWORD *)&DestinationString.Length = 0x400000;
RtlUnicodeStringPrintf(&DestinationString, L" (%d)", v14);
v11 = v15;
if( v15 < 0 )
goto LABEL_45;
v13 += DestinationString.Length;
}
if( !v13 )
{
v11 = -1073741811;
goto LABEL_45;
}
v2 = Tag;
v16 = v13 + 2;
if( (unsigned int)v16 >= 0xFFFF )
{
v11 = -2147483643;
goto LABEL_46;
}
PoolWithTag = ExAllocatePoolWithTag(PagedPool, 2 * v16, Tag);
v10 = PoolWithTag;
if( !PoolWithTag )
{
v11 = -1073741670;
goto LABEL_45;
}
memset((INT64)PoolWithTag, 0i64);
if( BufferLength )
{
v11 = IoGetDeviceProperty(DeviceObject, DevicePropertyDeviceDescription, BufferLength, v10, &BufferLength);
if( v11 < 0 )
goto LABEL_45;
*v6 = 0i64;
v18 = 0x7FFFi64;
v19 = v10;
do
{
if( !*v19 )
break;
++v19;
--v18;
}
while( v18 );
v20 = v18 == 0 ? 0xC000000D : 0;
if( v18 )
{
if( v6 )
{
v6->Buffer = (wchar_t *)v10;
v6->Length = 2 * (v18 != 0 ? 0x7FFF - v18 : 0);
}
else
{
v20 = -1073741811;
}
}
v6->MaximumLength = v16;
v11 = v20;
if( v20 < 0 )
goto LABEL_45;
RtlUnicodeStringCatString(v6, (PWCHAR)L" (");
v11 = v21;
}
else
{
*v6 = 0i64;
v22 = 0x7FFFi64;
v23 = v10;
do
{
if( !*v23 )
break;
++v23;
--v22;
}
while( v22 );
if( v22 && v6 )
{
v6->Buffer = (wchar_t *)v10;
v6->Length = 2 * (v22 != 0 ? 0x7FFF - v22 : 0);
}
v6->MaximumLength = v16;
v11 = 0;
}
if( v11 >= 0 )
{
v11 = RtlUnicodeStringCat(v6, v9 + 8);
if( v11 >= 0 )
{
if( BufferLength )
{
RtlUnicodeStringCatString(v6, (PWCHAR)L")");
v11 = v24;
}
if( v11 >= 0 )
{
if( v7 )
v11 = RtlUnicodeStringCat(v6, &DestinationString);
if( v11 >= 0 )
{
v11 = 0;
LABEL_44:
v10 = 0i64;
if( v11 >= 0 )
return(unsigned int)v11;
}
}
}
}
LABEL_45:
v2 = Tag;
LABEL_46:
*v6 = 0i64;
if( v10 )
CmpFreeTransientPoolWithTag(v10, v2);
return(unsigned int)v11;
}Referenced by:
SleepstudyHelperCreateBlockerFromComponent
SleepstudyHelperCreateBlockerFromDevice
SleepstudyHelper_GetPdoFriendlyName