mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Added compression functions (not usabel yet).
svn path=/trunk/; revision=3301
This commit is contained in:
parent
a79a9cbba6
commit
9a04ad5955
7 changed files with 333 additions and 66 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: rtl.h,v 1.61 2002/06/05 16:49:56 ekohl Exp $
|
/* $Id: rtl.h,v 1.62 2002/07/25 13:15:08 ekohl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -605,25 +605,35 @@ RtlCompareUnicodeString (
|
||||||
BOOLEAN BaseInsensitive
|
BOOLEAN BaseInsensitive
|
||||||
);
|
);
|
||||||
|
|
||||||
LARGE_INTEGER
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlCompressBuffer(IN USHORT CompressionFormatAndEngine,
|
||||||
RtlConvertLongToLargeInteger (
|
IN PUCHAR UncompressedBuffer,
|
||||||
IN LONG SignedInteger
|
IN ULONG UncompressedBufferSize,
|
||||||
);
|
OUT PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN ULONG UncompressedChunkSize,
|
||||||
|
OUT PULONG FinalCompressedSize,
|
||||||
|
IN PVOID WorkSpace);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlCompressChunks(IN PUCHAR UncompressedBuffer,
|
||||||
RtlConvertSidToUnicodeString (
|
IN ULONG UncompressedBufferSize,
|
||||||
IN OUT PUNICODE_STRING String,
|
OUT PUCHAR CompressedBuffer,
|
||||||
IN PSID Sid,
|
IN ULONG CompressedBufferSize,
|
||||||
IN BOOLEAN AllocateString
|
IN OUT PCOMPRESSED_DATA_INFO CompressedDataInfo,
|
||||||
);
|
IN ULONG CompressedDataInfoLength,
|
||||||
|
IN PVOID WorkSpace);
|
||||||
|
|
||||||
LARGE_INTEGER
|
LARGE_INTEGER STDCALL
|
||||||
STDCALL
|
RtlConvertLongToLargeInteger(IN LONG SignedInteger);
|
||||||
RtlConvertUlongToLargeInteger (
|
|
||||||
IN ULONG UnsignedInteger
|
NTSTATUS STDCALL
|
||||||
);
|
RtlConvertSidToUnicodeString(IN OUT PUNICODE_STRING String,
|
||||||
|
IN PSID Sid,
|
||||||
|
IN BOOLEAN AllocateString);
|
||||||
|
|
||||||
|
LARGE_INTEGER STDCALL
|
||||||
|
RtlConvertUlongToLargeInteger(IN ULONG UnsignedInteger);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
VOID
|
VOID
|
||||||
|
@ -721,32 +731,54 @@ RtlCustomCPToUnicodeN (
|
||||||
ULONG CustomSize
|
ULONG CustomSize
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlDecompressBuffer(IN USHORT CompressionFormat,
|
||||||
RtlDeleteAtomFromAtomTable (
|
OUT PUCHAR UncompressedBuffer,
|
||||||
IN PRTL_ATOM_TABLE AtomTable,
|
IN ULONG UncompressedBufferSize,
|
||||||
IN RTL_ATOM Atom
|
IN PUCHAR CompressedBuffer,
|
||||||
);
|
IN ULONG CompressedBufferSize,
|
||||||
|
OUT PULONG FinalUncompressedSize);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlDecompressChunks(OUT PUCHAR UncompressedBuffer,
|
||||||
RtlDeleteRegistryValue (
|
IN ULONG UncompressedBufferSize,
|
||||||
ULONG RelativeTo,
|
IN PUCHAR CompressedBuffer,
|
||||||
PWSTR Path,
|
IN ULONG CompressedBufferSize,
|
||||||
PWSTR ValueName
|
IN PUCHAR CompressedTail,
|
||||||
);
|
IN ULONG CompressedTailSize,
|
||||||
|
IN PCOMPRESSED_DATA_INFO CompressedDataInfo);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlDecompressFragment(IN USHORT CompressionFormat,
|
||||||
RtlDestroyAtomTable (
|
OUT PUCHAR UncompressedFragment,
|
||||||
IN PRTL_ATOM_TABLE AtomTable
|
IN ULONG UncompressedFragmentSize,
|
||||||
);
|
IN PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN ULONG FragmentOffset,
|
||||||
|
OUT PULONG FinalUncompressedSize,
|
||||||
|
IN PVOID WorkSpace);
|
||||||
|
|
||||||
BOOL
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlDeleteAtomFromAtomTable(IN PRTL_ATOM_TABLE AtomTable,
|
||||||
RtlDestroyHeap (
|
IN RTL_ATOM Atom);
|
||||||
HANDLE hheap
|
|
||||||
);
|
NTSTATUS STDCALL
|
||||||
|
RtlDeleteRegistryValue(IN ULONG RelativeTo,
|
||||||
|
IN PWSTR Path,
|
||||||
|
IN PWSTR ValueName);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDescribeChunk(IN USHORT CompressionFormat,
|
||||||
|
IN OUT PUCHAR *CompressedBuffer,
|
||||||
|
IN PUCHAR EndOfCompressedBufferPlus1,
|
||||||
|
OUT PUCHAR *ChunkBuffer,
|
||||||
|
OUT PULONG ChunkSize);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDestroyAtomTable(IN PRTL_ATOM_TABLE AtomTable);
|
||||||
|
|
||||||
|
BOOL STDCALL
|
||||||
|
RtlDestroyHeap(HANDLE hheap);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -957,6 +989,11 @@ RtlGetCallersAddress (
|
||||||
PVOID * CallersAddress
|
PVOID * CallersAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlGetCompressionWorkSpaceSize(IN USHORT CompressionFormatAndEngine,
|
||||||
|
OUT PULONG CompressBufferAndWorkSpaceSize,
|
||||||
|
OUT PULONG CompressFragmentWorkSpaceSize);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
RtlGetDefaultCodePage (
|
RtlGetDefaultCodePage (
|
||||||
|
@ -1442,6 +1479,13 @@ RtlReAllocateHeap (
|
||||||
DWORD size
|
DWORD size
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlReserveChunk(IN USHORT CompressionFormat,
|
||||||
|
IN OUT PUCHAR *CompressedBuffer,
|
||||||
|
IN PUCHAR EndOfCompressedBufferPlus1,
|
||||||
|
OUT PUCHAR *ChunkBuffer,
|
||||||
|
IN ULONG ChunkSize);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VOID
|
* VOID
|
||||||
* RtlRetrieveUlong (
|
* RtlRetrieveUlong (
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
/* $Id: rtltypes.h,v 1.2 2002/06/05 16:49:57 ekohl Exp $
|
/* $Id: rtltypes.h,v 1.3 2002/07/25 13:15:08 ekohl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __DDK_RTLTYPES_H
|
#ifndef __DDK_RTLTYPES_H
|
||||||
#define __DDK_RTLTYPES_H
|
#define __DDK_RTLTYPES_H
|
||||||
|
|
||||||
|
|
||||||
|
#define COMPRESSION_FORMAT_NONE 0x0000
|
||||||
|
#define COMPRESSION_FORMAT_DEFAULT 0x0001
|
||||||
|
#define COMPRESSION_FORMAT_LZNT1 0x0002
|
||||||
|
|
||||||
|
#define COMPRESSION_ENGINE_STANDARD 0x0000
|
||||||
|
#define COMPRESSION_ENGINE_MAXIMUM 0x0100
|
||||||
|
#define COMPRESSION_ENGINE_HIBER 0x0200
|
||||||
|
|
||||||
|
|
||||||
typedef struct _INITIAL_TEB
|
typedef struct _INITIAL_TEB
|
||||||
{
|
{
|
||||||
ULONG StackCommit;
|
ULONG StackCommit;
|
||||||
|
@ -181,4 +191,16 @@ typedef struct _GENERATE_NAME_CONTEXT
|
||||||
ULONG LastIndexValue;
|
ULONG LastIndexValue;
|
||||||
} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
|
} GENERATE_NAME_CONTEXT, *PGENERATE_NAME_CONTEXT;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _COMPRESSED_DATA_INFO
|
||||||
|
{
|
||||||
|
USHORT CompressionFormatAndEngine;
|
||||||
|
UCHAR CompressionUnitShift;
|
||||||
|
UCHAR ChunkShift;
|
||||||
|
UCHAR ClusterShift;
|
||||||
|
UCHAR Reserved;
|
||||||
|
USHORT NumberOfChunks;
|
||||||
|
ULONG CompressedChunkSizes[1];
|
||||||
|
} COMPRESSED_DATA_INFO, *PCOMPRESSED_DATA_INFO;
|
||||||
|
|
||||||
#endif /* __DDK_RTLTYPES_H */
|
#endif /* __DDK_RTLTYPES_H */
|
||||||
|
|
|
@ -3850,11 +3850,6 @@ extern "C" {
|
||||||
#define PROCESSOR_MIPS_R4000 (4000)
|
#define PROCESSOR_MIPS_R4000 (4000)
|
||||||
#define PROCESSOR_ALPHA_21064 (21064)
|
#define PROCESSOR_ALPHA_21064 (21064)
|
||||||
|
|
||||||
/* FSCTL_SET_COMPRESSION */
|
|
||||||
#define COMPRESSION_FORMAT_NONE (0)
|
|
||||||
#define COMPRESSION_FORMAT_DEFAULT (1)
|
|
||||||
#define COMPRESSION_FORMAT_LZNT1 (2)
|
|
||||||
|
|
||||||
/* TAPE_GET_DRIVE_PARAMETERS structure */
|
/* TAPE_GET_DRIVE_PARAMETERS structure */
|
||||||
#define TAPE_DRIVE_COMPRESSION (131072)
|
#define TAPE_DRIVE_COMPRESSION (131072)
|
||||||
#define TAPE_DRIVE_ECC (65536)
|
#define TAPE_DRIVE_ECC (65536)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.77 2002/07/20 21:49:35 dwelch Exp $
|
# $Id: Makefile,v 1.78 2002/07/25 13:18:31 ekohl Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -83,6 +83,7 @@ OBJECTS_NT = \
|
||||||
OBJECTS_RTL = \
|
OBJECTS_RTL = \
|
||||||
rtl/atom.o \
|
rtl/atom.o \
|
||||||
rtl/bitmap.o \
|
rtl/bitmap.o \
|
||||||
|
rtl/compress.o \
|
||||||
rtl/ctype.o \
|
rtl/ctype.o \
|
||||||
rtl/dos8dot3.o \
|
rtl/dos8dot3.o \
|
||||||
rtl/error.o \
|
rtl/error.o \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.def,v 1.137 2002/07/18 21:49:59 ei Exp $
|
; $Id: ntoskrnl.def,v 1.138 2002/07/25 13:18:31 ekohl Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -676,8 +676,8 @@ RtlCompareMemory@12
|
||||||
RtlCompareMemoryUlong@12
|
RtlCompareMemoryUlong@12
|
||||||
RtlCompareString@12
|
RtlCompareString@12
|
||||||
RtlCompareUnicodeString@12
|
RtlCompareUnicodeString@12
|
||||||
;RtlCompressBuffer
|
RtlCompressBuffer@32
|
||||||
;RtlCompressChunks
|
RtlCompressChunks@28
|
||||||
RtlConvertLongToLargeInteger@4
|
RtlConvertLongToLargeInteger@4
|
||||||
RtlConvertSidToUnicodeString@12
|
RtlConvertSidToUnicodeString@12
|
||||||
RtlConvertUlongToLargeInteger@4
|
RtlConvertUlongToLargeInteger@4
|
||||||
|
@ -692,15 +692,15 @@ RtlCreateRegistryKey@8
|
||||||
RtlCreateSecurityDescriptor@8
|
RtlCreateSecurityDescriptor@8
|
||||||
RtlCreateUnicodeString@8
|
RtlCreateUnicodeString@8
|
||||||
RtlCustomCPToUnicodeN@24
|
RtlCustomCPToUnicodeN@24
|
||||||
;RtlDecompressBuffer
|
RtlDecompressBuffer@24
|
||||||
;RtlDecompressChunks
|
RtlDecompressChunks@28
|
||||||
;RtlDecompressFragment
|
RtlDecompressFragment@32
|
||||||
;RtlDelete
|
;RtlDelete
|
||||||
RtlDeleteAtomFromAtomTable@8
|
RtlDeleteAtomFromAtomTable@8
|
||||||
;RtlDeleteElementGenericTable
|
;RtlDeleteElementGenericTable
|
||||||
;RtlDeleteNoSplay
|
;RtlDeleteNoSplay
|
||||||
RtlDeleteRegistryValue@12
|
RtlDeleteRegistryValue@12
|
||||||
;RtlDescribeChunk
|
RtlDescribeChunk@20
|
||||||
RtlDestroyAtomTable@4
|
RtlDestroyAtomTable@4
|
||||||
;RtlDestroyHeap
|
;RtlDestroyHeap
|
||||||
RtlDowncaseUnicodeString@12
|
RtlDowncaseUnicodeString@12
|
||||||
|
@ -736,7 +736,7 @@ RtlFreeOemString@4
|
||||||
RtlFreeUnicodeString@4
|
RtlFreeUnicodeString@4
|
||||||
RtlGenerate8dot3Name@16
|
RtlGenerate8dot3Name@16
|
||||||
;RtlGetCallersAddress
|
;RtlGetCallersAddress
|
||||||
;RtlGetCompressionWorkSpaceSize
|
RtlGetCompressionWorkSpaceSize@12
|
||||||
RtlGetDaclSecurityDescriptor@16
|
RtlGetDaclSecurityDescriptor@16
|
||||||
RtlGetDefaultCodePage@8
|
RtlGetDefaultCodePage@8
|
||||||
;RtlGetElementGenericTable
|
;RtlGetElementGenericTable
|
||||||
|
@ -791,7 +791,7 @@ RtlQueryTimeZoneInformation@4
|
||||||
RtlRaiseException@4
|
RtlRaiseException@4
|
||||||
;RtlRandom
|
;RtlRandom
|
||||||
;RtlRemoveUnicodePrefix
|
;RtlRemoveUnicodePrefix
|
||||||
;RtlReserveChunk
|
RtlReserveChunk@20
|
||||||
RtlSecondsSince1970ToTime@8
|
RtlSecondsSince1970ToTime@8
|
||||||
RtlSecondsSince1980ToTime@8
|
RtlSecondsSince1980ToTime@8
|
||||||
RtlSetAllBits@4
|
RtlSetAllBits@4
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.edf,v 1.123 2002/07/18 21:49:59 ei Exp $
|
; $Id: ntoskrnl.edf,v 1.124 2002/07/25 13:18:31 ekohl Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -676,8 +676,8 @@ RtlCompareMemory=RtlCompareMemory@12
|
||||||
RtlCompareMemoryUlong=RtlCompareMemoryUlong@12
|
RtlCompareMemoryUlong=RtlCompareMemoryUlong@12
|
||||||
RtlCompareString=RtlCompareString@12
|
RtlCompareString=RtlCompareString@12
|
||||||
RtlCompareUnicodeString=RtlCompareUnicodeString@12
|
RtlCompareUnicodeString=RtlCompareUnicodeString@12
|
||||||
;RtlCompressBuffer
|
RtlCompressBuffer=RtlCompressBuffer@32
|
||||||
;RtlCompressChunks
|
RtlCompressChunks=RtlCompressChunks@28
|
||||||
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
|
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
|
||||||
RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
|
RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
|
||||||
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
|
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
|
||||||
|
@ -692,15 +692,15 @@ RtlCreateRegistryKey=RtlCreateRegistryKey@8
|
||||||
RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
|
RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
|
||||||
RtlCreateUnicodeString=RtlCreateUnicodeString@8
|
RtlCreateUnicodeString=RtlCreateUnicodeString@8
|
||||||
RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24
|
RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24
|
||||||
;RtlDecompressBuffer
|
RtlDecompressBuffer=RtlDecompressBuffer@24
|
||||||
;RtlDecompressChunks
|
RtlDecompressChunks=RtlDecompressChunks@28
|
||||||
;RtlDecompressFragment
|
RtlDecompressFragment=RtlDecompressFragment@32
|
||||||
;RtlDelete
|
;RtlDelete
|
||||||
RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8
|
RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8
|
||||||
;RtlDeleteElementGenericTable
|
;RtlDeleteElementGenericTable
|
||||||
;RtlDeleteNoSplay
|
;RtlDeleteNoSplay
|
||||||
RtlDeleteRegistryValue=RtlDeleteRegistryValue@12
|
RtlDeleteRegistryValue=RtlDeleteRegistryValue@12
|
||||||
;RtlDescribeChunk
|
RtlDescribeChunk=RtlDescribeChunk@20
|
||||||
RtlDestroyAtomTable=RtlDestroyAtomTable@4
|
RtlDestroyAtomTable=RtlDestroyAtomTable@4
|
||||||
;RtlDestroyHeap
|
;RtlDestroyHeap
|
||||||
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
|
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
|
||||||
|
@ -736,7 +736,7 @@ RtlFreeOemString=RtlFreeOemString@4
|
||||||
RtlFreeUnicodeString=RtlFreeUnicodeString@4
|
RtlFreeUnicodeString=RtlFreeUnicodeString@4
|
||||||
RtlGenerate8dot3Name=RtlGenerate8dot3Name@16
|
RtlGenerate8dot3Name=RtlGenerate8dot3Name@16
|
||||||
;RtlGetCallersAddress
|
;RtlGetCallersAddress
|
||||||
;RtlGetCompressionWorkSpaceSize
|
RtlGetCompressionWorkSpaceSize=RtlGetCompressionWorkSpaceSize@12
|
||||||
RtlGetDaclSecurityDescriptor=RtlGetDaclSecurityDescriptor@16
|
RtlGetDaclSecurityDescriptor=RtlGetDaclSecurityDescriptor@16
|
||||||
RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
|
RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
|
||||||
;RtlGetElementGenericTable
|
;RtlGetElementGenericTable
|
||||||
|
@ -790,7 +790,7 @@ RtlQueryTimeZoneInformation=RtlQueryTimeZoneInformation@4
|
||||||
RtlRaiseException=RtlRaiseException@4
|
RtlRaiseException=RtlRaiseException@4
|
||||||
;RtlRandom
|
;RtlRandom
|
||||||
;RtlRemoveUnicodePrefix
|
;RtlRemoveUnicodePrefix
|
||||||
;RtlReserveChunk
|
RtlReserveChunk=RtlReserveChunk@20
|
||||||
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
|
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
|
||||||
RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
|
RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
|
||||||
RtlSetAllBits=RtlSetAllBits@4
|
RtlSetAllBits=RtlSetAllBits@4
|
||||||
|
|
205
reactos/ntoskrnl/rtl/compress.c
Normal file
205
reactos/ntoskrnl/rtl/compress.c
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
/*
|
||||||
|
* ReactOS kernel
|
||||||
|
* Copyright (C) 2002 ReactOS Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
/* $Id: compress.c,v 1.1 2002/07/25 13:17:28 ekohl Exp $
|
||||||
|
*
|
||||||
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
|
* PROJECT: ReactOS kernel
|
||||||
|
* PURPOSE: Compression and decompression functions
|
||||||
|
* FILE: ntoskrnl/rtl/compress.c
|
||||||
|
* PROGRAMER: Eric Kohl (ekohl@zr-online.de)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
||||||
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* MACROS *******************************************************************/
|
||||||
|
|
||||||
|
#define COMPRESSION_FORMAT_MASK 0x00FF
|
||||||
|
#define COMPRESSION_ENGINE_MASK 0xFF00
|
||||||
|
|
||||||
|
|
||||||
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
RtlpCompressBufferLZNT1(USHORT Engine,
|
||||||
|
PUCHAR UncompressedBuffer,
|
||||||
|
ULONG UncompressedBufferSize,
|
||||||
|
PUCHAR CompressedBuffer,
|
||||||
|
ULONG CompressedBufferSize,
|
||||||
|
ULONG UncompressedChunkSize,
|
||||||
|
PULONG FinalCompressedSize,
|
||||||
|
PVOID WorkSpace)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
RtlpWorkSpaceSizeLZNT1(USHORT Engine,
|
||||||
|
PULONG BufferAndWorkSpaceSize,
|
||||||
|
PULONG FragmentWorkSpaceSize)
|
||||||
|
{
|
||||||
|
if (Engine == COMPRESSION_ENGINE_STANDARD)
|
||||||
|
{
|
||||||
|
*BufferAndWorkSpaceSize = 0x8010;
|
||||||
|
*FragmentWorkSpaceSize = 0x1000;
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
else if (Engine == COMPRESSION_ENGINE_MAXIMUM)
|
||||||
|
{
|
||||||
|
*BufferAndWorkSpaceSize = 0x10;
|
||||||
|
*FragmentWorkSpaceSize = 0x1000;
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(STATUS_NOT_SUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlCompressBuffer(IN USHORT CompressionFormatAndEngine,
|
||||||
|
IN PUCHAR UncompressedBuffer,
|
||||||
|
IN ULONG UncompressedBufferSize,
|
||||||
|
OUT PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN ULONG UncompressedChunkSize,
|
||||||
|
OUT PULONG FinalCompressedSize,
|
||||||
|
IN PVOID WorkSpace)
|
||||||
|
{
|
||||||
|
USHORT Format = CompressionFormatAndEngine & COMPRESSION_FORMAT_MASK;
|
||||||
|
USHORT Engine = CompressionFormatAndEngine & COMPRESSION_ENGINE_MASK;
|
||||||
|
|
||||||
|
if ((Format == COMPRESSION_FORMAT_NONE) ||
|
||||||
|
(Format == COMPRESSION_FORMAT_DEFAULT))
|
||||||
|
return(STATUS_INVALID_PARAMETER);
|
||||||
|
|
||||||
|
if (Format == COMPRESSION_FORMAT_LZNT1)
|
||||||
|
return(RtlpCompressBufferLZNT1(Engine,
|
||||||
|
UncompressedBuffer,
|
||||||
|
UncompressedBufferSize,
|
||||||
|
CompressedBuffer,
|
||||||
|
CompressedBufferSize,
|
||||||
|
UncompressedChunkSize,
|
||||||
|
FinalCompressedSize,
|
||||||
|
WorkSpace));
|
||||||
|
|
||||||
|
return(STATUS_UNSUPPORTED_COMPRESSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlCompressChunks(IN PUCHAR UncompressedBuffer,
|
||||||
|
IN ULONG UncompressedBufferSize,
|
||||||
|
OUT PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN OUT PCOMPRESSED_DATA_INFO CompressedDataInfo,
|
||||||
|
IN ULONG CompressedDataInfoLength,
|
||||||
|
IN PVOID WorkSpace)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDecompressBuffer(IN USHORT CompressionFormat,
|
||||||
|
OUT PUCHAR UncompressedBuffer,
|
||||||
|
IN ULONG UncompressedBufferSize,
|
||||||
|
IN PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
OUT PULONG FinalUncompressedSize)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDecompressChunks(OUT PUCHAR UncompressedBuffer,
|
||||||
|
IN ULONG UncompressedBufferSize,
|
||||||
|
IN PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN PUCHAR CompressedTail,
|
||||||
|
IN ULONG CompressedTailSize,
|
||||||
|
IN PCOMPRESSED_DATA_INFO CompressedDataInfo)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDecompressFragment(IN USHORT CompressionFormat,
|
||||||
|
OUT PUCHAR UncompressedFragment,
|
||||||
|
IN ULONG UncompressedFragmentSize,
|
||||||
|
IN PUCHAR CompressedBuffer,
|
||||||
|
IN ULONG CompressedBufferSize,
|
||||||
|
IN ULONG FragmentOffset,
|
||||||
|
OUT PULONG FinalUncompressedSize,
|
||||||
|
IN PVOID WorkSpace)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlDescribeChunk(IN USHORT CompressionFormat,
|
||||||
|
IN OUT PUCHAR *CompressedBuffer,
|
||||||
|
IN PUCHAR EndOfCompressedBufferPlus1,
|
||||||
|
OUT PUCHAR *ChunkBuffer,
|
||||||
|
OUT PULONG ChunkSize)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlGetCompressionWorkSpaceSize(IN USHORT CompressionFormatAndEngine,
|
||||||
|
OUT PULONG CompressBufferAndWorkSpaceSize,
|
||||||
|
OUT PULONG CompressFragmentWorkSpaceSize)
|
||||||
|
{
|
||||||
|
USHORT Format = CompressionFormatAndEngine & COMPRESSION_FORMAT_MASK;
|
||||||
|
USHORT Engine = CompressionFormatAndEngine & COMPRESSION_ENGINE_MASK;
|
||||||
|
|
||||||
|
if ((Format == COMPRESSION_FORMAT_NONE) ||
|
||||||
|
(Format == COMPRESSION_FORMAT_DEFAULT))
|
||||||
|
return(STATUS_INVALID_PARAMETER);
|
||||||
|
|
||||||
|
if (Format == COMPRESSION_FORMAT_LZNT1)
|
||||||
|
return(RtlpWorkSpaceSizeLZNT1(Engine,
|
||||||
|
CompressBufferAndWorkSpaceSize,
|
||||||
|
CompressFragmentWorkSpaceSize));
|
||||||
|
|
||||||
|
return(STATUS_UNSUPPORTED_COMPRESSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
RtlReserveChunk(IN USHORT CompressionFormat,
|
||||||
|
IN OUT PUCHAR *CompressedBuffer,
|
||||||
|
IN PUCHAR EndOfCompressedBufferPlus1,
|
||||||
|
OUT PUCHAR *ChunkBuffer,
|
||||||
|
IN ULONG ChunkSize)
|
||||||
|
{
|
||||||
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
Loading…
Reference in a new issue