CmpFreeAllMemory

VOID __stdcall CmpFreeAllMemory(){
  unsigned int v0; 
  char v1; 
  _CMHIVE *NextActiveHive; 
  int v3; 
  int v4; 
  __int64 v5; 
  __int64 *v6; 
  __int64 v7; 
  __int64 i; 
  char v9; 
  _QWORD *v10; 
  _QWORD *j; 
  char v12; 
  UINT64 Count; 
  KAPC_STATE ApcState; 
  memset(&ApcState, 0, sizeof(ApcState));
  v0 = 0;
  v1 = 0;
  NextActiveHive = CmpGetNextActiveHive(0i64);
  if( NextActiveHive )
  {
    do
    {
      v3 = *((_DWORD *)NextActiveHive + 412);
      v4 = 0;
      v5 = *((_QWORD *)NextActiveHive + 205);
      LODWORD(Count) = 0;
      if( v3 > 0 )
      {
        v6 = (__int64 *)(v5 + 16);
        v7 = (unsigned int)v3;
        do
        {
          for( i = *v6; i; i = *(_QWORD *)(i + 8) )
          {
            v9 = v1;
            if( !v1 )
              v9 = 1;
            v1 = v9;
            CmpDumpKeyBodyList((_CM_KEY_CONTROL_BLOCK *)(i - 16), &Count, 0i64);
          }
          v6 += 3;
          --v7;
        }
        while( v7 );
        v4 = Count;
      }
      v10 = (_QWORD *)*((_QWORD *)NextActiveHive + 198);
      v0 += v4;
      v1 = 0;
      while( v10 )
      {
        for( j = (_QWORD *)v10[2]; j != v10 + 2; j = (_QWORD *)*j )
        {
          if( j[6] )
          {
            v12 = v1;
            if( !v1 )
              v12 = 1;
            v1 = v12;
          }
        }
        v10 = (_QWORD *)*v10;
      }
      CmpAttachToRegistryProcess(&ApcState);
      CmpDestroyHive(NextActiveHive);
      CmpDetachFromRegistryProcess(&ApcState);
      NextActiveHive = CmpGetNextActiveHive(NextActiveHive);
    }
    while( NextActiveHive );
    if( v0 )
      KeBugCheckEx(0x51u, 0xFui64, 1ui64, v0, 0i64);
  }
  ExFreePoolWithTag(CmpNameCacheTable, 0);
}

Referenced by:

CmShutdownSystem