PiSwFindSwDevice

_PI_SWD_OBJECT *__stdcall PiSwFindSwDevice(WCHAR *DeviceInstanceId){
  _PI_SWD_OBJECT *v2; 
  WORD *v4; 
  _PI_SWD_OBJECT **v5; 
  __int64 *Buffer; 
  __int64 v7[26]; 
  WCHAR pszDest[5]; 
  __int16 Str[195]; 

  memset(v7, 0i64, sizeof(v7));
  Buffer = v7;
  v2 = 0i64;
  if( !wcsnicmp(DeviceInstanceId, L"SWD\\", 4u) && RtlStringCbCopyW(pszDest, 0x190ui64, DeviceInstanceId) >= 0 )
  {
    v7[1] = (__int64)pszDest;
    v4 = wcschr((WORD *)Str, 92);
    if( v4 )
    {
      *v4 = 0;
      v7[2] = (__int64)(v4 + 1);
      v5 = (_PI_SWD_OBJECT **)RtlLookupElementGenericTableAvl(&PiSwDeviceInstanceTable, &Buffer);
      if( v5 )
        return *v5;
    }
  }
  return v2;
}

Referenced by:

PiSwIrpCleanup
PiSwProcessParentRemoveIrp