PopDirectedDripsDiagCreateDeviceDescription

NTSTATUS __stdcall PopDirectedDripsDiagCreateDeviceDescription(INT64 a1, INT64 a2){
  int DeviceFriendlyName; 
  NTSTATUS DevicePropertyString; 
  unsigned int v6; 
  unsigned int v7; 
  __int64 v8; 

  *(_QWORD *)(a2 + 32) = *(_QWORD *)(a1 + 32);
  DeviceFriendlyName = PopGenerateDeviceFriendlyName(a1, (_UNICODE_STRING *)(a2 + 48));
  if( DeviceFriendlyName >= 0 )
  {
    DevicePropertyString = PopDiagQueryDevicePropertyString(*(PDEVICE_OBJECT *)(a1 + 32), 1);
    DeviceFriendlyName = DevicePropertyString;
    if( DevicePropertyString < 0 )
    {
      if( DevicePropertyString != -1073741772 )
        return DeviceFriendlyName;
    }
    else
    {
      v6 = 0;
      v7 = *(unsigned __int16 *)(a2 + 64) >> 1;
      if( v7 > 2 )
      {
        do
        {
          v8 = *(_QWORD *)(a2 + 72);
          if( !*(_WORD *)(v8 + 2i64 * v6) )
            *(_WORD *)(v8 + 2i64 * v6) = 44;
          ++v6;
        }
        while( v6 + 2 < v7 );
      }
    }
    DeviceFriendlyName = PopDiagQueryDevicePropertyString(*(PDEVICE_OBJECT *)(a1 + 32), 5);
    if( (int)(DeviceFriendlyName + 0x80000000) < 0 || DeviceFriendlyName == -1073741772 )
    {
      DeviceFriendlyName = PopDiagQueryDevicePropertyString(*(PDEVICE_OBJECT *)(a1 + 32), 6);
      if( ((DeviceFriendlyName + 0x80000000) & 0x80000000) != 0 || DeviceFriendlyName == -1073741772 )
      {
        DeviceFriendlyName = PopCloneUnicodeString((PCUNICODE_STRING)(a1 + 40), (PUNICODE_STRING)(a2 + 112));
        if( DeviceFriendlyName >= 0 )
        {
          DeviceFriendlyName = PopCloneUnicodeString((PCUNICODE_STRING)(a1 + 56), (PUNICODE_STRING)(a2 + 128));
          if( DeviceFriendlyName >= 0 )
            return 0;
        }
      }
    }
  }
  return DeviceFriendlyName;
}

Referenced by:

PopDirectedDripsDiagCreateDeviceDiagnostic