ntdll: Implement semi-stub for RtlGetCompressionWorkSpaceSize.

This commit is contained in:
Sebastian Lackner 2015-07-09 03:06:10 +02:00 committed by Alexandre Julliard
parent ee899dc55e
commit 577332f612
2 changed files with 26 additions and 19 deletions

View File

@ -1224,14 +1224,32 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY
/****************************************************************************** /******************************************************************************
* RtlGetCompressionWorkSpaceSize [NTDLL.@] * RtlGetCompressionWorkSpaceSize [NTDLL.@]
*/ */
NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT CompressionFormatAndEngine, NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT format, PULONG compress_workspace,
PULONG CompressBufferWorkSpaceSize, PULONG decompress_workspace)
PULONG CompressFragmentWorkSpaceSize)
{ {
FIXME("0x%04x, %p, %p: stub!\n", CompressionFormatAndEngine, CompressBufferWorkSpaceSize, FIXME("0x%04x, %p, %p: semi-stub\n", format, compress_workspace, decompress_workspace);
CompressFragmentWorkSpaceSize);
return STATUS_NOT_IMPLEMENTED; switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
{
case COMPRESSION_FORMAT_LZNT1:
if (compress_workspace)
{
/* FIXME: The current implementation of RtlCompressBuffer does not use a
* workspace buffer, but Windows applications might expect a nonzero value. */
*compress_workspace = 16;
}
if (decompress_workspace)
*decompress_workspace = 0x1000;
return STATUS_SUCCESS;
case COMPRESSION_FORMAT_NONE:
case COMPRESSION_FORMAT_DEFAULT:
return STATUS_INVALID_PARAMETER;
default:
FIXME("format %u not implemented\n", format);
return STATUS_UNSUPPORTED_COMPRESSION;
}
} }
/* compress data using LZNT1, currently only a stub */ /* compress data using LZNT1, currently only a stub */

View File

@ -1623,14 +1623,10 @@ static void test_RtlCompressBuffer(void)
compress_workspace = decompress_workspace = 0xdeadbeef; compress_workspace = decompress_workspace = 0xdeadbeef;
status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace,
&decompress_workspace); &decompress_workspace);
todo_wine
ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
if (status == STATUS_SUCCESS) workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace);
{ ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError());
workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace);
ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError());
}
/* test compression format / engine */ /* test compression format / engine */
final_size = 0xdeadbeef; final_size = 0xdeadbeef;
@ -1699,35 +1695,28 @@ static void test_RtlGetCompressionWorkSpaceSize(void)
/* test invalid format / engine */ /* test invalid format / engine */
status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_NONE, &compress_workspace, status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_NONE, &compress_workspace,
&decompress_workspace); &decompress_workspace);
todo_wine
ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_DEFAULT, &compress_workspace, status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_DEFAULT, &compress_workspace,
&decompress_workspace); &decompress_workspace);
todo_wine
ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status); ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace); status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace);
todo_wine
ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status); ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status);
/* test LZNT1 with normal and maximum compression */ /* test LZNT1 with normal and maximum compression */
compress_workspace = decompress_workspace = 0xdeadbeef; compress_workspace = decompress_workspace = 0xdeadbeef;
status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace, status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace,
&decompress_workspace); &decompress_workspace);
todo_wine
ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
todo_wine
ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace);
compress_workspace = decompress_workspace = 0xdeadbeef; compress_workspace = decompress_workspace = 0xdeadbeef;
status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM,
&compress_workspace, &decompress_workspace); &compress_workspace, &decompress_workspace);
todo_wine
ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status); ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace); ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
todo_wine
ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace); ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace);
} }