Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
db1e8a68
Commit
db1e8a68
authored
Jul 10, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jul 10, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for RtlDecompressFragment.
parent
0e7bd455
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
4 deletions
+89
-4
rtl.c
dlls/ntdll/tests/rtl.c
+89
-4
No files found.
dlls/ntdll/tests/rtl.c
View file @
db1e8a68
...
...
@@ -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
);
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment