WmipTranslateFileHandle

__int64 __fastcall WmipTranslateFileHandle(__int64 a1, unsigned int *a2){
  void *v4; 
  int FilePDO; 
  void *v6; 
  unsigned __int16 Length; 
  unsigned int v8; 
  wchar_t *Buffer; 
  struct _UNICODE_STRING UnicodeString; 
  int v12; 
  PVOID Object; 
  PADAPTER_OBJECT DmaAdapter; 
  v12 = 0;
  *(_QWORD *)&UnicodeString.Length = 0i64;
  v4 = *(void **)a1;
  DmaAdapter = 0i64;
  UnicodeString.Buffer = 0i64;
  FilePDO = WmipGetFilePDO(v4, 1, (DEVICE_OBJECT **)&DmaAdapter);
  if( FilePDO < 0 )
    return(unsigned int)FilePDO;
  v6 = *(void **)(a1 + 8);
  Object = 0i64;
  FilePDO = ObReferenceObjectByHandle(v6, 1u, WmipGuidObjectType, 1, &Object, 0i64);
  if( FilePDO >= 0 )
  {
    FilePDO = WmipGetGuidObjectInstanceInfo((__int64)Object, (ULONG_PTR)DmaAdapter, &UnicodeString, &v12);
    if( FilePDO < 0 )
    {
LABEL_12:
      if( Object )
        HalPutDmaAdapter((PADAPTER_OBJECT)Object);
      goto LABEL_14;
    }
    Length = UnicodeString.Length;
    v8 = UnicodeString.Length + 26;
    if( *a2 >= v8 )
    {
      Buffer = UnicodeString.Buffer;
      *(_DWORD *)(a1 + 16) = v12;
      *(_WORD *)(a1 + 20) = Length + 4;
      memmove((UINT8 *)(a1 + 22), (UINT8 *)Buffer, Length);
      *a2 = v8;
      *(_DWORD *)(a1 + 2 * ((unsigned __int64)Length >> 1) + 22) = 0;
    }
    else
    {
      if( *a2 < 4 )
      {
        FilePDO = -1073741823;
        goto LABEL_10;
      }
      *(_DWORD *)a1 = v8;
      *a2 = 4;
    }
    FilePDO = 0;
LABEL_10:
    if( UnicodeString.Buffer )
      RtlFreeAnsiString(&UnicodeString);
    goto LABEL_12;
  }
LABEL_14:
  if( DmaAdapter )
    HalPutDmaAdapter(DmaAdapter);
  return(unsigned int)FilePDO;
}

Referenced by:

WmipIoControl