NormBuffer__Insert

NTSTATUS __stdcall NormBuffer__Insert(_RTL_NORM_BUFFER *pNormBuffer, INT64 cInsert, WCHAR *pszInsertLocation){
  WCHAR *v3; 
  WCHAR *v6; 
  int v7; 
  NTSTATUS result; 
  char v9; 
  WCHAR v10; 

  v3 = (WCHAR *)*((_QWORD *)pNormBuffer + 5);
  v6 = (WCHAR *)*((_QWORD *)pNormBuffer + 8);
  if( (int)cInsert < 0x10000 )
  {
    if( (unsigned __int64)v3 < *((_QWORD *)pNormBuffer + 4) )
    {
      while( pszInsertLocation != v3 )
      {
        v10 = *pszInsertLocation;
        *pszInsertLocation = cInsert;
        LOWORD(cInsert) = v10;
        ++pszInsertLocation;
      }
      *v3 = cInsert;
      result = (_DWORD)v3 + 2;
      *((_QWORD *)pNormBuffer + 5) = v3 + 1;
      if( v6 == v3 - 1 )
        *((_QWORD *)pNormBuffer + 8) = v3;
      LOBYTE(result) = 1;
    }
    else
    {
      LOBYTE(result) = 0;
    }
  }
  else
  {
    v7 = ((int)cInsert - 0x10000) / 1024;
    result = NormBuffer__Insert(
               pNormBuffer,
               (unsigned __int16)(((int)cInsert - 0x10000) % 1024 - 9216),
               pszInsertLocation);
    v9 = 0;
    if( (_BYTE)result )
    {
      result = NormBuffer__Insert(pNormBuffer, (unsigned __int16)(v7 - 10240), pszInsertLocation);
      if( (_BYTE)result )
        v9 = 1;
    }
    LOBYTE(result) = v9;
  }
  return result;
}

Referenced by:

NormBuffer__AppendAndSortDecomposed
NormBuffer__Insert
Normalization__NormalizeCharacter