BiGetDeviceFromEfiPath

INT64 __fastcall BiGetDeviceFromEfiPath(UINT8 *Src, INT64 a2, _DWORD *a3){
  UINT8 v3; 
  unsigned int v6; 
  UINT8 *i; 
  unsigned int v8; 
  _FILE_PATH *PoolWithTag; 
  _FILE_PATH *v10; 
  NTSTATUS v11; 
  UINT8 *v12; 
  unsigned int v13; 
  UINT8 *v14; 
  UINT8 *v15; 
  _QWORD *v16; 
  PVOID P; 
  INT64 v19; 
  v19 = a2;
  v3 = *Src;
  P = 0i64;
  if( (v3 & 0x7F) == 127 )
  {
    return(unsigned int)-1073741766;
  }
  else
  {
    for( i = &Src[*((unsigned __int16 *)Src + 1)];
          (*i & 0x7F) != 127 && (*i != 4 || i[1] != 4);
          i += *((unsigned __int16 *)i + 1) )
    {
      ;
    }
    v8 = (_DWORD)i - (_DWORD)Src;
    PoolWithTag = (_FILE_PATH *)ExAllocatePoolWithTag(PagedPool, v8 + 16, 0x4B444342ui64);
    v10 = PoolWithTag;
    if( PoolWithTag )
    {
      PoolWithTag->Version = 1;
      PoolWithTag->Length = v8 + 16;
      PoolWithTag->Type = 4;
      memmove((UINT8 *)PoolWithTag->FilePath, Src, v8);
      *(_DWORD *)&v10->FilePath[v8] = 327551;
      v11 = BiTranslateFilePath(v10, 3ui64, (_FILE_PATH **)&P);
      v12 = (UINT8 *)P;
      v6 = v11;
      if( v11 >= 0 )
      {
        v13 = *((_DWORD *)P + 1) - 12;
        v14 = (UINT8 *)ExAllocatePoolWithTag(PagedPool, v13 + 20, 0x4B444342ui64);
        v15 = v14;
        if( v14 )
        {
          memset((INT64)v14, 0i64);
          *(_DWORD *)v15 = 2;
          memmove(v15 + 20, v12 + 12, v13);
          v16 = (_QWORD *)v19;
          *a3 = v13 + 20;
          *v16 = v15;
        }
        else
        {
          v6 = -1073741670;
        }
      }
      if( v12 )
        ExFreePoolWithTag(v12, 0x4B444342u);
      ExFreePoolWithTag(v10, 0x4B444342u);
    }
    else
    {
      return(unsigned int)-1073741670;
    }
  }
  return v6;
}

Referenced by:

BiCreateMergedBootEntry
BiUpdateBcdObject