From: Chris Kadar <fireslash@fireslash.net> Signed-off-by: Chris Kadar <fireslash@fireslash.net> --- dlls/cabinet/Makefile.in | 3 +- dlls/cabinet/cabinet.spec | 6 +++ dlls/cabinet/compressapi.c | 108 +++++++++++++++++++++++++++++++++++++ include/compressapi.h | 74 +++++++++++++++++++++++++ 4 files changed, 190 insertions(+), 1 deletion(-) create mode 100644 dlls/cabinet/compressapi.c create mode 100644 include/compressapi.h diff --git a/dlls/cabinet/Makefile.in b/dlls/cabinet/Makefile.in index b5876e7c95c..67a9fd83754 100644 --- a/dlls/cabinet/Makefile.in +++ b/dlls/cabinet/Makefile.in @@ -9,4 +9,5 @@ VER_PRODUCTVERSION = 5,0,2147,1 SOURCES = \ cabinet_main.c \ fci.c \ - fdi.c + fdi.c \ + compressapi.c diff --git a/dlls/cabinet/cabinet.spec b/dlls/cabinet/cabinet.spec index c3b12eaf8cb..1a01eecac59 100644 --- a/dlls/cabinet/cabinet.spec +++ b/dlls/cabinet/cabinet.spec @@ -12,3 +12,9 @@ 22 cdecl FDICopy(long ptr ptr long ptr ptr ptr) 23 cdecl FDIDestroy(long) 24 cdecl FDITruncateCabinet(long ptr long) +30 stdcall CreateCompressor(long ptr ptr) +33 stdcall Compress(ptr ptr long ptr long ptr) +35 stdcall CloseCompressor(ptr) +40 stdcall CreateDecompressor(long ptr ptr) +43 stdcall Decompress(ptr ptr long ptr long ptr) +45 stdcall CloseDecompressor(ptr) \ No newline at end of file diff --git a/dlls/cabinet/compressapi.c b/dlls/cabinet/compressapi.c new file mode 100644 index 00000000000..cc02c154bda --- /dev/null +++ b/dlls/cabinet/compressapi.c @@ -0,0 +1,108 @@ +/* + * Compression API + * + * Copyright 2026 Chris Kadar + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "compressapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(cabinet); + +/*********************************************************************** + * CreateCompressor (CABINET.30) + */ +BOOL WINAPI CreateCompressor( DWORD algorithm, COMPRESS_ALLOCATION_ROUTINES *routines, COMPRESSOR_HANDLE *handle ) +{ + FIXME("algo (%lu) stub\n", algorithm); + return TRUE; +} + +/*********************************************************************** + * Compress (CABINET.33) + */ +BOOL WINAPI Compress( + COMPRESSOR_HANDLE handle, + const VOID *data, + SIZE_T data_size, + VOID *buffer, + SIZE_T buffer_size, + SIZE_T *compressed_data_size ) +{ + FIXME("stub\n"); + + *compressed_data_size = data_size; + + if( buffer_size < data_size ) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + memcpy(buffer, data, data_size); + return TRUE; +} + +/*********************************************************************** + * CloseCompressor (CABINET.35) + */ +BOOL WINAPI CloseCompressor( COMPRESSOR_HANDLE handle ) +{ + FIXME("stub\n"); + return TRUE; +} + +/*********************************************************************** + * CreateDecompressor (CABINET.40) + */ +BOOL WINAPI CreateDecompressor( DWORD algorithm, COMPRESS_ALLOCATION_ROUTINES *routines, DECOMPRESSOR_HANDLE *handle ) +{ + FIXME("algo (%lu) stub\n", algorithm); + return TRUE; +} + +/*********************************************************************** + * Decompress (CABINET.43) + */ +BOOL WINAPI Decompress( + DECOMPRESSOR_HANDLE handle, + const VOID *data, + SIZE_T data_size, + VOID *buffer, + SIZE_T buffer_size, + SIZE_T *decompressed_data_size) +{ + FIXME("stub\n"); + + *decompressed_data_size = data_size; + + if( buffer_size < data_size ) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return FALSE; + } + memcpy(buffer, data, data_size); + return TRUE; +} + +/*********************************************************************** + * CloseCompressor (CABINET.45) + */ +BOOL WINAPI CloseDecompressor( DECOMPRESSOR_HANDLE handle ) +{ + FIXME("stub\n"); + return TRUE; +} \ No newline at end of file diff --git a/include/compressapi.h b/include/compressapi.h new file mode 100644 index 00000000000..fc36dd773f8 --- /dev/null +++ b/include/compressapi.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2026 Chris Kadar + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_COMPRESSAPI_H +#define __WINE_COMPRESSAPI_H + +#include "windef.h" + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ + +/**********************************************************************/ + +typedef HANDLE COMPRESSOR_HANDLE; +typedef HANDLE DECOMPRESSOR_HANDLE; + +/**********************************************************************/ + +typedef VOID* (CALLBACK *PFN_COMPRESS_ALLOCATE)( + VOID *UserContext, + SIZE_T Size +); + +typedef VOID (CALLBACK *PFN_COMPRESS_FREE)( + VOID *UserContext, + VOID *Memory +); + +typedef struct { + PFN_COMPRESS_ALLOCATE Allocate; + PFN_COMPRESS_FREE Free; + VOID *UserContext; +} COMPRESS_ALLOCATION_ROUTINES; + +/**********************************************************************/ + +#define COMPRESS_ALGORITHM_NULL 0 +#define COMPRESS_ALGORITHM_INVALID 1 +#define COMPRESS_ALGORITHM_MSZIP 2 +#define COMPRESS_ALGORITHM_XPRESS 3 +#define COMPRESS_ALGORITHM_XPRESS_HUFF 4 +#define COMPRESS_ALGORITHM_LZMS 5 + +/**********************************************************************/ + +BOOL WINAPI CreateCompressor( DWORD, COMPRESS_ALLOCATION_ROUTINES*, COMPRESSOR_HANDLE* ); +BOOL WINAPI Compress( COMPRESSOR_HANDLE, const VOID*, SIZE_T, VOID*, SIZE_T, SIZE_T* ); +BOOL WINAPI CloseCompressor( COMPRESSOR_HANDLE ); + +BOOL WINAPI CreateDecompressor( DWORD, COMPRESS_ALLOCATION_ROUTINES*, DECOMPRESSOR_HANDLE* ); +BOOL WINAPI Decompress( DECOMPRESSOR_HANDLE, const VOID*, SIZE_T, VOID*, SIZE_T, SIZE_T* ); +BOOL WINAPI CloseDecompressor( DECOMPRESSOR_HANDLE ); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + +#endif /* __WINE_COMPRESSAPI_H */ \ No newline at end of file -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10352