diff --git a/reactos/lib/ntdll/def/ntdll.def b/reactos/lib/ntdll/def/ntdll.def index cfa1e0a009d..ccecf054f95 100644 --- a/reactos/lib/ntdll/def/ntdll.def +++ b/reactos/lib/ntdll/def/ntdll.def @@ -1,4 +1,4 @@ -; $Id: ntdll.def,v 1.85 2002/07/29 15:37:05 ekohl Exp $ +; $Id: ntdll.def,v 1.86 2002/08/10 21:57:21 ekohl Exp $ ; ; ReactOS Operating System ; @@ -313,7 +313,7 @@ RtlCompareMemory@12 RtlCompareMemoryUlong@12 RtlCompareString@12 RtlCompareUnicodeString@12 -;RtlCompressBuffer +RtlCompressBuffer@32 ;RtlConsoleMultiByteToUnicodeN RtlConvertExclusiveToShared@4 RtlConvertLongToLargeInteger@4 @@ -347,8 +347,8 @@ RtlCreateUserThread@40 RtlCustomCPToUnicodeN@24 ;RtlCutoverTimeToSystemTime RtlDeNormalizeProcessParams@4 -;RtlDecompressBuffer -;RtlDecompressFragment +RtlDecompressBuffer@24 +RtlDecompressFragment@32 ;RtlDelete RtlDeleteAce@8 RtlDeleteAtomFromAtomTable@8 @@ -415,7 +415,7 @@ RtlFreeUserThreadStack@8 RtlGenerate8dot3Name@16 RtlGetAce@12 ;RtlGetCallersAddress -;RtlGetCompressionWorkSpaceSize +RtlGetCompressionWorkSpaceSize@12 RtlGetControlSecurityDescriptor@12 RtlGetCurrentDirectory_U@8 RtlGetDaclSecurityDescriptor@16 diff --git a/reactos/lib/ntdll/def/ntdll.edf b/reactos/lib/ntdll/def/ntdll.edf index f78da6cf7ed..914f81a3b3c 100644 --- a/reactos/lib/ntdll/def/ntdll.edf +++ b/reactos/lib/ntdll/def/ntdll.edf @@ -1,4 +1,4 @@ -; $Id: ntdll.edf,v 1.74 2002/07/29 15:37:06 ekohl Exp $ +; $Id: ntdll.edf,v 1.75 2002/08/10 21:57:21 ekohl Exp $ ; ; ReactOS Operating System ; @@ -313,7 +313,7 @@ RtlCompareMemory=RtlCompareMemory@12 RtlCompareMemoryUlong=RtlCompareMemoryUlong@12 RtlCompareString=RtlCompareString@12 RtlCompareUnicodeString=RtlCompareUnicodeString@12 -;RtlCompressBuffer +RtlCompressBuffer=RtlCompressBuffer@32 ;RtlConsoleMultiByteToUnicodeN RtlConvertExclusiveToShared=RtlConvertExclusiveToShared@4 RtlConvertLongToLargeInteger=RtlConvertLongToLargeInteger@4 @@ -347,8 +347,8 @@ RtlCreateUserThread=RtlCreateUserThread@40 RtlCustomCPToUnicodeN=RtlCustomCPToUnicodeN@24 ;RtlCutoverTimeToSystemTime RtlDeNormalizeProcessParams=RtlDeNormalizeProcessParams@4 -;RtlDecompressBuffer -;RtlDecompressFragment +RtlDecompressBuffer=RtlDecompressBuffer@24 +RtlDecompressFragment=RtlDecompressFragment@32 ;RtlDelete RtlDeleteAce=RtlDeleteAce@8 RtlDeleteAtomFromAtomTable=RtlDeleteAtomFromAtomTable@8 @@ -414,7 +414,7 @@ RtlFreeUserThreadStack=RtlFreeUserThreadStack@8 RtlGenerate8dot3Name=RtlGenerate8dot3Name@16 RtlGetAce=RtlGetAce@12 ;RtlGetCallersAddress -;RtlGetCompressionWorkSpaceSize +RtlGetCompressionWorkSpaceSize=RtlGetCompressionWorkSpaceSize@12 RtlGetControlSecurityDescriptor=RtlGetControlSecurityDescriptor@12 RtlGetCurrentDirectory_U=RtlGetCurrentDirectory_U@8 RtlGetDaclSecurityDescriptor=RtlGetDaclSecurityDescriptor@16 diff --git a/reactos/lib/ntdll/makefile b/reactos/lib/ntdll/makefile index a9084e866f3..1f1fe7d8074 100644 --- a/reactos/lib/ntdll/makefile +++ b/reactos/lib/ntdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.71 2002/06/05 16:51:41 ekohl Exp $ +# $Id: makefile,v 1.72 2002/08/10 21:57:08 ekohl Exp $ PATH_TO_TOP = ../.. @@ -31,7 +31,7 @@ RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \ rtl/access.o rtl/apc.o rtl/callback.o rtl/luid.o rtl/misc.o \ rtl/registry.o rtl/exception.o rtl/intrlck.o rtl/resource.o \ rtl/handle.o rtl/atom.o rtl/message.o rtl/timezone.o \ - rtl/propvar.o rtl/security.o rtl/dos8dot3.o + rtl/propvar.o rtl/security.o rtl/dos8dot3.o rtl/compress.o STDIO_OBJECTS = stdio/sprintf.o stdio/swprintf.o diff --git a/reactos/lib/ntdll/rtl/compress.c b/reactos/lib/ntdll/rtl/compress.c new file mode 100644 index 00000000000..bd679110849 --- /dev/null +++ b/reactos/lib/ntdll/rtl/compress.c @@ -0,0 +1,212 @@ +/* + * 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/08/10 21:57:41 ekohl Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * PURPOSE: Compression and decompression functions + * FILE: lib/ntdll/rtl/compress.c + * PROGRAMER: Eric Kohl (ekohl@rz-online.de) + */ + +/* INCLUDES *****************************************************************/ + +#include + + +/* 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); +} + + +#if 0 +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); +} +#endif + + +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); +} + + +#if 0 +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); +} +#endif + + +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); +} + + +#if 0 +NTSTATUS STDCALL +RtlDescribeChunk(IN USHORT CompressionFormat, + IN OUT PUCHAR *CompressedBuffer, + IN PUCHAR EndOfCompressedBufferPlus1, + OUT PUCHAR *ChunkBuffer, + OUT PULONG ChunkSize) +{ + return(STATUS_NOT_IMPLEMENTED); +} +#endif + + +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); +} + + +#if 0 +NTSTATUS STDCALL +RtlReserveChunk(IN USHORT CompressionFormat, + IN OUT PUCHAR *CompressedBuffer, + IN PUCHAR EndOfCompressedBufferPlus1, + OUT PUCHAR *ChunkBuffer, + IN ULONG ChunkSize) +{ + return(STATUS_NOT_IMPLEMENTED); +} +#endif + +/* EOF */