RtlCompressBufferLZNT1

NTSTATUS __stdcall RtlCompressBufferLZNT1(
        UINT16 Engine,
        UINT8 *UncompressedBuffer,
        UINT64 UncompressedBufferSize,
        UINT8 *CompressedBuffer,
        UINT64 CompressedBufferSize,
        UINT64 UncompressedChunkSize,
        UINT64 *FinalCompressedSize,
        VOID *WorkSpace){
  char *v8; 
  UINT8 *v9; 
  UINT8 *v10; 
  int v11; 
  char v12; 
  __int64(__fastcall *v13)(char *, __int64); 
  UINT8 *v14; 
  VOID *v15; 
  NTSTATUS result; 
  unsigned int v17; 

  v8 = (char *)UncompressedBuffer;
  v9 = &UncompressedBuffer[(unsigned int)UncompressedBufferSize];
  v17 = 0;
  v10 = &CompressedBuffer[(unsigned int)CompressedBufferSize];
  v11 = (int)CompressedBuffer;
  v12 = 1;
  if( Engine )
  {
    if( Engine != 256 )
      return -1073741637;
    v13 = LZNT1FindMatchMaximum;
  }
  else
  {
    v13 = (__int64(__fastcall *)(char *, __int64))LZNT1FindMatchStandard;
  }
  v14 = CompressedBuffer;
  if( UncompressedBuffer >= v9 )
  {
LABEL_9:
    if( v14 <= v10 - 2 )
      *(_WORD *)v14 = 0;
    *(_DWORD *)FinalCompressedSize = (_DWORD)v14 - v11;
    return v12 != 0 ? 0x117 : 0;
  }
  else
  {
    v15 = WorkSpace;
    while( 1 )
    {
      result = LZNT1CompressChunk(v13, v8, (unsigned __int64)v9, v14, (unsigned __int64)v10, (int *)&v17, (__int64)v15);
      if( result < 0 )
        break;
      if( !v12 || (v12 = 1, result != 279) )
        v12 = 0;
      v8 += 4096;
      v14 += v17;
      if( v8 >= (char *)v9 )
        goto LABEL_9;
    }
  }
  return result;
}

Referenced by:

No references.