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
917002c8
Commit
917002c8
authored
May 25, 2020
by
Alex Henrie
Committed by
Alexandre Julliard
May 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Drop RTL function workarounds for Windows <= 2000.
Signed-off-by:
Alex Henrie
<
alexhenrie24@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e3d2d852
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
326 deletions
+133
-326
rtl.c
dlls/ntdll/tests/rtl.c
+133
-326
No files found.
dlls/ntdll/tests/rtl.c
View file @
917002c8
...
...
@@ -26,6 +26,7 @@
#include "ntdll_test.h"
#include "in6addr.h"
#include "inaddr.h"
#include "ip2string.h"
#ifndef __WINE_WINTERNL_H
...
...
@@ -63,53 +64,23 @@ static inline USHORT __my_ushort_swap(USHORT s)
/* Function ptrs for ntdll calls */
static
HMODULE
hntdll
=
0
;
static
SIZE_T
(
WINAPI
*
pRtlCompareMemory
)(
LPCVOID
,
LPCVOID
,
SIZE_T
);
static
SIZE_T
(
WINAPI
*
pRtlCompareMemoryUlong
)(
PULONG
,
SIZE_T
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlDeleteTimer
)(
HANDLE
,
HANDLE
,
HANDLE
);
static
VOID
(
WINAPI
*
pRtlMoveMemory
)(
LPVOID
,
LPCVOID
,
SIZE_T
);
static
VOID
(
WINAPI
*
pRtlFillMemory
)(
LPVOID
,
SIZE_T
,
BYTE
);
static
VOID
(
WINAPI
*
pRtlFillMemoryUlong
)(
LPVOID
,
SIZE_T
,
ULONG
);
static
VOID
(
WINAPI
*
pRtlZeroMemory
)(
LPVOID
,
SIZE_T
);
static
ULONGLONG
(
WINAPIV
*
pRtlUlonglongByteSwap
)(
ULONGLONG
source
);
static
ULONG
(
WINAPI
*
pRtlUniform
)(
PULONG
);
static
ULONG
(
WINAPI
*
pRtlRandom
)(
PULONG
);
static
BOOLEAN
(
WINAPI
*
pRtlAreAllAccessesGranted
)(
ACCESS_MASK
,
ACCESS_MASK
);
static
BOOLEAN
(
WINAPI
*
pRtlAreAnyAccessesGranted
)(
ACCESS_MASK
,
ACCESS_MASK
);
static
DWORD
(
WINAPI
*
pRtlComputeCrc32
)(
DWORD
,
const
BYTE
*
,
INT
);
static
void
(
WINAPI
*
pRtlInitializeHandleTable
)(
ULONG
,
ULONG
,
RTL_HANDLE_TABLE
*
);
static
BOOLEAN
(
WINAPI
*
pRtlIsValidIndexHandle
)(
const
RTL_HANDLE_TABLE
*
,
ULONG
,
RTL_HANDLE
**
);
static
NTSTATUS
(
WINAPI
*
pRtlDestroyHandleTable
)(
RTL_HANDLE_TABLE
*
);
static
RTL_HANDLE
*
(
WINAPI
*
pRtlAllocateHandle
)(
RTL_HANDLE_TABLE
*
,
ULONG
*
);
static
BOOLEAN
(
WINAPI
*
pRtlFreeHandle
)(
RTL_HANDLE_TABLE
*
,
RTL_HANDLE
*
);
static
NTSTATUS
(
WINAPI
*
pRtlAllocateAndInitializeSid
)(
PSID_IDENTIFIER_AUTHORITY
,
BYTE
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
PSID
*
);
static
NTSTATUS
(
WINAPI
*
pRtlFreeSid
)(
PSID
);
static
DWORD
(
WINAPI
*
pRtlGetThreadErrorMode
)(
void
);
static
NTSTATUS
(
WINAPI
*
pRtlSetThreadErrorMode
)(
DWORD
,
LPDWORD
);
static
IMAGE_BASE_RELOCATION
*
(
WINAPI
*
pLdrProcessRelocationBlock
)(
void
*
,
UINT
,
USHORT
*
,
INT_PTR
);
static
CHAR
*
(
WINAPI
*
pRtlIpv4AddressToStringA
)(
const
IN_ADDR
*
,
LPSTR
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv4AddressToStringExA
)(
const
IN_ADDR
*
,
USHORT
,
LPSTR
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv4StringToAddressA
)(
PCSTR
,
BOOLEAN
,
PCSTR
*
,
IN_ADDR
*
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv4StringToAddressExA
)(
PCSTR
,
BOOLEAN
,
IN_ADDR
*
,
PUSHORT
);
static
CHAR
*
(
WINAPI
*
pRtlIpv6AddressToStringA
)(
struct
in6_addr
*
,
PSTR
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv6AddressToStringExA
)(
struct
in6_addr
*
,
ULONG
,
USHORT
,
PCHAR
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv6StringToAddressA
)(
PCSTR
,
PCSTR
*
,
struct
in6_addr
*
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv6StringToAddressW
)(
PCWSTR
,
PCWSTR
*
,
struct
in6_addr
*
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv6StringToAddressExA
)(
PCSTR
,
struct
in6_addr
*
,
PULONG
,
PUSHORT
);
static
NTSTATUS
(
WINAPI
*
pRtlIpv6StringToAddressExW
)(
PCWSTR
,
struct
in6_addr
*
,
PULONG
,
PUSHORT
);
static
NTSTATUS
(
WINAPI
*
pLdrAddRefDll
)(
ULONG
,
HMODULE
);
static
NTSTATUS
(
WINAPI
*
pLdrLockLoaderLock
)(
ULONG
,
ULONG
*
,
ULONG_PTR
*
);
static
NTSTATUS
(
WINAPI
*
pLdrUnlockLoaderLock
)(
ULONG
,
ULONG_PTR
);
static
NTSTATUS
(
WINAPI
*
pRtlMultiByteToUnicodeN
)(
LPWSTR
,
DWORD
,
LPDWORD
,
LPCSTR
,
DWORD
);
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
BOOL
(
WINAPI
*
pRtlIsCriticalSectionLocked
)(
CRITICAL_SECTION
*
);
static
BOOL
(
WINAPI
*
pRtlIsCriticalSectionLockedByThread
)(
CRITICAL_SECTION
*
);
static
NTSTATUS
(
WINAPI
*
pRtlInitializeCriticalSectionEx
)(
CRITICAL_SECTION
*
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pLdrEnumerateLoadedModules
)(
void
*
,
void
*
,
void
*
);
static
NTSTATUS
(
WINAPI
*
pRtlMakeSelfRelativeSD
)(
PSECURITY_DESCRIPTOR
,
PSECURITY_DESCRIPTOR
,
LPDWORD
);
static
NTSTATUS
(
WINAPI
*
pRtlAbsoluteToSelfRelativeSD
)(
PSECURITY_DESCRIPTOR
,
PSECURITY_DESCRIPTOR
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pLdrRegisterDllNotification
)(
ULONG
,
PLDR_DLL_NOTIFICATION_FUNCTION
,
void
*
,
void
**
);
static
NTSTATUS
(
WINAPI
*
pLdrUnregisterDllNotification
)(
void
*
);
...
...
@@ -134,53 +105,23 @@ static void InitFunctionPtrs(void)
hntdll
=
LoadLibraryA
(
"ntdll.dll"
);
ok
(
hntdll
!=
0
,
"LoadLibrary failed
\n
"
);
if
(
hntdll
)
{
pRtlCompareMemory
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlCompareMemory"
);
pRtlCompareMemoryUlong
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlCompareMemoryUlong"
);
pRtlDeleteTimer
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDeleteTimer"
);
pRtlMoveMemory
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlMoveMemory"
);
pRtlFillMemory
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFillMemory"
);
pRtlFillMemoryUlong
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFillMemoryUlong"
);
pRtlZeroMemory
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlZeroMemory"
);
pRtlUlonglongByteSwap
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlUlonglongByteSwap"
);
pRtlUniform
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlUniform"
);
pRtlRandom
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlRandom"
);
pRtlAreAllAccessesGranted
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAreAllAccessesGranted"
);
pRtlAreAnyAccessesGranted
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAreAnyAccessesGranted"
);
pRtlComputeCrc32
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlComputeCrc32"
);
pRtlInitializeHandleTable
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitializeHandleTable"
);
pRtlIsValidIndexHandle
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIsValidIndexHandle"
);
pRtlDestroyHandleTable
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDestroyHandleTable"
);
pRtlAllocateHandle
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAllocateHandle"
);
pRtlFreeHandle
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFreeHandle"
);
pRtlAllocateAndInitializeSid
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAllocateAndInitializeSid"
);
pRtlFreeSid
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFreeSid"
);
pRtlGetThreadErrorMode
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlGetThreadErrorMode"
);
pRtlSetThreadErrorMode
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlSetThreadErrorMode"
);
pLdrProcessRelocationBlock
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrProcessRelocationBlock"
);
pRtlIpv4AddressToStringA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv4AddressToStringA"
);
pRtlIpv4AddressToStringExA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv4AddressToStringExA"
);
pRtlIpv4StringToAddressA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv4StringToAddressA"
);
pRtlIpv4StringToAddressExA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv4StringToAddressExA"
);
pRtlIpv6AddressToStringA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6AddressToStringA"
);
pRtlIpv6AddressToStringExA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6AddressToStringExA"
);
pRtlIpv6StringToAddressA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6StringToAddressA"
);
pRtlIpv6StringToAddressW
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6StringToAddressW"
);
pRtlIpv6StringToAddressExA
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6StringToAddressExA"
);
pRtlIpv6StringToAddressExW
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIpv6StringToAddressExW"
);
pLdrAddRefDll
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrAddRefDll"
);
pLdrLockLoaderLock
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrLockLoaderLock"
);
pLdrUnlockLoaderLock
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrUnlockLoaderLock"
);
pRtlMultiByteToUnicodeN
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlMultiByteToUnicodeN"
);
pRtlGetCompressionWorkSpaceSize
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlGetCompressionWorkSpaceSize"
);
pRtlDecompressBuffer
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDecompressBuffer"
);
pRtlDecompressFragment
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDecompressFragment"
);
pRtlCompressBuffer
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlCompressBuffer"
);
pRtlIsCriticalSectionLocked
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIsCriticalSectionLocked"
);
pRtlIsCriticalSectionLockedByThread
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlIsCriticalSectionLockedByThread"
);
pRtlInitializeCriticalSectionEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitializeCriticalSectionEx"
);
pLdrEnumerateLoadedModules
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrEnumerateLoadedModules"
);
pRtlMakeSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlMakeSelfRelativeSD"
);
pRtlAbsoluteToSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAbsoluteToSelfRelativeSD"
);
pLdrRegisterDllNotification
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrRegisterDllNotification"
);
pLdrUnregisterDllNotification
=
(
void
*
)
GetProcAddress
(
hntdll
,
"LdrUnregisterDllNotification"
);
}
...
...
@@ -193,19 +134,13 @@ static void InitFunctionPtrs(void)
ok
(
strlen
(
src
)
==
15
,
"Source must be 16 bytes long!
\n
"
);
}
#define COMP(str1,str2,cmplen,len) size =
p
RtlCompareMemory(str1, str2, cmplen); \
#define COMP(str1,str2,cmplen,len) size = RtlCompareMemory(str1, str2, cmplen); \
ok(size == len, "Expected %ld, got %ld\n", size, (SIZE_T)len)
static
void
test_RtlCompareMemory
(
void
)
{
SIZE_T
size
;
if
(
!
pRtlCompareMemory
)
{
win_skip
(
"RtlCompareMemory is not available
\n
"
);
return
;
}
strcpy
(
dest
,
src
);
COMP
(
src
,
src
,
0
,
0
);
...
...
@@ -219,49 +154,43 @@ static void test_RtlCompareMemoryUlong(void)
ULONG
a
[
10
];
ULONG
result
;
if
(
!
pRtlCompareMemoryUlong
)
{
win_skip
(
"RtlCompareMemoryUlong is not available
\n
"
);
return
;
}
a
[
0
]
=
0x0123
;
a
[
1
]
=
0x4567
;
a
[
2
]
=
0x89ab
;
a
[
3
]
=
0xcdef
;
result
=
p
RtlCompareMemoryUlong
(
a
,
0
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
0
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 0, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
4
,
0x0127
);
result
=
RtlCompareMemoryUlong
(
a
,
4
,
0x0127
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x0127) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
4
,
0x7123
);
result
=
RtlCompareMemoryUlong
(
a
,
4
,
0x7123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 4, 0x7123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
16
,
0x4567
);
result
=
RtlCompareMemoryUlong
(
a
,
16
,
0x4567
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 16, 0x4567) returns %u, expected 0
\n
"
,
a
,
result
);
a
[
1
]
=
0x0123
;
result
=
p
RtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
3
,
0x0123
);
ok
(
result
==
0
,
"RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
4
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
5
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
7
,
0x0123
);
ok
(
result
==
4
,
"RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
8
,
0x0123
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 8
\n
"
,
a
,
result
);
result
=
p
RtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
result
=
RtlCompareMemoryUlong
(
a
,
9
,
0x0123
);
ok
(
result
==
8
,
"RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 8
\n
"
,
a
,
result
);
}
...
...
@@ -382,12 +311,6 @@ static void test_RtlUlonglongByteSwap(void)
return
;
}
if
(
pRtlUlonglongByteSwap
(
0
)
!=
0
)
{
win_skip
(
"Broken RtlUlonglongByteSwap in win2k
\n
"
);
return
;
}
result
=
pRtlUlonglongByteSwap
(
((
ULONGLONG
)
0x76543210
<<
32
)
|
0x87654321
);
ok
(
(((
ULONGLONG
)
0x21436587
<<
32
)
|
0x10325476
)
==
result
,
"RtlUlonglongByteSwap(0x7654321087654321) returns 0x%s, expected 0x2143658710325476
\n
"
,
...
...
@@ -403,12 +326,6 @@ static void test_RtlUniform(void)
ULONG
expected
;
ULONG
result
;
if
(
!
pRtlUniform
)
{
win_skip
(
"RtlUniform is not available
\n
"
);
return
;
}
/*
* According to the documentation RtlUniform is using D.H. Lehmer's 1948
* algorithm. This algorithm is:
...
...
@@ -429,7 +346,7 @@ static void test_RtlUniform(void)
*/
seed
=
0
;
expected
=
0x7fffffc3
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0)) returns %x, expected %x
\n
"
,
result
,
expected
);
...
...
@@ -450,7 +367,7 @@ static void test_RtlUniform(void)
*/
seed
=
1
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
1
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 1)) returns %x, expected %x
\n
"
,
result
,
expected
);
...
...
@@ -459,7 +376,7 @@ static void test_RtlUniform(void)
*/
seed
=
2
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
/*
* Windows Vista uses different algorithms, so skip the rest of the tests
...
...
@@ -480,21 +397,21 @@ static void test_RtlUniform(void)
*/
seed
=
3
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
(
seed
&
1
);
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 3)) returns %x, expected %x
\n
"
,
result
,
expected
);
seed
=
0x6bca1aa
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1aa)) returns %x, expected %x
\n
"
,
result
,
expected
);
seed
=
0x6bca1ab
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
1
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ab)) returns %x, expected %x
\n
"
,
result
,
expected
);
...
...
@@ -503,7 +420,7 @@ static void test_RtlUniform(void)
*/
seed
=
0x6bca1ac
;
expected
=
seed
*
0xffffffed
+
0x7fffffc3
+
2
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ac)) returns %x, expected %x
\n
"
,
result
,
expected
);
...
...
@@ -515,14 +432,14 @@ static void test_RtlUniform(void)
*/
seed
=
0x6bca1ad
;
expected
=
(
seed
*
0xffffffed
+
0x7fffffc3
)
&
MAXLONG
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ad)) returns %x, expected %x
\n
"
,
result
,
expected
);
seed
=
0x6bca1ae
;
expected
=
(
seed
*
0xffffffed
+
0x7fffffc3
+
1
)
&
MAXLONG
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"RtlUniform(&seed (seed == 0x6bca1ae)) returns %x, expected %x
\n
"
,
result
,
expected
);
...
...
@@ -630,7 +547,7 @@ static void test_RtlUniform(void)
expected
=
expected
+
(
seed
&
1
);
}
/* if */
seed_bak
=
seed
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"test: 0x%s RtlUniform(&seed (seed == %x)) returns %x, expected %x
\n
"
,
wine_dbgstr_longlong
(
num
),
seed_bak
,
result
,
expected
);
...
...
@@ -677,7 +594,7 @@ static void test_RtlUniform(void)
for
(
num
=
0
;
num
<=
100000
;
num
++
)
{
expected
=
(
seed
*
0x7fffffed
+
0x7fffffc3
)
%
0x7fffffff
;
seed_bak
=
seed
;
result
=
p
RtlUniform
(
&
seed
);
result
=
RtlUniform
(
&
seed
);
ok
(
result
==
expected
,
"test: 0x%s RtlUniform(&seed (seed == %x)) returns %x, expected %x
\n
"
,
wine_dbgstr_longlong
(
num
),
seed_bak
,
result
,
expected
);
...
...
@@ -699,16 +616,10 @@ static void test_RtlRandom(void)
ULONG
seed
;
ULONG
res
[
512
];
if
(
!
pRtlRandom
)
{
win_skip
(
"RtlRandom is not available
\n
"
);
return
;
}
seed
=
0
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
res
);
i
++
)
{
res
[
i
]
=
p
RtlRandom
(
&
seed
);
res
[
i
]
=
RtlRandom
(
&
seed
);
ok
(
seed
!=
res
[
i
],
"%i: seed is same as res %x
\n
"
,
i
,
seed
);
for
(
j
=
0
;
j
<
i
;
j
++
)
ok
(
res
[
i
]
!=
res
[
j
],
"res[%i] (%x) is same as res[%i] (%x)
\n
"
,
j
,
res
[
j
],
i
,
res
[
i
]);
...
...
@@ -741,15 +652,9 @@ static void test_RtlAreAllAccessesGranted(void)
unsigned
int
test_num
;
BOOLEAN
result
;
if
(
!
pRtlAreAllAccessesGranted
)
{
win_skip
(
"RtlAreAllAccessesGranted is not available
\n
"
);
return
;
}
for
(
test_num
=
0
;
test_num
<
ARRAY_SIZE
(
all_accesses
);
test_num
++
)
{
result
=
p
RtlAreAllAccessesGranted
(
all_accesses
[
test_num
].
GrantedAccess
,
all_accesses
[
test_num
].
DesiredAccess
);
result
=
RtlAreAllAccessesGranted
(
all_accesses
[
test_num
].
GrantedAccess
,
all_accesses
[
test_num
].
DesiredAccess
);
ok
(
all_accesses
[
test_num
].
result
==
result
,
"(test %d): RtlAreAllAccessesGranted(%08x, %08x) returns %d, expected %d
\n
"
,
test_num
,
all_accesses
[
test_num
].
GrantedAccess
,
...
...
@@ -783,15 +688,9 @@ static void test_RtlAreAnyAccessesGranted(void)
unsigned
int
test_num
;
BOOLEAN
result
;
if
(
!
pRtlAreAnyAccessesGranted
)
{
win_skip
(
"RtlAreAnyAccessesGranted is not available
\n
"
);
return
;
}
for
(
test_num
=
0
;
test_num
<
ARRAY_SIZE
(
any_accesses
);
test_num
++
)
{
result
=
p
RtlAreAnyAccessesGranted
(
any_accesses
[
test_num
].
GrantedAccess
,
any_accesses
[
test_num
].
DesiredAccess
);
result
=
RtlAreAnyAccessesGranted
(
any_accesses
[
test_num
].
GrantedAccess
,
any_accesses
[
test_num
].
DesiredAccess
);
ok
(
any_accesses
[
test_num
].
result
==
result
,
"(test %d): RtlAreAnyAccessesGranted(%08x, %08x) returns %d, expected %d
\n
"
,
test_num
,
any_accesses
[
test_num
].
GrantedAccess
,
...
...
@@ -804,13 +703,7 @@ static void test_RtlComputeCrc32(void)
{
DWORD
crc
=
0
;
if
(
!
pRtlComputeCrc32
)
{
win_skip
(
"RtlComputeCrc32 is not available
\n
"
);
return
;
}
crc
=
pRtlComputeCrc32
(
crc
,
(
const
BYTE
*
)
src
,
LEN
);
crc
=
RtlComputeCrc32
(
crc
,
(
const
BYTE
*
)
src
,
LEN
);
ok
(
crc
==
0x40861dc2
,
"Expected 0x40861dc2, got %8x
\n
"
,
crc
);
}
...
...
@@ -835,22 +728,16 @@ static void test_HandleTables(void)
MY_HANDLE
*
MyHandle
;
RTL_HANDLE_TABLE
HandleTable
;
if
(
!
pRtlInitializeHandleTable
)
{
win_skip
(
"RtlInitializeHandleTable is not available
\n
"
);
return
;
}
pRtlInitializeHandleTable
(
0x3FFF
,
sizeof
(
MY_HANDLE
),
&
HandleTable
);
MyHandle
=
(
MY_HANDLE
*
)
pRtlAllocateHandle
(
&
HandleTable
,
&
Index
);
RtlInitializeHandleTable
(
0x3FFF
,
sizeof
(
MY_HANDLE
),
&
HandleTable
);
MyHandle
=
(
MY_HANDLE
*
)
RtlAllocateHandle
(
&
HandleTable
,
&
Index
);
ok
(
MyHandle
!=
NULL
,
"RtlAllocateHandle failed
\n
"
);
RtlpMakeHandleAllocated
(
&
MyHandle
->
RtlHandle
);
MyHandle
=
NULL
;
result
=
p
RtlIsValidIndexHandle
(
&
HandleTable
,
Index
,
(
RTL_HANDLE
**
)
&
MyHandle
);
result
=
RtlIsValidIndexHandle
(
&
HandleTable
,
Index
,
(
RTL_HANDLE
**
)
&
MyHandle
);
ok
(
result
,
"Handle %p wasn't valid
\n
"
,
MyHandle
);
result
=
p
RtlFreeHandle
(
&
HandleTable
,
&
MyHandle
->
RtlHandle
);
result
=
RtlFreeHandle
(
&
HandleTable
,
&
MyHandle
->
RtlHandle
);
ok
(
result
,
"Couldn't free handle %p
\n
"
,
MyHandle
);
status
=
p
RtlDestroyHandleTable
(
&
HandleTable
);
status
=
RtlDestroyHandleTable
(
&
HandleTable
);
ok
(
status
==
STATUS_SUCCESS
,
"RtlDestroyHandleTable failed with error 0x%08x
\n
"
,
status
);
}
...
...
@@ -860,25 +747,19 @@ static void test_RtlAllocateAndInitializeSid(void)
SID_IDENTIFIER_AUTHORITY
sia
=
{{
1
,
2
,
3
,
4
,
5
,
6
}};
PSID
psid
;
if
(
!
pRtlAllocateAndInitializeSid
)
{
win_skip
(
"RtlAllocateAndInitializeSid is not available
\n
"
);
return
;
}
ret
=
pRtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ret
=
RtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
!
ret
,
"RtlAllocateAndInitializeSid error %08x
\n
"
,
ret
);
ret
=
p
RtlFreeSid
(
psid
);
ret
=
RtlFreeSid
(
psid
);
ok
(
!
ret
,
"RtlFreeSid error %08x
\n
"
,
ret
);
/* these tests crash on XP */
if
(
0
)
{
p
RtlAllocateAndInitializeSid
(
NULL
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
p
RtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
NULL
);
RtlAllocateAndInitializeSid
(
NULL
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
RtlAllocateAndInitializeSid
(
&
sia
,
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
NULL
);
}
ret
=
p
RtlAllocateAndInitializeSid
(
&
sia
,
9
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ret
=
RtlAllocateAndInitializeSid
(
&
sia
,
9
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
&
psid
);
ok
(
ret
==
STATUS_INVALID_SID
,
"wrong error %08x
\n
"
,
ret
);
}
...
...
@@ -886,13 +767,7 @@ static void test_RtlDeleteTimer(void)
{
NTSTATUS
ret
;
if
(
!
pRtlDeleteTimer
)
{
win_skip
(
"RtlDeleteTimer is not available
\n
"
);
return
;
}
ret
=
pRtlDeleteTimer
(
NULL
,
NULL
,
NULL
);
ret
=
RtlDeleteTimer
(
NULL
,
NULL
,
NULL
);
ok
(
ret
==
STATUS_INVALID_PARAMETER_1
||
ret
==
STATUS_INVALID_PARAMETER
,
/* W2K */
"expected STATUS_INVALID_PARAMETER_1 or STATUS_INVALID_PARAMETER, got %x
\n
"
,
ret
);
...
...
@@ -973,26 +848,21 @@ static void test_LdrProcessRelocationBlock(void)
DWORD
addr32
;
SHORT
addr16
;
if
(
!
pLdrProcessRelocationBlock
)
{
win_skip
(
"LdrProcessRelocationBlock not available
\n
"
);
return
;
}
addr32
=
0x50005
;
reloc
=
IMAGE_REL_BASED_HIGHLOW
<<
12
;
ret
=
p
LdrProcessRelocationBlock
(
&
addr32
,
1
,
&
reloc
,
0x500050
);
ret
=
LdrProcessRelocationBlock
(
&
addr32
,
1
,
&
reloc
,
0x500050
);
ok
((
USHORT
*
)
ret
==
&
reloc
+
1
,
"ret = %p, expected %p
\n
"
,
ret
,
&
reloc
+
1
);
ok
(
addr32
==
0x550055
,
"addr32 = %x, expected 0x550055
\n
"
,
addr32
);
addr16
=
0x505
;
reloc
=
IMAGE_REL_BASED_HIGH
<<
12
;
ret
=
p
LdrProcessRelocationBlock
(
&
addr16
,
1
,
&
reloc
,
0x500060
);
ret
=
LdrProcessRelocationBlock
(
&
addr16
,
1
,
&
reloc
,
0x500060
);
ok
((
USHORT
*
)
ret
==
&
reloc
+
1
,
"ret = %p, expected %p
\n
"
,
ret
,
&
reloc
+
1
);
ok
(
addr16
==
0x555
,
"addr16 = %x, expected 0x555
\n
"
,
addr16
);
addr16
=
0x505
;
reloc
=
IMAGE_REL_BASED_LOW
<<
12
;
ret
=
p
LdrProcessRelocationBlock
(
&
addr16
,
1
,
&
reloc
,
0x500060
);
ret
=
LdrProcessRelocationBlock
(
&
addr16
,
1
,
&
reloc
,
0x500060
);
ok
((
USHORT
*
)
ret
==
&
reloc
+
1
,
"ret = %p, expected %p
\n
"
,
ret
,
&
reloc
+
1
);
ok
(
addr16
==
0x565
,
"addr16 = %x, expected 0x565
\n
"
,
addr16
);
}
...
...
@@ -1004,12 +874,6 @@ static void test_RtlIpv4AddressToString(void)
IN_ADDR
ip
;
DWORD_PTR
len
;
if
(
!
pRtlIpv4AddressToStringA
)
{
win_skip
(
"RtlIpv4AddressToStringA not available
\n
"
);
return
;
}
ip
.
S_un
.
S_un_b
.
s_b1
=
1
;
ip
.
S_un
.
S_un_b
.
s_b2
=
2
;
ip
.
S_un
.
S_un_b
.
s_b3
=
3
;
...
...
@@ -1017,11 +881,11 @@ static void test_RtlIpv4AddressToString(void)
memset
(
buffer
,
'#'
,
sizeof
(
buffer
)
-
1
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
0
;
res
=
p
RtlIpv4AddressToStringA
(
&
ip
,
buffer
);
res
=
RtlIpv4AddressToStringA
(
&
ip
,
buffer
);
len
=
strlen
(
buffer
);
ok
(
res
==
(
buffer
+
len
),
"got %p with '%s' (expected %p)
\n
"
,
res
,
buffer
,
buffer
+
len
);
res
=
p
RtlIpv4AddressToStringA
(
&
ip
,
NULL
);
res
=
RtlIpv4AddressToStringA
(
&
ip
,
NULL
);
ok
(
(
res
==
(
char
*
)
~
0
)
||
broken
(
res
==
(
char
*
)
len
),
/* XP and w2003 */
"got %p (expected ~0)
\n
"
,
res
);
...
...
@@ -1030,13 +894,13 @@ static void test_RtlIpv4AddressToString(void)
/* this crashes in windows */
memset
(
buffer
,
'#'
,
sizeof
(
buffer
)
-
1
);
buffer
[
sizeof
(
buffer
)
-
1
]
=
0
;
res
=
p
RtlIpv4AddressToStringA
(
NULL
,
buffer
);
res
=
RtlIpv4AddressToStringA
(
NULL
,
buffer
);
trace
(
"got %p with '%s'
\n
"
,
res
,
buffer
);
}
if
(
0
)
{
/* this crashes in windows */
res
=
p
RtlIpv4AddressToStringA
(
NULL
,
NULL
);
res
=
RtlIpv4AddressToStringA
(
NULL
,
NULL
);
trace
(
"got %p
\n
"
,
res
);
}
}
...
...
@@ -1292,23 +1156,17 @@ static void test_RtlIpv4StringToAddress(void)
CHAR
dummy
;
int
i
;
if
(
!
pRtlIpv4StringToAddressA
)
{
skip
(
"RtlIpv4StringToAddress not available
\n
"
);
return
;
}
if
(
0
)
{
/* leaving either parameter NULL crashes on Windows */
res
=
p
RtlIpv4StringToAddressA
(
NULL
,
FALSE
,
&
terminator
,
&
ip
);
res
=
p
RtlIpv4StringToAddressA
(
"1.1.1.1"
,
FALSE
,
NULL
,
&
ip
);
res
=
p
RtlIpv4StringToAddressA
(
"1.1.1.1"
,
FALSE
,
&
terminator
,
NULL
);
res
=
RtlIpv4StringToAddressA
(
NULL
,
FALSE
,
&
terminator
,
&
ip
);
res
=
RtlIpv4StringToAddressA
(
"1.1.1.1"
,
FALSE
,
NULL
,
&
ip
);
res
=
RtlIpv4StringToAddressA
(
"1.1.1.1"
,
FALSE
,
&
terminator
,
NULL
);
/* same for the wide char version */
/*
res =
p
RtlIpv4StringToAddressW(NULL, FALSE, &terminatorW, &ip);
res =
p
RtlIpv4StringToAddressW(L"1.1.1.1", FALSE, NULL, &ip);
res =
p
RtlIpv4StringToAddressW(L"1.1.1.1", FALSE, &terminatorW, NULL);
res = RtlIpv4StringToAddressW(NULL, FALSE, &terminatorW, &ip);
res = RtlIpv4StringToAddressW(L"1.1.1.1", FALSE, NULL, &ip);
res = RtlIpv4StringToAddressW(L"1.1.1.1", FALSE, &terminatorW, NULL);
*/
}
...
...
@@ -1317,7 +1175,7 @@ static void test_RtlIpv4StringToAddress(void)
/* non-strict */
terminator
=
&
dummy
;
ip
.
S_un
.
S_addr
=
0xabababab
;
res
=
p
RtlIpv4StringToAddressA
(
ipv4_tests
[
i
].
address
,
FALSE
,
&
terminator
,
&
ip
);
res
=
RtlIpv4StringToAddressA
(
ipv4_tests
[
i
].
address
,
FALSE
,
&
terminator
,
&
ip
);
ok
(
res
==
ipv4_tests
[
i
].
res
,
"[%s] res = 0x%08x, expected 0x%08x
\n
"
,
ipv4_tests
[
i
].
address
,
res
,
ipv4_tests
[
i
].
res
);
...
...
@@ -1342,7 +1200,7 @@ static void test_RtlIpv4StringToAddress(void)
/* strict */
terminator
=
&
dummy
;
ip
.
S_un
.
S_addr
=
0xabababab
;
res
=
p
RtlIpv4StringToAddressA
(
ipv4_tests
[
i
].
address
,
TRUE
,
&
terminator
,
&
ip
);
res
=
RtlIpv4StringToAddressA
(
ipv4_tests
[
i
].
address
,
TRUE
,
&
terminator
,
&
ip
);
ok
(
res
==
ipv4_tests
[
i
].
res_strict
,
"[%s] res = 0x%08x, expected 0x%08x
\n
"
,
ipv4_tests
[
i
].
address
,
res
,
ipv4_tests
[
i
].
res_strict
);
...
...
@@ -2095,14 +1953,11 @@ static void compare_RtlIpv6StringToAddressW(PCSTR name_a, int terminator_offset_
IN6_ADDR
ip
;
PCWSTR
terminator
;
if
(
!
pRtlIpv6StringToAddressW
)
return
;
pRtlMultiByteToUnicodeN
(
name
,
sizeof
(
name
),
NULL
,
name_a
,
strlen
(
name_a
)
+
1
);
RtlMultiByteToUnicodeN
(
name
,
sizeof
(
name
),
NULL
,
name_a
,
strlen
(
name_a
)
+
1
);
init_ip6
(
&
ip
,
NULL
);
terminator
=
(
void
*
)
0xdeadbeef
;
res
=
p
RtlIpv6StringToAddressW
(
name
,
&
terminator
,
&
ip
);
res
=
RtlIpv6StringToAddressW
(
name
,
&
terminator
,
&
ip
);
ok
(
res
==
res_a
,
"[W:%s] res = 0x%08x, expected 0x%08x
\n
"
,
name_a
,
res
,
res_a
);
if
(
terminator_offset_a
<
0
)
...
...
@@ -2134,28 +1989,16 @@ static void test_RtlIpv6StringToAddress(void)
PCSTR
terminator
;
unsigned
int
i
;
if
(
!
pRtlIpv6StringToAddressW
)
{
skip
(
"RtlIpv6StringToAddressW not available
\n
"
);
/* we can continue, just not test W */
}
if
(
!
pRtlIpv6StringToAddressA
)
{
skip
(
"RtlIpv6StringToAddressA not available
\n
"
);
return
;
/* all tests are centered around A, we cannot continue */
}
res
=
pRtlIpv6StringToAddressA
(
"::"
,
&
terminator
,
&
ip
);
res
=
RtlIpv6StringToAddressA
(
"::"
,
&
terminator
,
&
ip
);
ok
(
res
==
STATUS_SUCCESS
,
"[validate] res = 0x%08x, expected STATUS_SUCCESS
\n
"
,
res
);
if
(
0
)
{
/* any of these crash */
res
=
p
RtlIpv6StringToAddressA
(
NULL
,
&
terminator
,
&
ip
);
res
=
RtlIpv6StringToAddressA
(
NULL
,
&
terminator
,
&
ip
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER
\n
"
,
res
);
res
=
p
RtlIpv6StringToAddressA
(
"::"
,
NULL
,
&
ip
);
res
=
RtlIpv6StringToAddressA
(
"::"
,
NULL
,
&
ip
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"[null terminator] res = 0x%08x, expected STATUS_INVALID_PARAMETER
\n
"
,
res
);
res
=
p
RtlIpv6StringToAddressA
(
"::"
,
&
terminator
,
NULL
);
res
=
RtlIpv6StringToAddressA
(
"::"
,
&
terminator
,
NULL
);
ok
(
res
==
STATUS_INVALID_PARAMETER
,
"[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER
\n
"
,
res
);
}
...
...
@@ -2166,7 +2009,7 @@ static void test_RtlIpv6StringToAddress(void)
{
init_ip6
(
&
ip
,
NULL
);
terminator
=
(
void
*
)
0xdeadbeef
;
res
=
p
RtlIpv6StringToAddressA
(
ipv6_tests
[
i
].
address
,
&
terminator
,
&
ip
);
res
=
RtlIpv6StringToAddressA
(
ipv6_tests
[
i
].
address
,
&
terminator
,
&
ip
);
compare_RtlIpv6StringToAddressW
(
ipv6_tests
[
i
].
address
,
(
terminator
!=
(
void
*
)
0xdeadbeef
)
?
(
terminator
-
ipv6_tests
[
i
].
address
)
:
-
1
,
&
ip
,
res
);
...
...
@@ -2221,7 +2064,7 @@ static void compare_RtlIpv6StringToAddressExW(PCSTR name_a, const struct in6_add
if
(
!
pRtlIpv6StringToAddressExW
)
return
;
p
RtlMultiByteToUnicodeN
(
name
,
sizeof
(
name
),
NULL
,
name_a
,
strlen
(
name_a
)
+
1
);
RtlMultiByteToUnicodeN
(
name
,
sizeof
(
name
),
NULL
,
name_a
,
strlen
(
name_a
)
+
1
);
init_ip6
(
&
ip
,
NULL
);
res
=
pRtlIpv6StringToAddressExW
(
name
,
&
ip
,
&
scope
,
&
port
);
...
...
@@ -2478,12 +2321,6 @@ static void test_LdrAddRefDll(void)
NTSTATUS
status
;
BOOL
ret
;
if
(
!
pLdrAddRefDll
)
{
win_skip
(
"LdrAddRefDll not supported
\n
"
);
return
;
}
mod
=
LoadLibraryA
(
"comctl32.dll"
);
ok
(
mod
!=
NULL
,
"got %p
\n
"
,
mod
);
ret
=
FreeLibrary
(
mod
);
...
...
@@ -2495,7 +2332,7 @@ static void test_LdrAddRefDll(void)
/* load, addref and release 2 times */
mod
=
LoadLibraryA
(
"comctl32.dll"
);
ok
(
mod
!=
NULL
,
"got %p
\n
"
,
mod
);
status
=
p
LdrAddRefDll
(
0
,
mod
);
status
=
LdrAddRefDll
(
0
,
mod
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
ret
=
FreeLibrary
(
mod
);
ok
(
ret
,
"got %d
\n
"
,
ret
);
...
...
@@ -2511,7 +2348,7 @@ static void test_LdrAddRefDll(void)
/* pin refcount */
mod
=
LoadLibraryA
(
"comctl32.dll"
);
ok
(
mod
!=
NULL
,
"got %p
\n
"
,
mod
);
status
=
p
LdrAddRefDll
(
LDR_ADDREF_DLL_PIN
,
mod
);
status
=
LdrAddRefDll
(
LDR_ADDREF_DLL_PIN
,
mod
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
ret
=
FreeLibrary
(
mod
);
...
...
@@ -2533,70 +2370,58 @@ static void test_LdrLockLoaderLock(void)
ULONG
result
;
NTSTATUS
status
;
if
(
!
pLdrLockLoaderLock
)
{
win_skip
(
"LdrLockLoaderLock() is not available
\n
"
);
return
;
}
/* invalid flags */
result
=
10
;
magic
=
0xdeadbeef
;
status
=
p
LdrLockLoaderLock
(
0x10
,
&
result
,
&
magic
);
status
=
LdrLockLoaderLock
(
0x10
,
&
result
,
&
magic
);
ok
(
status
==
STATUS_INVALID_PARAMETER_1
,
"got 0x%08x
\n
"
,
status
);
ok
(
result
==
0
,
"got %d
\n
"
,
result
);
ok
(
magic
==
0
,
"got %lx
\n
"
,
magic
);
magic
=
0xdeadbeef
;
status
=
p
LdrLockLoaderLock
(
0x10
,
NULL
,
&
magic
);
status
=
LdrLockLoaderLock
(
0x10
,
NULL
,
&
magic
);
ok
(
status
==
STATUS_INVALID_PARAMETER_1
,
"got 0x%08x
\n
"
,
status
);
ok
(
magic
==
0
,
"got %lx
\n
"
,
magic
);
result
=
10
;
status
=
p
LdrLockLoaderLock
(
0x10
,
&
result
,
NULL
);
status
=
LdrLockLoaderLock
(
0x10
,
&
result
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER_1
,
"got 0x%08x
\n
"
,
status
);
ok
(
result
==
0
,
"got %d
\n
"
,
result
);
/* non-blocking mode, result is null */
magic
=
0xdeadbeef
;
status
=
p
LdrLockLoaderLock
(
0x2
,
NULL
,
&
magic
);
status
=
LdrLockLoaderLock
(
0x2
,
NULL
,
&
magic
);
ok
(
status
==
STATUS_INVALID_PARAMETER_2
,
"got 0x%08x
\n
"
,
status
);
ok
(
magic
==
0
,
"got %lx
\n
"
,
magic
);
/* magic pointer is null */
result
=
10
;
status
=
p
LdrLockLoaderLock
(
0
,
&
result
,
NULL
);
status
=
LdrLockLoaderLock
(
0
,
&
result
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER_3
,
"got 0x%08x
\n
"
,
status
);
ok
(
result
==
0
,
"got %d
\n
"
,
result
);
/* lock in non-blocking mode */
result
=
0
;
magic
=
0
;
status
=
p
LdrLockLoaderLock
(
0x2
,
&
result
,
&
magic
);
status
=
LdrLockLoaderLock
(
0x2
,
&
result
,
&
magic
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
ok
(
result
==
1
,
"got %d
\n
"
,
result
);
ok
(
magic
!=
0
,
"got %lx
\n
"
,
magic
);
p
LdrUnlockLoaderLock
(
0
,
magic
);
LdrUnlockLoaderLock
(
0
,
magic
);
}
static
void
test_RtlCompressBuffer
(
void
)
{
ULONG
compress_workspace
,
decompress_workspace
;
static
const
UCHAR
test_buffer
[]
=
"WineWineWine"
;
static
UCHAR
test_buffer
[]
=
"WineWineWine"
;
static
UCHAR
buf1
[
0x1000
],
buf2
[
0x1000
];
ULONG
final_size
,
buf_size
;
UCHAR
*
workspace
=
NULL
;
NTSTATUS
status
;
if
(
!
pRtlCompressBuffer
||
!
pRtlDecompressBuffer
||
!
pRtlGetCompressionWorkSpaceSize
)
{
win_skip
(
"skipping RtlCompressBuffer tests, required functions not available
\n
"
);
return
;
}
compress_workspace
=
decompress_workspace
=
0xdeadbeef
;
status
=
p
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_SUCCESS
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
(
compress_workspace
!=
0
,
"got wrong compress_workspace %u
\n
"
,
compress_workspace
);
workspace
=
HeapAlloc
(
GetProcessHeap
(),
0
,
compress_workspace
);
...
...
@@ -2604,28 +2429,28 @@ static void test_RtlCompressBuffer(void)
/* test compression format / engine */
final_size
=
0xdeadbeef
;
status
=
p
RtlCompressBuffer
(
COMPRESSION_FORMAT_NONE
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
status
=
RtlCompressBuffer
(
COMPRESSION_FORMAT_NONE
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
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
=
p
RtlCompressBuffer
(
COMPRESSION_FORMAT_DEFAULT
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
status
=
RtlCompressBuffer
(
COMPRESSION_FORMAT_DEFAULT
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
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
=
p
RtlCompressBuffer
(
0xFF
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
status
=
RtlCompressBuffer
(
0xFF
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
)
-
1
,
4096
,
&
final_size
,
workspace
);
ok
(
status
==
STATUS_UNSUPPORTED_COMPRESSION
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
(
final_size
==
0xdeadbeef
,
"got wrong final_size %u
\n
"
,
final_size
);
/* test compression */
final_size
=
0xdeadbeef
;
memset
(
buf1
,
0x11
,
sizeof
(
buf1
));
status
=
p
RtlCompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
),
4096
,
&
final_size
,
workspace
);
status
=
RtlCompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
sizeof
(
buf1
),
4096
,
&
final_size
,
workspace
);
ok
(
status
==
STATUS_SUCCESS
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
((
*
(
WORD
*
)
buf1
&
0x7000
)
==
0x3000
,
"no chunk signature found %04x
\n
"
,
*
(
WORD
*
)
buf1
);
todo_wine
...
...
@@ -2635,8 +2460,8 @@ static void test_RtlCompressBuffer(void)
buf_size
=
final_size
;
final_size
=
0xdeadbeef
;
memset
(
buf2
,
0x11
,
sizeof
(
buf2
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf2
,
sizeof
(
buf2
),
buf1
,
buf_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf2
,
sizeof
(
buf2
),
buf1
,
buf_size
,
&
final_size
);
ok
(
status
==
STATUS_SUCCESS
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
(
final_size
==
sizeof
(
test_buffer
),
"got wrong final_size %u
\n
"
,
final_size
);
ok
(
!
memcmp
(
buf2
,
test_buffer
,
sizeof
(
test_buffer
)),
"got wrong decoded data
\n
"
);
...
...
@@ -2645,8 +2470,8 @@ static void test_RtlCompressBuffer(void)
/* buffer too small */
final_size
=
0xdeadbeef
;
memset
(
buf1
,
0x11
,
sizeof
(
buf1
));
status
=
p
RtlCompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
4
,
4096
,
&
final_size
,
workspace
);
status
=
RtlCompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
test_buffer
,
sizeof
(
test_buffer
),
buf1
,
4
,
4096
,
&
final_size
,
workspace
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"got wrong status 0x%08x
\n
"
,
status
);
HeapFree
(
GetProcessHeap
(),
0
,
workspace
);
...
...
@@ -2657,35 +2482,29 @@ static void test_RtlGetCompressionWorkSpaceSize(void)
ULONG
compress_workspace
,
decompress_workspace
;
NTSTATUS
status
;
if
(
!
pRtlGetCompressionWorkSpaceSize
)
{
win_skip
(
"RtlGetCompressionWorkSpaceSize is not available
\n
"
);
return
;
}
/* test invalid format / engine */
status
=
p
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_NONE
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_NONE
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"got wrong status 0x%08x
\n
"
,
status
);
status
=
p
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_DEFAULT
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_DEFAULT
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"got wrong status 0x%08x
\n
"
,
status
);
status
=
p
RtlGetCompressionWorkSpaceSize
(
0xFF
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
0xFF
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_UNSUPPORTED_COMPRESSION
,
"got wrong status 0x%08x
\n
"
,
status
);
/* test LZNT1 with normal and maximum compression */
compress_workspace
=
decompress_workspace
=
0xdeadbeef
;
status
=
p
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_SUCCESS
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
(
compress_workspace
!=
0
,
"got wrong compress_workspace %u
\n
"
,
compress_workspace
);
ok
(
decompress_workspace
==
0x1000
,
"got wrong decompress_workspace %u
\n
"
,
decompress_workspace
);
compress_workspace
=
decompress_workspace
=
0xdeadbeef
;
status
=
p
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
|
COMPRESSION_ENGINE_MAXIMUM
,
&
compress_workspace
,
&
decompress_workspace
);
status
=
RtlGetCompressionWorkSpaceSize
(
COMPRESSION_FORMAT_LZNT1
|
COMPRESSION_ENGINE_MAXIMUM
,
&
compress_workspace
,
&
decompress_workspace
);
ok
(
status
==
STATUS_SUCCESS
,
"got wrong status 0x%08x
\n
"
,
status
);
ok
(
compress_workspace
!=
0
,
"got wrong compress_workspace %u
\n
"
,
compress_workspace
);
ok
(
decompress_workspace
==
0x1000
,
"got wrong decompress_workspace %u
\n
"
,
decompress_workspace
);
...
...
@@ -2718,7 +2537,7 @@ static BOOL is_incomplete_chunk(const UCHAR *compressed, ULONG compressed_size,
static
void
test_RtlDecompressBuffer
(
void
)
{
static
const
struct
static
struct
{
UCHAR
compressed
[
32
];
ULONG
compressed_size
;
...
...
@@ -2925,28 +2744,22 @@ static void test_RtlDecompressBuffer(void)
ULONG
final_size
;
int
i
;
if
(
!
pRtlDecompressBuffer
||
!
pRtlDecompressFragment
)
{
win_skip
(
"RtlDecompressBuffer or RtlDecompressFragment is not available
\n
"
);
return
;
}
/* test compression format / engine */
final_size
=
0xdeadbeef
;
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_NONE
,
buf
,
sizeof
(
buf
),
test_lznt
[
0
].
compressed
,
test_lznt
[
0
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_DEFAULT
,
buf
,
sizeof
(
buf
),
test_lznt
[
0
].
compressed
,
test_lznt
[
0
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
=
p
RtlDecompressBuffer
(
0xFF
,
buf
,
sizeof
(
buf
),
test_lznt
[
0
].
compressed
,
test_lznt
[
0
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
);
...
...
@@ -2959,8 +2772,8 @@ static void test_RtlDecompressBuffer(void)
/* test with very big buffer */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
)
...
...
@@ -2976,8 +2789,8 @@ static void test_RtlDecompressBuffer(void)
/* test that modifier for compression engine is ignored */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
|
COMPRESSION_ENGINE_MAXIMUM
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
)
...
...
@@ -2995,8 +2808,8 @@ static void test_RtlDecompressBuffer(void)
{
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
test_lznt
[
i
].
uncompressed_size
,
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
)
{
...
...
@@ -3014,8 +2827,8 @@ static void test_RtlDecompressBuffer(void)
{
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
test_lznt
[
i
].
uncompressed_size
-
1
,
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
);
...
...
@@ -3035,8 +2848,8 @@ static void test_RtlDecompressBuffer(void)
/* test with zero output size */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressBuffer
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
0
,
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
&
final_size
);
status
=
RtlDecompressBuffer
(
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
...
...
@@ -3049,8 +2862,8 @@ static void test_RtlDecompressBuffer(void)
/* test RtlDecompressFragment with offset = 0 */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressFragment
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
0
,
&
final_size
,
workspace
);
status
=
RtlDecompressFragment
(
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
);
...
...
@@ -3069,8 +2882,8 @@ static void test_RtlDecompressBuffer(void)
/* test RtlDecompressFragment with offset = 1 */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressFragment
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
1
,
&
final_size
,
workspace
);
status
=
RtlDecompressFragment
(
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
);
...
...
@@ -3099,8 +2912,8 @@ static void test_RtlDecompressBuffer(void)
/* test RtlDecompressFragment with offset = 4095 */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressFragment
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
4095
,
&
final_size
,
workspace
);
status
=
RtlDecompressFragment
(
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
);
...
...
@@ -3118,8 +2931,8 @@ static void test_RtlDecompressBuffer(void)
/* test RtlDecompressFragment with offset = 4096 */
final_size
=
0xdeadbeef
;
memset
(
buf
,
0x11
,
sizeof
(
buf
));
status
=
p
RtlDecompressFragment
(
COMPRESSION_FORMAT_LZNT1
,
buf
,
sizeof
(
buf
),
test_lznt
[
i
].
compressed
,
test_lznt
[
i
].
compressed_size
,
4096
,
&
final_size
,
workspace
);
status
=
RtlDecompressFragment
(
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
);
...
...
@@ -3384,41 +3197,35 @@ static void test_RtlMakeSelfRelativeSD(void)
NTSTATUS
status
;
DWORD
len
;
if
(
!
pRtlMakeSelfRelativeSD
||
!
pRtlAbsoluteToSelfRelativeSD
)
{
win_skip
(
"RtlMakeSelfRelativeSD/RtlAbsoluteToSelfRelativeSD not available
\n
"
);
return
;
}
memset
(
&
sd
,
0
,
sizeof
(
sd
)
);
sd
.
Revision
=
SECURITY_DESCRIPTOR_REVISION
;
len
=
0
;
status
=
p
RtlMakeSelfRelativeSD
(
&
sd
,
NULL
,
&
len
);
status
=
RtlMakeSelfRelativeSD
(
&
sd
,
NULL
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
*
sd_rel
),
"got %u
\n
"
,
len
);
len
+=
4
;
status
=
p
RtlMakeSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
status
=
RtlMakeSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
*
sd_rel
)
+
4
,
"got %u
\n
"
,
len
);
len
=
0
;
status
=
p
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
NULL
,
&
len
);
status
=
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
NULL
,
&
len
);
ok
(
status
==
STATUS_BUFFER_TOO_SMALL
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
*
sd_rel
),
"got %u
\n
"
,
len
);
len
+=
4
;
status
=
p
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
status
=
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
*
sd_rel
)
+
4
,
"got %u
\n
"
,
len
);
sd
.
Control
=
SE_SELF_RELATIVE
;
status
=
p
RtlMakeSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
status
=
RtlMakeSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
*
sd_rel
)
+
4
,
"got %u
\n
"
,
len
);
status
=
p
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
status
=
RtlAbsoluteToSelfRelativeSD
(
&
sd
,
sd_rel
,
&
len
);
ok
(
status
==
STATUS_BAD_DESCRIPTOR_FORMAT
,
"got %08x
\n
"
,
status
);
}
...
...
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