WmipAddProviderIdToPIList

NTSTATUS __stdcall WmipAddProviderIdToPIList(
        tagInstanceSet ***PIPtrPtr,
        UINT64 *PICountPtr,
        UINT64 *PIMaxPtr,
        tagInstanceSet **StaticPIPtr,
        tagInstanceSet *InstanceSet){
  __int64 v5; 
  NTSTATUS v6; 
  __int64 v7; 
  tagInstanceSet **v8; 
  tagInstanceSet *v9; 
  unsigned int v11; 
  __int64 v12; 
  VOID **PoolWithTag; 
  tagInstanceSet **v14; 
  volatile signed __int64 **v15; 
  UINT64 *v17; 

  v17 = PICountPtr;
  v5 = *(unsigned int *)PICountPtr;
  v6 = 0;
  v7 = *(unsigned int *)PIMaxPtr;
  v8 = *PIPtrPtr;
  v9 = InstanceSet;
  if( (_DWORD)v5 != (_DWORD)v7 )
    goto LABEL_2;
  v11 = 2 * v7;
  v12 = *(unsigned int *)PIMaxPtr;
  if( (unsigned __int64)(2 * v7) > 0xFFFFFFFF )
  {
    v11 = -1;
    v6 = -1073741675;
    PoolWithTag = 0i64;
  }
  else
  {
    PoolWithTag = ExAllocatePoolWithTag(1ui64, 8i64 * v11, 1885957463i64);
  }
  v14 = v8;
  if( PoolWithTag )
  {
    memmove(PoolWithTag, v8, 8 * v7);
    v8 = (tagInstanceSet **)PoolWithTag;
    *(_DWORD *)PIMaxPtr = v11;
  }
  else
  {
    if( (_DWORD)v7 )
    {
      v15 = (volatile signed __int64 **)v8;
      do
      {
        WmipUnreferenceEntry((__int64)&stru_140C00F40 + 4496, *v15++);
        --v12;
      }
      while( v12 );
    }
    WmipUnreferenceEntry((__int64)&stru_140C00F40 + 4496, (volatile signed __int64 *)InstanceSet);
    PoolWithTag = 0i64;
    v6 = -1073741670;
  }
  *PIPtrPtr = (tagInstanceSet **)PoolWithTag;
  if( v14 != StaticPIPtr )
    ExFreePoolWithTag(v14, 0);
  if( v6 >= 0 )
  {
    v9 = InstanceSet;
    PICountPtr = v17;
LABEL_2:
    v8[v5] = v9;
    *(_DWORD *)PICountPtr = v5 + 1;
  }
  return v6;
}

Referenced by:

WmipPrepareForWnodeAD
WmipPrepareWnodeSI