Rebase against cf7a118a9e5922d819f216c21c3a0984c7bde5dd.

This commit is contained in:
Sebastian Lackner 2015-07-10 00:57:15 +02:00
parent e3bece1c76
commit 174139f1ea
12 changed files with 682 additions and 1240 deletions

2
debian/changelog vendored
View File

@ -7,6 +7,8 @@ wine-staging (1.7.47) UNRELEASED; urgency=low
* Removed patch to initialize *end with NULL on failure in msvcrt.strtod
(accepted upstream).
* Removed patchset for new Threadpool implementation (accepted upstream).
* Partially removed patches for RtlDecompressBuffer implementation (accepted
upstream).
-- Sebastian Lackner <sebastian@fds-team.de> Mon, 29 Jun 2015 19:39:04 +0200
wine-staging (1.7.46) unstable; urgency=low

View File

@ -1,23 +1,26 @@
From ac70c24f5e811828739b6e8c51d1b3e26c6a5d04 Mon Sep 17 00:00:00 2001
From 0955227f8eddd188b2c953d82224fc7c9de34ecd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 30 Oct 2014 17:26:42 +0100
Subject: ntdll: Implement LZNT1 algorithm for RtlDecompressBuffer.
Date: Thu, 9 Jul 2015 03:07:03 +0200
Subject: ntdll: Implement RtlDecompressFragment.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Based on a patch by Michael Müller.
For https://bugs.winehq.org/show_bug.cgi?id=37449
---
dlls/ntdll/ntdll.spec | 2 +-
dlls/ntdll/rtl.c | 229 ++++++++++++++++++++++++++++++++++--
dlls/ntdll/rtl.c | 214 +++++++++++++++++++++++++++++++++++-
dlls/ntdll/tests/rtl.c | 3 -
dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +-
3 files changed, 224 insertions(+), 9 deletions(-)
4 files changed, 210 insertions(+), 11 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 7e95969..c79e942 100644
index 75dc647..ca3561d 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -511,7 +511,7 @@
@@ -513,7 +513,7 @@
@ stdcall RtlDecodePointer(ptr)
# @ stub RtlDecodeSystemPointer
@ stdcall RtlDecompressBuffer(long ptr long ptr long ptr)
@ -27,33 +30,25 @@ index 7e95969..c79e942 100644
@ stub RtlDelete
@ stdcall RtlDeleteAce(ptr long)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index b790910..c9715df 100644
index d9e448a..9a196d2 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -1300,17 +1300,232 @@ NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG unco
@@ -1309,17 +1309,219 @@ NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG unco
}
}
+/* decompress a single LZNT1 chunk */
+static PUCHAR lznt1_decompress_chunk(UCHAR *dst, ULONG dst_size, UCHAR *src, ULONG src_size)
+{
+ UCHAR *src_cur, *src_end, *dst_cur, *dst_end;
+ UCHAR *src_cur = src, *src_end = src + src_size;
+ UCHAR *dst_cur = dst, *dst_end = dst + dst_size;
+ ULONG displacement_bits, length_bits;
+ ULONG code_displacement, code_length;
+ WORD flags, code;
+
+ src_cur = src;
+ src_end = src + src_size;
+ dst_cur = dst;
+ dst_end = dst + dst_size;
+
+ /* Partial decompression is no error on Windows. */
+ while (src_cur < src_end && dst_cur < dst_end)
+ {
+ /* read flags header */
+ flags = 0x8000 | *src_cur++;
+
+ /* parse following 8 entities, either uncompressed data or backwards reference */
+ while ((flags & 0xFF00) && src_cur < src_end)
+ {
+ if (flags & 1)
@ -61,17 +56,18 @@ index b790910..c9715df 100644
+ /* backwards reference */
+ if (src_cur + sizeof(WORD) > src_end)
+ return NULL;
+
+ code = *(WORD *)src_cur;
+ src_cur += sizeof(WORD);
+
+ /* find length / displacement bits */
+ for (displacement_bits = 12; displacement_bits > 4; displacement_bits--)
+ if ((1 << (displacement_bits - 1)) < dst_cur - dst) break;
+
+ length_bits = 16 - displacement_bits;
+ code_length = (code & ((1 << length_bits) - 1)) + 3;
+ code_displacement = (code >> length_bits) + 1;
+
+ /* ensure reference is valid */
+ if (dst_cur < dst + code_displacement)
+ return NULL;
+
@ -92,7 +88,6 @@ index b790910..c9715df 100644
+ }
+ flags >>= 1;
+ }
+
+ }
+
+ return dst_cur;
@ -102,28 +97,23 @@ index b790910..c9715df 100644
+static NTSTATUS lznt1_decompress(UCHAR *dst, ULONG dst_size, UCHAR *src, ULONG src_size,
+ ULONG offset, ULONG *final_size, UCHAR *workspace)
+{
+ UCHAR *src_cur, *src_end, *dst_cur, *dst_end, *ptr;
+ UCHAR *src_cur = src, *src_end = src + src_size;
+ UCHAR *dst_cur = dst, *dst_end = dst + dst_size;
+ ULONG chunk_size, block_size;
+ WORD chunk_header;
+
+ src_cur = src;
+ src_end = src + src_size;
+ dst_cur = dst;
+ dst_end = dst + dst_size;
+ UCHAR *ptr;
+
+ if (src_cur + sizeof(WCHAR) > src_end)
+ return STATUS_BAD_COMPRESSION_BUFFER;
+
+ /* skip over chunks which have a big distance (>= 0x1000) to the destination offset */
+ /* skip over chunks which have a distance >= 0x1000 to the destination offset */
+ while (offset >= 0x1000 && src_cur + sizeof(WCHAR) <= src_end)
+ {
+ /* read chunk header and extract size */
+ chunk_header = *(WORD *)src_cur;
+ src_cur += sizeof(WCHAR);
+ if (!chunk_header) goto out;
+ chunk_size = (chunk_header & 0xFFF) + 1;
+
+ /* ensure we have enough buffer to process chunk */
+ if (src_cur + chunk_size > src_end)
+ return STATUS_BAD_COMPRESSION_BUFFER;
+
@ -131,16 +121,14 @@ index b790910..c9715df 100644
+ offset -= 0x1000;
+ }
+
+ /* this chunk is can be included partially */
+ /* check if a chunk is included partially */
+ if (offset && src_cur + sizeof(WCHAR) <= src_end)
+ {
+ /* read chunk header and extract size */
+ chunk_header = *(WORD *)src_cur;
+ src_cur += sizeof(WCHAR);
+ if (!chunk_header) goto out;
+ chunk_size = (chunk_header & 0xFFF) + 1;
+
+ /* ensure we have enough buffer to process chunk */
+ if (src_cur + chunk_size > src_end)
+ return STATUS_BAD_COMPRESSION_BUFFER;
+
@ -174,19 +162,18 @@ index b790910..c9715df 100644
+ src_cur += chunk_size;
+ }
+
+ /* remaining blocks */
+ while (src_cur + sizeof(WCHAR) <= src_end)
+ {
+ /* read chunk header and extract size */
+ chunk_header = *(WORD *)src_cur;
+ src_cur += sizeof(WCHAR);
+ if (!chunk_header) goto out;
+ chunk_size = (chunk_header & 0xFFF) + 1;
+
+ /* ensure we have enough buffer to process chunk */
+ if (src_cur + chunk_size > src_end)
+ return STATUS_BAD_COMPRESSION_BUFFER;
+
+ /* add padding if required */
+ /* fill space with padding */
+ block_size = ((dst_cur - dst) + offset) & 0xFFF;
+ if (block_size)
+ {
@ -196,7 +183,8 @@ index b790910..c9715df 100644
+ memset(dst_cur, 0, block_size);
+ dst_cur += block_size;
+ }
+ else if (dst_cur >= dst_end)
+
+ if (dst_cur >= dst_end)
+ goto out;
+
+ if (chunk_header & 0x8000)
@ -224,22 +212,14 @@ index b790910..c9715df 100644
+
+}
+
/******************************************************************************
- * RtlDecompressBuffer [NTDLL.@]
+ * RtlDecompressFragment [NTDLL.@]
*/
-NTSTATUS WINAPI RtlDecompressBuffer(USHORT CompressionFormat, PUCHAR UncompressedBuffer,
- ULONG UncompressedBufferSize, PUCHAR CompressedBuffer,
- ULONG CompressedBufferSize, PULONG FinalUncompressedSize)
+/******************************************************************************
+ * RtlDecompressFragment [NTDLL.@]
+ */
+NTSTATUS RtlDecompressFragment(USHORT format, PUCHAR uncompressed, ULONG uncompressed_size,
+ PUCHAR compressed, ULONG compressed_size, ULONG offset,
+ PULONG final_size, PVOID workspace)
{
- FIXME("0x%04x, %p, %u, %p, %u, %p :stub\n", CompressionFormat, UncompressedBuffer, UncompressedBufferSize,
- CompressedBuffer, CompressedBufferSize, FinalUncompressedSize);
- return STATUS_NOT_IMPLEMENTED;
+ TRACE("0x%04x, %p, %u, %p, %u, %u, %p, %p :stub\n", format, uncompressed,
+{
+ TRACE("0x%04x, %p, %u, %p, %u, %u, %p, %p\n", format, uncompressed,
+ uncompressed_size, compressed, compressed_size, offset, final_size, workspace);
+
+ switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
@ -253,25 +233,50 @@ index b790910..c9715df 100644
+ return STATUS_INVALID_PARAMETER;
+
+ default:
+ FIXME("format %d not implemented\n", format);
+ FIXME("format %u not implemented\n", format);
+ return STATUS_UNSUPPORTED_COMPRESSION;
+ }
+}
+
+
+/******************************************************************************
+ * RtlDecompressBuffer [NTDLL.@]
+ */
/******************************************************************************
* RtlDecompressBuffer [NTDLL.@]
*/
-NTSTATUS WINAPI RtlDecompressBuffer(USHORT CompressionFormat, PUCHAR UncompressedBuffer,
- ULONG UncompressedBufferSize, PUCHAR CompressedBuffer,
- ULONG CompressedBufferSize, PULONG FinalUncompressedSize)
+NTSTATUS WINAPI RtlDecompressBuffer(USHORT format, PUCHAR uncompressed, ULONG uncompressed_size,
+ PUCHAR compressed, ULONG compressed_size, PULONG final_size)
+{
{
- FIXME("0x%04x, %p, %u, %p, %u, %p :stub\n", CompressionFormat, UncompressedBuffer, UncompressedBufferSize,
- CompressedBuffer, CompressedBufferSize, FinalUncompressedSize);
+ TRACE("0x%04x, %p, %u, %p, %u, %p\n", format, uncompressed,
+ uncompressed_size, compressed, compressed_size, final_size);
- return STATUS_NOT_IMPLEMENTED;
+ return RtlDecompressFragment(format, uncompressed, uncompressed_size,
+ compressed, compressed_size, 0, final_size, NULL);
}
/***********************************************************************
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index c6a7023..99fd413 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -1663,11 +1663,8 @@ static void test_RtlCompressBuffer(void)
memset(buf2, 0x11, sizeof(buf2));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf2, sizeof(buf2),
buf1, buf_size, &final_size);
- todo_wine
ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
- todo_wine
ok(final_size == sizeof(test_buffer), "got wrong final_size %u\n", final_size);
- todo_wine
ok(!memcmp(buf2, test_buffer, sizeof(test_buffer)), "got wrong decoded data\n");
ok(buf2[sizeof(test_buffer)] == 0x11, "too many bytes written\n");
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
index 4ead907..bfc3c59 100644
index 11d1c62..0bb7d04 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec
@@ -977,7 +977,7 @@
@ -284,5 +289,5 @@ index 4ead907..bfc3c59 100644
@ stdcall RtlDeleteAce(ptr long) ntdll.RtlDeleteAce
@ stdcall RtlDeleteAtomFromAtomTable(ptr long) ntdll.RtlDeleteAtomFromAtomTable
--
2.1.3
2.4.5

View File

@ -1,69 +0,0 @@
From 8f2dbbc47749542a135c5410c94097d8b14e0a84 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 30 Oct 2014 17:19:42 +0100
Subject: ntdll: Implement semi-stub for RtlGetCompressionWorkSpaceSize.
---
dlls/ntdll/rtl.c | 26 ++++++++++++++++++++------
include/winnt.h | 6 ++++++
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 8f6f386..884a14a 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -1215,14 +1215,28 @@ PSLIST_ENTRY WINAPI RtlInterlockedPushListSList(PSLIST_HEADER list, PSLIST_ENTRY
/******************************************************************************
* RtlGetCompressionWorkSpaceSize [NTDLL.@]
*/
-NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT CompressionFormatAndEngine,
- PULONG CompressBufferWorkSpaceSize,
- PULONG CompressFragmentWorkSpaceSize)
+NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT format, PULONG compress_workspace,
+ PULONG decompress_workspace)
{
- FIXME("0x%04x, %p, %p: stub!\n", CompressionFormatAndEngine, CompressBufferWorkSpaceSize,
- CompressFragmentWorkSpaceSize);
+ FIXME("0x%04x, %p, %p: semi-stub\n", format, compress_workspace, decompress_workspace);
- return STATUS_NOT_IMPLEMENTED;
+ switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
+ {
+ case COMPRESSION_FORMAT_LZNT1:
+ if (compress_workspace)
+ *compress_workspace = 16; /* FIXME */
+ if (decompress_workspace)
+ *decompress_workspace = 0x1000;
+ return STATUS_SUCCESS;
+
+ case COMPRESSION_FORMAT_NONE:
+ case COMPRESSION_FORMAT_DEFAULT:
+ return STATUS_INVALID_PARAMETER;
+
+ default:
+ FIXME("format %d not implemented\n", format);
+ return STATUS_UNSUPPORTED_COMPRESSION;
+ }
}
/******************************************************************************
diff --git a/include/winnt.h b/include/winnt.h
index 709a93f..401e3ad 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -4722,6 +4722,12 @@ typedef struct _QUOTA_LIMITS_EX {
#define FILE_256_BYTE_ALIGNMENT 0x000000ff
#define FILE_512_BYTE_ALIGNMENT 0x000001ff
+#define COMPRESSION_FORMAT_NONE 0
+#define COMPRESSION_FORMAT_DEFAULT 1
+#define COMPRESSION_FORMAT_LZNT1 2
+#define COMPRESSION_ENGINE_STANDARD 0
+#define COMPRESSION_ENGINE_MAXIMUM 256
+
#define MAILSLOT_NO_MESSAGE ((DWORD)-1)
#define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
--
2.1.2

View File

@ -1,90 +0,0 @@
From e487c879736038053aac64aa728ba35c78888e71 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 30 Oct 2014 17:24:26 +0100
Subject: ntdll: Implement semi-stub for RtlCompressBuffer.
---
dlls/ntdll/rtl.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 54 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 884a14a..b790910 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -1239,19 +1239,65 @@ NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT format, PULONG compress_wo
}
}
+/* compress data using LZNT1, currently only a stub */
+static NTSTATUS lznt1_compress(UCHAR *src, ULONG src_size, UCHAR *dst, ULONG dst_size,
+ ULONG chunk_size, ULONG *final_size, UCHAR *workspace)
+{
+ UCHAR *src_cur, *src_end, *dst_cur, *dst_end;
+ ULONG block_size;
+
+ src_cur = src;
+ src_end = src + src_size;
+ dst_cur = dst;
+ dst_end = dst + dst_size;
+
+ while (src_cur < src_end)
+ {
+ /* determine size of current chunk */
+ block_size = min(0x1000, src_end - src_cur);
+ if (dst_cur + sizeof(WORD) + block_size > dst_end)
+ return STATUS_BUFFER_TOO_SMALL;
+
+ /* write (uncompressed) chunk header */
+ *(WORD *)dst_cur = 0x3000 | (block_size - 1);
+ dst_cur += sizeof(WORD);
+
+ /* write chunk content */
+ memcpy(dst_cur, src_cur, block_size);
+ dst_cur += block_size;
+ src_cur += block_size;
+ }
+
+ if (final_size)
+ *final_size = dst_cur - dst;
+
+ return STATUS_SUCCESS;
+}
+
/******************************************************************************
* RtlCompressBuffer [NTDLL.@]
*/
-NTSTATUS WINAPI RtlCompressBuffer(USHORT CompressionFormatAndEngine, PUCHAR UncompressedBuffer,
- ULONG UncompressedBufferSize, PUCHAR CompressedBuffer,
- ULONG CompressedBufferSize, ULONG UncompressedChunkSize,
- PULONG FinalCompressedSize, PVOID WorkSpace)
+NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG uncompressed_size,
+ PUCHAR compressed, ULONG compressed_size, ULONG chunk_size,
+ PULONG final_size, PVOID workspace)
{
- FIXME("0x%04x, %p, %u, %p, %u, %u, %p, %p :stub\n", CompressionFormatAndEngine, UncompressedBuffer,
- UncompressedBufferSize, CompressedBuffer, CompressedBufferSize, UncompressedChunkSize,
- FinalCompressedSize, WorkSpace);
+ FIXME("0x%04x, %p, %u, %p, %u, %u, %p, %p :semi-stub\n", format, uncompressed,
+ uncompressed_size, compressed, compressed_size, chunk_size, final_size, workspace);
- return STATUS_NOT_IMPLEMENTED;
+ switch (format & ~COMPRESSION_ENGINE_MAXIMUM)
+ {
+ case COMPRESSION_FORMAT_LZNT1:
+ return lznt1_compress(uncompressed, uncompressed_size, compressed,
+ compressed_size, chunk_size, final_size, workspace);
+
+ case COMPRESSION_FORMAT_NONE:
+ case COMPRESSION_FORMAT_DEFAULT:
+ return STATUS_INVALID_PARAMETER;
+
+ default:
+ FIXME("format %d not implemented\n", format);
+ return STATUS_UNSUPPORTED_COMPRESSION;
+ }
}
/******************************************************************************
--
2.1.2

View File

@ -0,0 +1,389 @@
From 2609aa20f4eea473a574d19d5a7d60598a8cc98e Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 9 Jul 2015 03:07:40 +0200
Subject: ntdll/tests: Add tests for RtlDecompressBuffer.
---
dlls/ntdll/tests/rtl.c | 361 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 361 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 99fd413..a1b9327 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -1717,6 +1717,366 @@ static void test_RtlGetCompressionWorkSpaceSize(void)
ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace);
}
+/* helper for test_RtlDecompressBuffer, checks if a chunk is incomplete */
+static BOOL is_incomplete_chunk(const UCHAR *compressed, ULONG compressed_size, BOOL check_all)
+{
+ ULONG chunk_size;
+
+ if (compressed_size <= sizeof(WORD))
+ return TRUE;
+
+ while (compressed_size >= sizeof(WORD))
+ {
+ chunk_size = (*(WORD *)compressed & 0xFFF) + 1;
+ if (compressed_size < sizeof(WORD) + chunk_size)
+ return TRUE;
+ if (!check_all)
+ break;
+ compressed += sizeof(WORD) + chunk_size;
+ compressed_size -= sizeof(WORD) + chunk_size;
+ }
+
+ return FALSE;
+}
+
+#define DECOMPRESS_BROKEN_FRAGMENT 1 /* < Win 7 */
+#define DECOMPRESS_BROKEN_TRUNCATED 2 /* broken on all machines */
+
+static void test_RtlDecompressBuffer(void)
+{
+ static const struct
+ {
+ UCHAR compressed[32];
+ ULONG compressed_size;
+ NTSTATUS status;
+ UCHAR uncompressed[32];
+ ULONG uncompressed_size;
+ DWORD broken_flags;
+ }
+ test_lznt[] =
+ {
+ /* 4 byte uncompressed chunk */
+ {
+ {0x03, 0x30, 'W', 'i', 'n', 'e'},
+ 6,
+ STATUS_SUCCESS,
+ "Wine",
+ 4,
+ DECOMPRESS_BROKEN_FRAGMENT
+ },
+ /* 8 byte uncompressed chunk */
+ {
+ {0x07, 0x30, 'W', 'i', 'n', 'e', 'W', 'i', 'n', 'e'},
+ 10,
+ STATUS_SUCCESS,
+ "WineWine",
+ 8,
+ DECOMPRESS_BROKEN_FRAGMENT
+ },
+ /* 4 byte compressed chunk */
+ {
+ {0x04, 0xB0, 0x00, 'W', 'i', 'n', 'e'},
+ 7,
+ STATUS_SUCCESS,
+ "Wine",
+ 4
+ },
+ /* 8 byte compressed chunk */
+ {
+ {0x08, 0xB0, 0x00, 'W', 'i', 'n', 'e', 'W', 'i', 'n', 'e'},
+ 11,
+ STATUS_SUCCESS,
+ "WineWine",
+ 8
+ },
+ /* compressed chunk using backwards reference */
+ {
+ {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x01, 0x30},
+ 9,
+ STATUS_SUCCESS,
+ "WineWine",
+ 8,
+ DECOMPRESS_BROKEN_TRUNCATED
+ },
+ /* compressed chunk using backwards reference with length > bytes_read */
+ {
+ {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05, 0x30},
+ 9,
+ STATUS_SUCCESS,
+ "WineWineWine",
+ 12,
+ DECOMPRESS_BROKEN_TRUNCATED
+ },
+ /* same as above, but unused bits != 0 */
+ {
+ {0x06, 0xB0, 0x30, 'W', 'i', 'n', 'e', 0x01, 0x30},
+ 9,
+ STATUS_SUCCESS,
+ "WineWine",
+ 8,
+ DECOMPRESS_BROKEN_TRUNCATED
+ },
+ /* compressed chunk without backwards reference and unused bits != 0 */
+ {
+ {0x01, 0xB0, 0x02, 'W'},
+ 4,
+ STATUS_SUCCESS,
+ "W",
+ 1
+ },
+ /* termination sequence after first chunk */
+ {
+ {0x03, 0x30, 'W', 'i', 'n', 'e', 0x00, 0x00, 0x03, 0x30, 'W', 'i', 'n', 'e'},
+ 14,
+ STATUS_SUCCESS,
+ "Wine",
+ 4,
+ DECOMPRESS_BROKEN_FRAGMENT
+ },
+ /* compressed chunk using backwards reference with 4 bit offset, 12 bit length */
+ {
+ {0x14, 0xB0, 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+ 0x00, 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+ 0x01, 0x01, 0xF0},
+ 23,
+ STATUS_SUCCESS,
+ "ABCDEFGHIJKLMNOPABCD",
+ 20,
+ DECOMPRESS_BROKEN_TRUNCATED
+ },
+ /* compressed chunk using backwards reference with 5 bit offset, 11 bit length */
+ {
+ {0x15, 0xB0, 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+ 0x00, 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+ 0x02, 'A', 0x00, 0x78},
+ 24,
+ STATUS_SUCCESS,
+ "ABCDEFGHIJKLMNOPABCD",
+ 20,
+ DECOMPRESS_BROKEN_TRUNCATED
+ },
+ /* uncompressed chunk with invalid magic */
+ {
+ {0x03, 0x20, 'W', 'i', 'n', 'e'},
+ 6,
+ STATUS_SUCCESS,
+ "Wine",
+ 4,
+ DECOMPRESS_BROKEN_FRAGMENT
+ },
+ /* compressed chunk with invalid magic */
+ {
+ {0x04, 0xA0, 0x00, 'W', 'i', 'n', 'e'},
+ 7,
+ STATUS_SUCCESS,
+ "Wine",
+ 4
+ },
+ /* garbage byte after end of buffer */
+ {
+ {0x00, 0xB0, 0x02, 0x01},
+ 4,
+ STATUS_SUCCESS,
+ "",
+ 0
+ },
+ /* empty compressed chunk */
+ {
+ {0x00, 0xB0, 0x00},
+ 3,
+ STATUS_SUCCESS,
+ "",
+ 0
+ },
+ /* empty compressed chunk with unused bits != 0 */
+ {
+ {0x00, 0xB0, 0x01},
+ 3,
+ STATUS_SUCCESS,
+ "",
+ 0
+ },
+ /* empty input buffer */
+ {
+ {},
+ 0,
+ STATUS_BAD_COMPRESSION_BUFFER,
+ },
+ /* incomplete chunk header */
+ {
+ {0x01},
+ 1,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* incomplete chunk header */
+ {
+ {0x00, 0x30},
+ 2,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* compressed chunk with invalid backwards reference */
+ {
+ {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05, 0x40},
+ 9,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* compressed chunk with incomplete backwards reference */
+ {
+ {0x05, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05},
+ 8,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* incomplete uncompressed chunk */
+ {
+ {0x07, 0x30, 'W', 'i', 'n', 'e'},
+ 6,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* incomplete compressed chunk */
+ {
+ {0x08, 0xB0, 0x00, 'W', 'i', 'n', 'e'},
+ 7,
+ STATUS_BAD_COMPRESSION_BUFFER
+ },
+ /* two compressed chunks, the second one incomplete */
+ {
+ {0x00, 0xB0, 0x02, 0x00, 0xB0},
+ 5,
+ STATUS_BAD_COMPRESSION_BUFFER,
+ }
+ };
+
+ static UCHAR buf[0x2000];
+ NTSTATUS status;
+ ULONG final_size;
+ int i;
+
+ if (!pRtlDecompressBuffer)
+ {
+ win_skip("RtlDecompressBuffer is not available\n");
+ return;
+ }
+
+ /* test compression format / engine */
+ final_size = 0xdeadbeef;
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_NONE, buf, sizeof(buf), test_lznt[0].compressed,
+ test_lznt[0].compressed_size, &final_size);
+ ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
+ ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
+
+ final_size = 0xdeadbeef;
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_DEFAULT, buf, sizeof(buf), test_lznt[0].compressed,
+ test_lznt[0].compressed_size, &final_size);
+ ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
+ ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
+
+ final_size = 0xdeadbeef;
+ status = pRtlDecompressBuffer(0xFF, buf, sizeof(buf), test_lznt[0].compressed,
+ test_lznt[0].compressed_size, &final_size);
+ ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status);
+ ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
+
+ /* regular tests for RtlDecompressBuffer */
+ for (i = 0; i < sizeof(test_lznt) / sizeof(test_lznt[0]); i++)
+ {
+ trace("Running test %d (compressed_size=%u, uncompressed_size=%u, status=0x%08x)\n",
+ i, test_lznt[i].compressed_size, test_lznt[i].uncompressed_size, test_lznt[i].status);
+
+ /* test with very big buffer */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
+ test_lznt[i].compressed_size, &final_size);
+ ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ ok(final_size == test_lznt[i].uncompressed_size,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
+ }
+
+ /* test that modifier for compression engine is ignored */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, buf, sizeof(buf),
+ test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
+ ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ ok(final_size == test_lznt[i].uncompressed_size,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
+ }
+
+ /* test with expected output size */
+ if (test_lznt[i].uncompressed_size > 0)
+ {
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, test_lznt[i].uncompressed_size,
+ test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
+ ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ ok(final_size == test_lznt[i].uncompressed_size,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
+ }
+ }
+
+ /* test with smaller output size */
+ if (test_lznt[i].uncompressed_size > 1)
+ {
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, test_lznt[i].uncompressed_size - 1,
+ test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
+ if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_TRUNCATED)
+ todo_wine
+ ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
+ else
+ ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ ok(final_size == test_lznt[i].uncompressed_size - 1,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size - 1),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size - 1] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size - 1);
+ }
+ }
+
+ /* test with zero output size */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, 0, test_lznt[i].compressed,
+ test_lznt[i].compressed_size, &final_size);
+ if (is_incomplete_chunk(test_lznt[i].compressed, test_lznt[i].compressed_size, FALSE))
+ ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
+ else
+ {
+ ok(status == STATUS_SUCCESS, "%d: got wrong status 0x%08x\n", i, status);
+ ok(final_size == 0, "%d: got wrong final_size %u\n", i, final_size);
+ ok(buf[0] == 0x11, "%d: buf[0] was modified\n", i);
+ }
+ }
+}
+
+#undef DECOMPRESS_BROKEN_FRAGMENT
+#undef DECOMPRESS_BROKEN_TRUNCATED
+
START_TEST(rtl)
{
InitFunctionPtrs();
@@ -1745,4 +2105,5 @@ START_TEST(rtl)
test_LdrLockLoaderLock();
test_RtlCompressBuffer();
test_RtlGetCompressionWorkSpaceSize();
+ test_RtlDecompressBuffer();
}
--
2.4.5

View File

@ -0,0 +1,141 @@
From 6546dabdc504eb340167404ca66364a536e65cdc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Thu, 9 Jul 2015 03:08:09 +0200
Subject: ntdll/tests: Add tests for RtlDecompressFragment.
---
dlls/ntdll/tests/rtl.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 89 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index a1b9327..4903790 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -94,6 +94,7 @@ static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG_PTR*);
static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR);
static NTSTATUS (WINAPI *pRtlGetCompressionWorkSpaceSize)(USHORT, PULONG, PULONG);
static NTSTATUS (WINAPI *pRtlDecompressBuffer)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, PULONG);
+static NTSTATUS (WINAPI *pRtlDecompressFragment)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, ULONG, PULONG, PVOID);
static NTSTATUS (WINAPI *pRtlCompressBuffer)(USHORT, const UCHAR*, ULONG, PUCHAR, ULONG, ULONG, PULONG, PVOID);
static HMODULE hkernel32 = 0;
@@ -144,6 +145,7 @@ static void InitFunctionPtrs(void)
pLdrUnlockLoaderLock = (void *)GetProcAddress(hntdll, "LdrUnlockLoaderLock");
pRtlGetCompressionWorkSpaceSize = (void *)GetProcAddress(hntdll, "RtlGetCompressionWorkSpaceSize");
pRtlDecompressBuffer = (void *)GetProcAddress(hntdll, "RtlDecompressBuffer");
+ pRtlDecompressFragment = (void *)GetProcAddress(hntdll, "RtlDecompressFragment");
pRtlCompressBuffer = (void *)GetProcAddress(hntdll, "RtlCompressBuffer");
}
hkernel32 = LoadLibraryA("kernel32.dll");
@@ -1946,14 +1948,14 @@ static void test_RtlDecompressBuffer(void)
}
};
- static UCHAR buf[0x2000];
- NTSTATUS status;
+ static UCHAR buf[0x2000], workspace[0x1000];
+ NTSTATUS status, expected_status;
ULONG final_size;
int i;
- if (!pRtlDecompressBuffer)
+ if (!pRtlDecompressBuffer || !pRtlDecompressFragment)
{
- win_skip("RtlDecompressBuffer is not available\n");
+ win_skip("RtlDecompressBuffer or RtlDecompressFragment is not available\n");
return;
}
@@ -2071,6 +2073,89 @@ static void test_RtlDecompressBuffer(void)
ok(final_size == 0, "%d: got wrong final_size %u\n", i, final_size);
ok(buf[0] == 0x11, "%d: buf[0] was modified\n", i);
}
+
+ /* test RtlDecompressFragment with offset = 0 */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
+ test_lznt[i].compressed_size, 0, &final_size, workspace);
+ if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
+ todo_wine
+ ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
+ else
+ ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ ok(final_size == test_lznt[i].uncompressed_size,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
+ }
+
+ /* test RtlDecompressFragment with offset = 1 */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
+ test_lznt[i].compressed_size, 1, &final_size, workspace);
+ if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
+ todo_wine
+ ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
+ else
+ ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ if (test_lznt[i].uncompressed_size == 0)
+ {
+ todo_wine
+ ok(final_size == 4095, "%d: got wrong final_size %u\n", i, final_size);
+ /* Buffer doesn't contain any useful value on Windows */
+ ok(buf[4095] == 0x11, "%d: buf[4095] was modified\n", i);
+ }
+ else
+ {
+ ok(final_size == test_lznt[i].uncompressed_size - 1,
+ "%d: got wrong final_size %u\n", i, final_size);
+ ok(!memcmp(buf, test_lznt[i].uncompressed + 1, test_lznt[i].uncompressed_size - 1),
+ "%d: got wrong decoded data\n", i);
+ ok(buf[test_lznt[i].uncompressed_size - 1] == 0x11,
+ "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size - 1);
+ }
+ }
+
+ /* test RtlDecompressFragment with offset = 4095 */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
+ test_lznt[i].compressed_size, 4095, &final_size, workspace);
+ if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
+ todo_wine
+ ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
+ else
+ ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ if (!status)
+ {
+ todo_wine
+ ok(final_size == 1, "%d: got wrong final_size %u\n", i, final_size);
+ todo_wine
+ ok(buf[0] == 0, "%d: padding is not zero\n", i);
+ ok(buf[1] == 0x11, "%d: buf[1] was modified\n", i);
+ }
+
+ /* test RtlDecompressFragment with offset = 4096 */
+ final_size = 0xdeadbeef;
+ memset(buf, 0x11, sizeof(buf));
+ status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
+ test_lznt[i].compressed_size, 4096, &final_size, workspace);
+ expected_status = is_incomplete_chunk(test_lznt[i].compressed, test_lznt[i].compressed_size, TRUE) ?
+ test_lznt[i].status : STATUS_SUCCESS;
+ ok(status == expected_status, "%d: got wrong status 0x%08x, expected 0x%08x\n", i, status, expected_status);
+ if (!status)
+ {
+ ok(final_size == 0, "%d: got wrong final_size %u\n", i, final_size);
+ ok(buf[0] == 0x11, "%d: buf[4096] was modified\n", i);
+ }
}
}
--
2.4.5

View File

@ -1,149 +0,0 @@
From 8a8496e747ef2dff43763a3d3dfd7f1d68160adc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Tue, 10 Mar 2015 20:09:59 +0100
Subject: ntdll/tests: Fix various test failures caused by broken
RtlDecompressBuffer results.
---
dlls/ntdll/tests/rtl.c | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 2f6c421..843e8e7 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -1664,9 +1664,7 @@ static BOOL is_incomplete_chunk(const UCHAR *compressed, ULONG compressed_size,
}
#define DECOMPRESS_BROKEN_TRUNCATED 1
-#define DECOMPRESS_BROKEN_FRAGMENT0 2
-#define DECOMPRESS_BROKEN_FRAGMENT1 4
-#define DECOMPRESS_BROKEN_FRAGMENT4095 8
+#define DECOMPRESS_BROKEN_FRAGMENT 2
static void test_RtlDecompressBuffer(void)
{
@@ -1690,9 +1688,7 @@ static void test_RtlDecompressBuffer(void)
STATUS_SUCCESS,
"Wine",
4,
- DECOMPRESS_BROKEN_FRAGMENT4095 |
- DECOMPRESS_BROKEN_FRAGMENT1 |
- DECOMPRESS_BROKEN_FRAGMENT0
+ DECOMPRESS_BROKEN_FRAGMENT
},
/* 8 byte uncompressed chunk */
{
@@ -1701,9 +1697,7 @@ static void test_RtlDecompressBuffer(void)
STATUS_SUCCESS,
"WineWine",
8,
- DECOMPRESS_BROKEN_FRAGMENT4095 |
- DECOMPRESS_BROKEN_FRAGMENT1 |
- DECOMPRESS_BROKEN_FRAGMENT0
+ DECOMPRESS_BROKEN_FRAGMENT
},
/* 4 byte compressed chunk */
{
@@ -1763,9 +1757,7 @@ static void test_RtlDecompressBuffer(void)
STATUS_SUCCESS,
"Wine",
4,
- DECOMPRESS_BROKEN_FRAGMENT4095 |
- DECOMPRESS_BROKEN_FRAGMENT1 |
- DECOMPRESS_BROKEN_FRAGMENT0
+ DECOMPRESS_BROKEN_FRAGMENT
},
/* compressed chunk using backwards reference with 4 bit offset, 12 bit length */
{
@@ -1796,9 +1788,7 @@ static void test_RtlDecompressBuffer(void)
STATUS_SUCCESS,
"Wine",
4,
- DECOMPRESS_BROKEN_FRAGMENT4095 |
- DECOMPRESS_BROKEN_FRAGMENT1 |
- DECOMPRESS_BROKEN_FRAGMENT0
+ DECOMPRESS_BROKEN_FRAGMENT
},
/* compressed chunk with invalid magic */
{
@@ -1923,7 +1913,8 @@ static void test_RtlDecompressBuffer(void)
memset(buf, 0x11, sizeof(buf));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
test_lznt[i].compressed_size, &final_size);
- ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
if (!status)
{
ok(final_size == test_lznt[i].uncompressed_size,
@@ -1939,7 +1930,8 @@ static void test_RtlDecompressBuffer(void)
memset(buf, 0x11, sizeof(buf));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, buf, sizeof(buf),
test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
- ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
+ ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
if (!status)
{
ok(final_size == test_lznt[i].uncompressed_size,
@@ -2011,7 +2003,7 @@ static void test_RtlDecompressBuffer(void)
status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
test_lznt[i].compressed_size, 0, &final_size, workspace);
ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
- (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT0)), "%d: got wrong status 0x%08x\n", i, status);
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
if (!status)
{
ok(final_size == test_lznt[i].uncompressed_size,
@@ -2028,7 +2020,7 @@ static void test_RtlDecompressBuffer(void)
status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
test_lznt[i].compressed_size, 1, &final_size, workspace);
ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
- (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT1)), "%d: got wrong status 0x%08x\n", i, status);
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
if (!status)
{
if (test_lznt[i].uncompressed_size == 0)
@@ -2057,7 +2049,7 @@ static void test_RtlDecompressBuffer(void)
status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
test_lznt[i].compressed_size, 4095, &final_size, workspace);
ok(status == test_lznt[i].status || broken(status == STATUS_BAD_COMPRESSION_BUFFER &&
- (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT4095)), "%d: got wrong status 0x%08x\n", i, status);
+ (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
if (!status)
{
todo_wine
@@ -2092,7 +2084,8 @@ static void test_RtlDecompressBuffer(void)
memset(buf, 0x11, sizeof(buf));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_multiple_chunks,
sizeof(test_multiple_chunks), &final_size);
- ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
+ ok(status == STATUS_SUCCESS || broken(status == STATUS_BAD_COMPRESSION_BUFFER),
+ "got wrong status 0x%08x\n", status);
if (!status)
{
ok(final_size == 4100, "got wrong final_size %d\n", final_size);
@@ -2106,7 +2099,8 @@ static void test_RtlDecompressBuffer(void)
memset(buf, 0x11, sizeof(buf));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, 4097, test_multiple_chunks,
sizeof(test_multiple_chunks), &final_size);
- ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
+ ok(status == STATUS_SUCCESS || broken(status == STATUS_BAD_COMPRESSION_BUFFER),
+ "got wrong status 0x%08x\n", status);
if (!status)
{
ok(final_size == 4097, "got wrong final_size %d\n", final_size);
@@ -2120,7 +2114,8 @@ static void test_RtlDecompressBuffer(void)
memset(buf, 0x11, sizeof(buf));
status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, 4096, test_multiple_chunks,
sizeof(test_multiple_chunks), &final_size);
- ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
+ ok(status == STATUS_SUCCESS || broken(status == STATUS_BAD_COMPRESSION_BUFFER),
+ "got wrong status 0x%08x\n", status);
if (!status)
{
ok(final_size == 4, "got wrong final_size %d\n", final_size);
--
2.3.1

View File

@ -1,4 +1,4 @@
From 0200b5ccf86d7b87846f4d8c98f9ac0775e810d8 Mon Sep 17 00:00:00 2001
From 14cab3188b8f83081a686892d94594a30abebf14 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more+wine@gmail.com>
Date: Sun, 8 Mar 2015 18:24:45 +0100
Subject: ntdll/tests: Tests for RtlIpv6StringToAddress (try 6)
@ -22,7 +22,7 @@ duplication
1 file changed, 430 insertions(+)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 2f6c421..d4c83c2 100644
index 4903790..47acfe9 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -25,6 +25,7 @@
@ -488,14 +488,14 @@ index 2f6c421..d4c83c2 100644
static void test_LdrAddRefDll(void)
{
HMODULE mod, mod2;
@@ -2360,6 +2789,7 @@ START_TEST(rtl)
@@ -2186,6 +2615,7 @@ START_TEST(rtl)
test_RtlIpv4AddressToString();
test_RtlIpv4AddressToStringEx();
test_RtlIpv4StringToAddress();
+ test_RtlIpv6StringToAddress();
test_LdrAddRefDll();
test_LdrLockLoaderLock();
test_RtlGetCompressionWorkSpaceSize();
test_RtlCompressBuffer();
--
2.3.1
2.4.5

View File

@ -1,4 +1,4 @@
From 486707397ce18ce3f92f0ffbc388626312d9f952 Mon Sep 17 00:00:00 2001
From 7b6d523f37901554bfdb17e301dd25e50a899e22 Mon Sep 17 00:00:00 2001
From: Mark Jansen <learn0more+wine@gmail.com>
Date: Sun, 8 Mar 2015 18:24:50 +0100
Subject: ntdll/tests: Tests for RtlIpv6StringToAddressEx (try 6)
@ -21,7 +21,7 @@ Changes from try3:
1 file changed, 268 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index d4c83c2..b389d6f 100644
index 47acfe9..f5bbbb3 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -92,6 +92,8 @@ static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, L
@ -320,14 +320,14 @@ index d4c83c2..b389d6f 100644
static void test_LdrAddRefDll(void)
{
HMODULE mod, mod2;
@@ -2790,6 +3056,7 @@ START_TEST(rtl)
@@ -2616,6 +2882,7 @@ START_TEST(rtl)
test_RtlIpv4AddressToStringEx();
test_RtlIpv4StringToAddress();
test_RtlIpv6StringToAddress();
+ test_RtlIpv6StringToAddressEx();
test_LdrAddRefDll();
test_LdrLockLoaderLock();
test_RtlGetCompressionWorkSpaceSize();
test_RtlCompressBuffer();
--
2.3.1
2.4.5

View File

@ -55,7 +55,7 @@ version()
echo "Copyright (C) 2014-2015 the Wine Staging project authors."
echo ""
echo "Patchset to be applied on upstream Wine:"
echo " commit 47a11ec626dc8888442ab0f5eb943e1d33048114"
echo " commit cf7a118a9e5922d819f216c21c3a0984c7bde5dd"
echo ""
}
@ -3547,20 +3547,16 @@ fi
# | * [#37449] Support for RtlDecompressBuffer
# |
# | Modified files:
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/rtl.c, dlls/ntdll/tests/rtl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, include/winnt.h
# | * dlls/ntdll/ntdll.spec, dlls/ntdll/rtl.c, dlls/ntdll/tests/rtl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec
# |
if test "$enable_ntdll_LZNT1_Compression" -eq 1; then
patch_apply ntdll-LZNT1_Compression/0001-ntdll-Implement-semi-stub-for-RtlGetCompressionWorkS.patch
patch_apply ntdll-LZNT1_Compression/0002-ntdll-Implement-semi-stub-for-RtlCompressBuffer.patch
patch_apply ntdll-LZNT1_Compression/0003-ntdll-Implement-LZNT1-algorithm-for-RtlDecompressBuf.patch
patch_apply ntdll-LZNT1_Compression/0004-ntdll-tests-Add-tests-for-Rtl-Decompress-Compress-Bu.patch
patch_apply ntdll-LZNT1_Compression/0005-ntdll-tests-Fix-various-test-failures-caused-by-brok.patch
patch_apply ntdll-LZNT1_Compression/0001-ntdll-Implement-RtlDecompressFragment.patch
patch_apply ntdll-LZNT1_Compression/0002-ntdll-tests-Add-tests-for-RtlDecompressBuffer.patch
patch_apply ntdll-LZNT1_Compression/0003-ntdll-tests-Add-tests-for-RtlDecompressFragment.patch
(
echo '+ { "Sebastian Lackner", "ntdll: Implement semi-stub for RtlGetCompressionWorkSpaceSize.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Implement semi-stub for RtlCompressBuffer.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Implement LZNT1 algorithm for RtlDecompressBuffer.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for Rtl[Decompress|Compress]Buffer and RtlGetCompressionWorkSpaceSize.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll/tests: Fix various test failures caused by broken RtlDecompressBuffer results.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll: Implement RtlDecompressFragment.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for RtlDecompressBuffer.", 1 },';
echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for RtlDecompressFragment.", 1 },';
) >> "$patchlist"
fi

File diff suppressed because it is too large Load Diff