PopFxFindAcpiDeviceByUniqueId

__int64 __fastcall PopFxFindAcpiDeviceByUniqueId(PCUNICODE_STRING String2, __int64 **a2){
  _ETHREAD *CurrentThread; 
  __int64 *v5; 
  NTSTATUS v6; 
  __int64 *i; 
  CurrentThread = (_ETHREAD *)KeGetCurrentThread();
  v5 = 0i64;
  v6 = -1073741275;
  --*((_WORD *)CurrentThread + 242);
  ExAcquirePushLockSharedEx((UINT64)&PopFxDeviceListLock, 0i64);
  for( i = (__int64 *)PopFxAcpiDeviceList; i != &PopFxAcpiDeviceList; i = (__int64 *)*i )
  {
    v5 = i - 25;
    if( i[3] && !(unsigned int)RtlCompareUnicodeString((const UNICODE_STRING *)(v5 + 27), String2, 0) )
    {
      if( a2 )
        v6 = IoAcquireRemoveLockEx((PIO_REMOVE_LOCK)(v5 + 34), (PVOID)0x66466F50, (PCSTR)File, 1u, 0x20u);
      else
        v6 = 0;
      break;
    }
  }
  if( _InterlockedCompareExchange64((volatile signed __int64 *)&PopFxDeviceListLock, 0i64, 17i64) != 17 )
    ExfReleasePushLockShared((INT64 *)&PopFxDeviceListLock);
  KeAbPostRelease(&PopFxDeviceListLock);
  KeLeaveCriticalRegionThread((__int64)KeGetCurrentThread());
  if( v6 >= 0 && a2 )
    *a2 = v5;
  return(unsigned int)v6;
}

Referenced by:

PopFxAcpiPrepareDevice
PopFxFindDeviceAndAllocateUniqueId
PopFxRegisterDeviceWorker