Added compression functions (not usabel yet).

svn path=/trunk/; revision=3301
This commit is contained in:
Eric Kohl 2002-07-25 13:18:31 +00:00
parent a79a9cbba6
commit 9a04ad5955
7 changed files with 333 additions and 66 deletions

View file

@ -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
);
LARGE_INTEGER
STDCALL
RtlConvertLongToLargeInteger (
IN LONG SignedInteger
);
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);
NTSTATUS
STDCALL
RtlConvertSidToUnicodeString (
IN OUT PUNICODE_STRING String,
IN PSID Sid,
IN BOOLEAN AllocateString
);
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);
LARGE_INTEGER
STDCALL
RtlConvertUlongToLargeInteger (
IN ULONG UnsignedInteger
);
LARGE_INTEGER STDCALL
RtlConvertLongToLargeInteger(IN LONG SignedInteger);
NTSTATUS STDCALL
RtlConvertSidToUnicodeString(IN OUT PUNICODE_STRING String,
IN PSID Sid,
IN BOOLEAN AllocateString);
LARGE_INTEGER STDCALL
RtlConvertUlongToLargeInteger(IN ULONG UnsignedInteger);
#if 0
VOID
@ -721,32 +731,54 @@ RtlCustomCPToUnicodeN (
ULONG CustomSize
);
NTSTATUS
STDCALL
RtlDeleteAtomFromAtomTable (
IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom
);
NTSTATUS STDCALL
RtlDecompressBuffer(IN USHORT CompressionFormat,
OUT PUCHAR UncompressedBuffer,
IN ULONG UncompressedBufferSize,
IN PUCHAR CompressedBuffer,
IN ULONG CompressedBufferSize,
OUT PULONG FinalUncompressedSize);
NTSTATUS
STDCALL
RtlDeleteRegistryValue (
ULONG RelativeTo,
PWSTR Path,
PWSTR ValueName
);
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);
NTSTATUS
STDCALL
RtlDestroyAtomTable (
IN PRTL_ATOM_TABLE AtomTable
);
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);
BOOL
STDCALL
RtlDestroyHeap (
HANDLE hheap
);
NTSTATUS STDCALL
RtlDeleteAtomFromAtomTable(IN PRTL_ATOM_TABLE AtomTable,
IN RTL_ATOM Atom);
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
STDCALL
@ -957,6 +989,11 @@ RtlGetCallersAddress (
PVOID * CallersAddress
);
NTSTATUS STDCALL
RtlGetCompressionWorkSpaceSize(IN USHORT CompressionFormatAndEngine,
OUT PULONG CompressBufferAndWorkSpaceSize,
OUT PULONG CompressFragmentWorkSpaceSize);
VOID
STDCALL
RtlGetDefaultCodePage (
@ -1442,6 +1479,13 @@ RtlReAllocateHeap (
DWORD size
);
NTSTATUS STDCALL
RtlReserveChunk(IN USHORT CompressionFormat,
IN OUT PUCHAR *CompressedBuffer,
IN PUCHAR EndOfCompressedBufferPlus1,
OUT PUCHAR *ChunkBuffer,
IN ULONG ChunkSize);
/*
* VOID
* RtlRetrieveUlong (

View file

@ -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
#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
{
ULONG StackCommit;
@ -181,4 +191,16 @@ typedef struct _GENERATE_NAME_CONTEXT
ULONG LastIndexValue;
} 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 */

View file

@ -3850,11 +3850,6 @@ extern "C" {
#define PROCESSOR_MIPS_R4000 (4000)
#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 */
#define TAPE_DRIVE_COMPRESSION (131072)
#define TAPE_DRIVE_ECC (65536)

View file

@ -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
#
@ -83,6 +83,7 @@ OBJECTS_NT = \
OBJECTS_RTL = \
rtl/atom.o \
rtl/bitmap.o \
rtl/compress.o \
rtl/ctype.o \
rtl/dos8dot3.o \
rtl/error.o \

View file

@ -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
;
@ -676,8 +676,8 @@ RtlCompareMemory@12
RtlCompareMemoryUlong@12
RtlCompareString@12
RtlCompareUnicodeString@12
;RtlCompressBuffer
;RtlCompressChunks
RtlCompressBuffer@32
RtlCompressChunks@28
RtlConvertLongToLargeInteger@4
RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger@4
@ -692,15 +692,15 @@ RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor@8
RtlCreateUnicodeString@8
RtlCustomCPToUnicodeN@24
;RtlDecompressBuffer
;RtlDecompressChunks
;RtlDecompressFragment
RtlDecompressBuffer@24
RtlDecompressChunks@28
RtlDecompressFragment@32
;RtlDelete
RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
RtlDeleteRegistryValue@12
;RtlDescribeChunk
RtlDescribeChunk@20
RtlDestroyAtomTable@4
;RtlDestroyHeap
RtlDowncaseUnicodeString@12
@ -736,7 +736,7 @@ RtlFreeOemString@4
RtlFreeUnicodeString@4
RtlGenerate8dot3Name@16
;RtlGetCallersAddress
;RtlGetCompressionWorkSpaceSize
RtlGetCompressionWorkSpaceSize@12
RtlGetDaclSecurityDescriptor@16
RtlGetDefaultCodePage@8
;RtlGetElementGenericTable
@ -791,7 +791,7 @@ RtlQueryTimeZoneInformation@4
RtlRaiseException@4
;RtlRandom
;RtlRemoveUnicodePrefix
;RtlReserveChunk
RtlReserveChunk@20
RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime@8
RtlSetAllBits@4

View file

@ -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
;
@ -676,8 +676,8 @@ RtlCompareMemory=RtlCompareMemory@12
RtlCompareMemoryUlong=RtlCompareMemoryUlong@12
RtlCompareString=RtlCompareString@12
RtlCompareUnicodeString=RtlCompareUnicodeString@12
;RtlCompressBuffer
;RtlCompressChunks
RtlCompressBuffer=RtlCompressBuffer@32
RtlCompressChunks=RtlCompressChunks@28
RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4
RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
@ -692,15 +692,15 @@ RtlCreateRegistryKey=RtlCreateRegistryKey@8
RtlCreateSecurityDescriptor=RtlCreateSecurityDescriptor@8
RtlCreateUnicodeString=RtlCreateUnicodeString@8
RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24
;RtlDecompressBuffer
;RtlDecompressChunks
;RtlDecompressFragment
RtlDecompressBuffer=RtlDecompressBuffer@24
RtlDecompressChunks=RtlDecompressChunks@28
RtlDecompressFragment=RtlDecompressFragment@32
;RtlDelete
RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8
;RtlDeleteElementGenericTable
;RtlDeleteNoSplay
RtlDeleteRegistryValue=RtlDeleteRegistryValue@12
;RtlDescribeChunk
RtlDescribeChunk=RtlDescribeChunk@20
RtlDestroyAtomTable=RtlDestroyAtomTable@4
;RtlDestroyHeap
RtlDowncaseUnicodeString=RtlDowncaseUnicodeString@12
@ -736,7 +736,7 @@ RtlFreeOemString=RtlFreeOemString@4
RtlFreeUnicodeString=RtlFreeUnicodeString@4
RtlGenerate8dot3Name=RtlGenerate8dot3Name@16
;RtlGetCallersAddress
;RtlGetCompressionWorkSpaceSize
RtlGetCompressionWorkSpaceSize=RtlGetCompressionWorkSpaceSize@12
RtlGetDaclSecurityDescriptor=RtlGetDaclSecurityDescriptor@16
RtlGetDefaultCodePage=RtlGetDefaultCodePage@8
;RtlGetElementGenericTable
@ -790,7 +790,7 @@ RtlQueryTimeZoneInformation=RtlQueryTimeZoneInformation@4
RtlRaiseException=RtlRaiseException@4
;RtlRandom
;RtlRemoveUnicodePrefix
;RtlReserveChunk
RtlReserveChunk=RtlReserveChunk@20
RtlSecondsSince1970ToTime=RtlSecondsSince1970ToTime@8
RtlSecondsSince1980ToTime=RtlSecondsSince1980ToTime@8
RtlSetAllBits=RtlSetAllBits@4

View 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 */