PiSwUpdateArrayProperties

NTSTATUS __stdcall PiSwUpdateArrayProperties(
        _DEVPROPERTY *Properties,
        UINT64 PropertyCount,
        _DEVPROPERTY *NewProperties,
        UINT64 NewPropertyCount){
  int v4; 
  NTSTATUS v5; 
  _DEVPROPERTY *v6; 
  unsigned int v7; 
  int v9; 
  unsigned int v10; 
  ULONG *i; 
  unsigned int v12; 
  DEVPROPSTORE *p_Store; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  const wchar_t *v17; 
  const wchar_t *v18; 
  ULONG BufferSize; 
  PVOID Buffer; 
  VOID **PoolWithTag; 
  unsigned int v23; 
  unsigned int v25; 

  v25 = NewPropertyCount;
  v23 = PropertyCount;
  v4 = NewPropertyCount;
  v5 = 0;
  v6 = NewProperties;
  v7 = PropertyCount;
  v9 = 0;
  if( !v4 )
    return v5;
  v10 = v25;
  for( i = &v6->BufferSize; ; i += 12 )
  {
    v12 = 0;
    if( v7 )
      break;
LABEL_18:
    if( ++v9 >= v10 )
      return v5;
    v6 = NewProperties;
  }
  p_Store = &Properties->CompKey.Store;
  while( 1 )
  {
    if( *(i - 5) == *((_DWORD *)p_Store - 1) )
    {
      v14 = v12;
      v15 = v12;
      v16 = *(_QWORD *)&v6[v9].CompKey.Key.fmtid.Data1 - *(_QWORD *)&Properties[v15].CompKey.Key.fmtid.Data1;
      if( !v16 )
        v16 = *(_QWORD *)v6[v9].CompKey.Key.fmtid.Data4 - *(_QWORD *)Properties[v15].CompKey.Key.fmtid.Data4;
      if( !v16 && *(i - 4) == *p_Store )
      {
        v17 = *(const wchar_t **)(i - 3);
        v18 = *(const wchar_t **)(p_Store + 1);
        if( v17 == v18 )
          goto LABEL_13;
        if( v17 && v18 )
          break;
      }
    }
LABEL_6:
    ++v12;
    p_Store += 12;
    if( v12 >= v7 )
      goto LABEL_17;
  }
  if( wcsicmp(v17, v18) )
  {
    v7 = v23;
    v6 = NewProperties;
    goto LABEL_6;
  }
LABEL_13:
  BufferSize = Properties[v15].BufferSize;
  if( *i == BufferSize )
  {
LABEL_14:
    Properties[v15].Type = *(i - 1);
    if( BufferSize )
      memmove(Properties[v15].Buffer, *(const VOID **)(i + 1), BufferSize);
    v7 = v23;
LABEL_17:
    v10 = v25;
    goto LABEL_18;
  }
  Buffer = Properties[v15].Buffer;
  Properties[v15].Buffer = 0i64;
  if( !*i
    || (PoolWithTag = ExAllocatePoolWithTag(1ui64, *i, 1466986064i64), (Properties[v15].Buffer = PoolWithTag) != 0i64) )
  {
    if( Buffer )
      ExFreePoolWithTag(Buffer, 0x57706E50u);
    BufferSize = *i;
    Properties[v15].BufferSize = *i;
    goto LABEL_14;
  }
  v5 = -1073741670;
  Properties[v14].Buffer = Buffer;
  return v5;
}

Referenced by:

PiSwIrpInterfacePropertySet
PiSwIrpInterfaceRegister
PiSwIrpPropertySet