ReactOS  0.4.12-dev-918-g6c6e7b8
rtl.c File Reference
#include <stdlib.h>
#include "ntdll_test.h"
#include "inaddr.h"
#include "in6addr.h"
#include "initguid.h"
#include "shobjidl.h"
Include dependency graph for rtl.c:

Go to the source code of this file.

Classes

struct  _RTL_HANDLE
 
struct  _RTL_HANDLE_TABLE
 
struct  all_accesses_t
 
struct  any_accesses_t
 
struct  MY_HANDLE
 
struct  critsect_locked_info
 
struct  ldr_enum_context
 

Macros

#define COBJMACROS
 
#define htons(s)   __my_ushort_swap(s)
 
#define LEN   16
 
#define COMP(str1, str2, cmplen, len)
 
#define COPY(len)   memset(dest,0,sizeof(dest_aligned_block)); pRtlMoveMemory(dest, src, len)
 
#define CMP(str)   ok(strcmp(dest,str) == 0, "Expected '%s', got '%s'\n", str, dest)
 
#define FILL(len)   memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemory(dest,len,'x')
 
#define LFILL(len)   memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemoryUlong(dest,len,val)
 
#define ZERO(len)   memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlZeroMemory(dest,len)
 
#define MCMP(str)   ok(memcmp(dest,str,LEN) == 0, "Memcmp failed\n")
 
#define NB_ALL_ACCESSES   (sizeof(all_accesses)/sizeof(*all_accesses))
 
#define NB_ANY_ACCESSES   (sizeof(any_accesses)/sizeof(*any_accesses))
 
#define DECOMPRESS_BROKEN_FRAGMENT   1 /* < Win 7 */
 
#define DECOMPRESS_BROKEN_TRUNCATED   2 /* broken on all machines */
 

Typedefs

typedef struct _RTL_HANDLE RTL_HANDLE
 
typedef struct _RTL_HANDLE_TABLE RTL_HANDLE_TABLE
 
typedef struct MY_HANDLE MY_HANDLE
 

Functions

static USHORT __my_ushort_swap (USHORT s)
 
static SIZE_T (WINAPI *pRtlCompareMemory)(LPCVOID
 
static NTSTATUS (WINAPI *pRtlDeleteTimer)(HANDLE
 
static VOID (WINAPI *pRtlMoveMemory)(LPVOID
 
static ULONGLONG (WINAPIV *pRtlUlonglongByteSwap)(ULONGLONG source)
 
static ULONG (WINAPI *pRtlUniform)(PULONG)
 
static BOOLEAN (WINAPI *pRtlAreAllAccessesGranted)(ACCESS_MASK
 
static DWORD (WINAPI *pRtlComputeCrc32)(DWORD
 
static void (WINAPI *pRtlInitializeHandleTable)(ULONG
 
static RTL_HANDLE *WINAPIpRtlAllocateHandle (RTL_HANDLE_TABLE *, ULONG *)
 
static IMAGE_BASE_RELOCATION *WINAPIpLdrProcessRelocationBlock (void *, UINT, USHORT *, INT_PTR)
 
static CHAR *WINAPIpRtlIpv4AddressToStringA (const IN_ADDR *, LPSTR)
 
static CHAR *WINAPIpRtlIpv6AddressToStringA (struct in6_addr *, PSTR)
 
static BOOL (WINAPI *pRtlIsCriticalSectionLocked)(CRITICAL_SECTION *)
 
static void InitFunctionPtrs (void)
 
static void test_RtlCompareMemory (void)
 
static void test_RtlCompareMemoryUlong (void)
 
static void test_RtlMoveMemory (void)
 
static void test_RtlFillMemory (void)
 
static void test_RtlFillMemoryUlong (void)
 
static void test_RtlZeroMemory (void)
 
static void test_RtlUlonglongByteSwap (void)
 
static void test_RtlUniform (void)
 
static void test_RtlRandom (void)
 
static void test_RtlAreAllAccessesGranted (void)
 
static void test_RtlAreAnyAccessesGranted (void)
 
static void test_RtlComputeCrc32 (void)
 
static void RtlpMakeHandleAllocated (RTL_HANDLE *Handle)
 
static void test_HandleTables (void)
 
static void test_RtlAllocateAndInitializeSid (void)
 
static void test_RtlDeleteTimer (void)
 
static void test_RtlThreadErrorMode (void)
 
static void test_LdrProcessRelocationBlock (void)
 
static void test_RtlIpv4AddressToString (void)
 
static void test_RtlIpv4AddressToStringEx (void)
 
static void init_ip4 (IN_ADDR *addr, const int src[4])
 
static void test_RtlIpv4StringToAddress (void)
 
static void test_RtlIpv4StringToAddressEx (void)
 
static void init_ip6 (IN6_ADDR *addr, const int src[8])
 
static void test_RtlIpv6AddressToString (void)
 
static void test_RtlIpv6AddressToStringEx (void)
 
static void compare_RtlIpv6StringToAddressW (PCSTR name_a, int terminator_offset_a, const struct in6_addr *addr_a, NTSTATUS res_a)
 
static void test_RtlIpv6StringToAddress (void)
 
static void compare_RtlIpv6StringToAddressExW (PCSTR name_a, const struct in6_addr *addr_a, HRESULT res_a, ULONG scope_a, USHORT port_a)
 
static void test_RtlIpv6StringToAddressEx (void)
 
static void test_LdrAddRefDll (void)
 
static void test_LdrLockLoaderLock (void)
 
static void test_RtlCompressBuffer (void)
 
static void test_RtlGetCompressionWorkSpaceSize (void)
 
static BOOL is_incomplete_chunk (const UCHAR *compressed, ULONG compressed_size, BOOL check_all)
 
static void test_RtlDecompressBuffer (void)
 
static DWORD WINAPI critsect_locked_thread (void *param)
 
static void test_RtlIsCriticalSectionLocked (void)
 
static void test_RtlInitializeCriticalSectionEx (void)
 
static void test_RtlLeaveCriticalSection (void)
 
static void WINAPI ldr_enum_callback (LDR_MODULE *module, void *context, BOOLEAN *stop)
 
static void test_LdrEnumerateLoadedModules (void)
 
static void test_RtlMakeSelfRelativeSD (void)
 
static void test_RtlQueryPackageIdentity (void)
 
static DWORD (CALLBACK *orig_entry)(HMODULE
 
static voidget_rva (HMODULE module, DWORD va)
 
static void CALLBACK ldr_notify_callback1 (ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
 
static void CALLBACK ldr_notify_callback2 (ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
 
static BOOL WINAPI fake_dll_main (HINSTANCE instance, DWORD reason, void *reserved)
 
static void CALLBACK ldr_notify_callback_dll_main (ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
 
static BOOL WINAPI fake_dll_main_fail (HINSTANCE instance, DWORD reason, void *reserved)
 
static void CALLBACK ldr_notify_callback_fail (ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
 
static void CALLBACK ldr_notify_callback_imports (ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
 
static void test_LdrRegisterDllNotification (void)
 
 START_TEST (rtl)
 

Variables

static HMODULE hntdll = 0
 
static LPCVOID
 
static SIZE_T
 
static ULONG
 
static HANDLE
 
static BYTE
 
static ACCESS_MASK
 
static const BYTE INT
 
static RTL_HANDLE *static DWORD
 
static LPDWORD
 
static USHORT
 
static LPSTR
 
static PULONG
 
static BOOLEAN
 
static PCSTR IN_ADDR *static IN_ADDR PUSHORT
 
static PCHAR
 
static HMODULE
 
static ULONG ULONG_PTR *static ULONG_PTR
 
static LPCSTR
 
static PUCHAR
 
static const UCHAR PVOID
 
static void void *static WCHAR SIZE_T WCHAR SIZE_T BOOLEAN *static PSECURITY_DESCRIPTOR
 
static PLDR_DLL_NOTIFICATION_FUNCTION
 
static HMODULE hkernel32 = 0
 
static PBOOL
 
static const charsrc_src = "This is a test!"
 
static WCHAR ws2_32dllW [] = {'w','s','2','_','3','2','.','d','l','l',0}
 
static WCHAR wintrustdllW [] = {'w','i','n','t','r','u','s','t','.','d','l','l',0}
 
static WCHAR crypt32dllW [] = {'c','r','y','p','t','3','2','.','d','l','l',0}
 
static ULONG src_aligned_block [4]
 
static ULONG dest_aligned_block [32]
 
static const charsrc = (const char*)src_aligned_block
 
static chardest = (char*)dest_aligned_block
 
static const all_accesses_t all_accesses []
 
static const any_accesses_t any_accesses []
 
struct {
enum  { normal_4, strict_diff_4 = 1, ex_fail_4 = 2 }
 
   PCSTR   address
 
   NTSTATUS   res
 
   int   terminator_offset
 
   int   ip [4]
 
   enum { ... }    flags
 
   NTSTATUS   res_strict
 
   int   terminator_offset_strict
 
   int   ip_strict [4]
 
ipv4_tests []
 
const unsigned int ipv4_testcount = sizeof(ipv4_tests) / sizeof(ipv4_tests[0])
 
struct {
enum  { normal_6, win_broken_6 = 1, ex_fail_6 = 2, ex_skip_6 = 4 }
 
   PCSTR   address
 
   NTSTATUS   res
 
   int   terminator_offset
 
   int   ip [8]
 
   enum { ... }    flags
 
ipv6_tests []
 
const unsigned int ipv6_testcount = sizeof(ipv6_tests) / sizeof(ipv6_tests[0])
 
static LPVOID
 
static DWORDdll_main_data
 

Macro Definition Documentation

◆ CMP

#define CMP (   str)    ok(strcmp(dest,str) == 0, "Expected '%s', got '%s'\n", str, dest)

Definition at line 275 of file rtl.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file rtl.c.

◆ COMP

#define COMP (   str1,
  str2,
  cmplen,
  len 
)
Value:
size = pRtlCompareMemory(str1, str2, cmplen); \
ok(size == len, "Expected %ld, got %ld\n", size, (SIZE_T)len)
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:78

Definition at line 202 of file rtl.c.

◆ COPY

#define COPY (   len)    memset(dest,0,sizeof(dest_aligned_block)); pRtlMoveMemory(dest, src, len)

Definition at line 274 of file rtl.c.

◆ DECOMPRESS_BROKEN_FRAGMENT

#define DECOMPRESS_BROKEN_FRAGMENT   1 /* < Win 7 */

Definition at line 2628 of file rtl.c.

◆ DECOMPRESS_BROKEN_TRUNCATED

#define DECOMPRESS_BROKEN_TRUNCATED   2 /* broken on all machines */

Definition at line 2629 of file rtl.c.

◆ FILL

#define FILL (   len)    memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemory(dest,len,'x')

Definition at line 306 of file rtl.c.

◆ htons

#define htons (   s)    __my_ushort_swap(s)

Definition at line 65 of file rtl.c.

◆ LEN

#define LEN   16

Definition at line 127 of file rtl.c.

◆ LFILL

#define LFILL (   len)    memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlFillMemoryUlong(dest,len,val)

Definition at line 331 of file rtl.c.

◆ MCMP

#define MCMP (   str)    ok(memcmp(dest,str,LEN) == 0, "Memcmp failed\n")

Definition at line 358 of file rtl.c.

◆ NB_ALL_ACCESSES

#define NB_ALL_ACCESSES   (sizeof(all_accesses)/sizeof(*all_accesses))

Definition at line 743 of file rtl.c.

◆ NB_ANY_ACCESSES

#define NB_ANY_ACCESSES   (sizeof(any_accesses)/sizeof(*any_accesses))

Definition at line 786 of file rtl.c.

◆ ZERO

#define ZERO (   len)    memset(dest,0,sizeof(dest_aligned_block)); strcpy(dest, src); pRtlZeroMemory(dest,len)

Definition at line 357 of file rtl.c.

Typedef Documentation

◆ MY_HANDLE

◆ RTL_HANDLE

◆ RTL_HANDLE_TABLE

Function Documentation

◆ __my_ushort_swap()

static USHORT __my_ushort_swap ( USHORT  s)
inlinestatic

Definition at line 61 of file rtl.c.

62 {
63  return (s >> 8) | (s << 8);
64 }
GLdouble s
Definition: gl.h:2039

◆ BOOL()

static BOOL ( WINAPI pRtlIsCriticalSectionLocked)
static

◆ BOOLEAN()

static BOOLEAN ( WINAPI pRtlAreAllAccessesGranted)
static

◆ compare_RtlIpv6StringToAddressExW()

static void compare_RtlIpv6StringToAddressExW ( PCSTR  name_a,
const struct in6_addr addr_a,
HRESULT  res_a,
ULONG  scope_a,
USHORT  port_a 
)
static

Definition at line 2124 of file rtl.c.

2125 {
2126  WCHAR name[512];
2127  NTSTATUS res;
2128  IN6_ADDR ip;
2129  ULONG scope = 0xbadf00d;
2130  USHORT port = 0xbeef;
2131 
2132  if (!pRtlIpv6StringToAddressExW)
2133  return;
2134 
2135  pRtlMultiByteToUnicodeN(name, sizeof(name), NULL, name_a, strlen(name_a) + 1);
2136 
2137  init_ip6(&ip, NULL);
2138  res = pRtlIpv6StringToAddressExW(name, &ip, &scope, &port);
2139 
2140  ok(res == res_a, "[W:%s] res = 0x%08x, expected 0x%08x\n", name_a, res, res_a);
2141  ok(scope == scope_a, "[W:%s] scope = 0x%08x, expected 0x%08x\n", name_a, scope, scope_a);
2142  ok(port == port_a, "[W:%s] port = 0x%08x, expected 0x%08x\n", name_a, port, port_a);
2143 
2144  ok(!memcmp(&ip, addr_a, sizeof(ip)),
2145  "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2146  name_a,
2147  ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3],
2148  ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7],
2149  addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3],
2150  addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]);
2151 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS res
Definition: rtl.c:1174
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void init_ip6(IN6_ADDR *addr, const int src[8])
Definition: rtl.c:1739
unsigned short USHORT
Definition: pedump.c:61
Definition: name.c:36
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
USHORT port
Definition: uri.c:227

Referenced by test_RtlIpv6StringToAddressEx().

◆ compare_RtlIpv6StringToAddressW()

static void compare_RtlIpv6StringToAddressW ( PCSTR  name_a,
int  terminator_offset_a,
const struct in6_addr addr_a,
NTSTATUS  res_a 
)
static

Definition at line 1994 of file rtl.c.

1996 {
1997  WCHAR name[512];
1998  NTSTATUS res;
1999  IN6_ADDR ip;
2000  PCWSTR terminator;
2001 
2002  if (!pRtlIpv6StringToAddressW)
2003  return;
2004 
2005  pRtlMultiByteToUnicodeN(name, sizeof(name), NULL, name_a, strlen(name_a) + 1);
2006 
2007  init_ip6(&ip, NULL);
2008  terminator = (void *)0xdeadbeef;
2009  res = pRtlIpv6StringToAddressW(name, &terminator, &ip);
2010  ok(res == res_a, "[W:%s] res = 0x%08x, expected 0x%08x\n", name_a, res, res_a);
2011 
2012  if (terminator_offset_a < 0)
2013  {
2014  ok(terminator == (void *)0xdeadbeef,
2015  "[W:%s] terminator = %p, expected it not to change\n",
2016  name_a, terminator);
2017  }
2018  else
2019  {
2020  ok(terminator == name + terminator_offset_a,
2021  "[W:%s] terminator = %p, expected %p\n",
2022  name_a, terminator, name + terminator_offset_a);
2023  }
2024 
2025  ok(!memcmp(&ip, addr_a, sizeof(ip)),
2026  "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2027  name_a,
2028  ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3],
2029  ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7],
2030  addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3],
2031  addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]);
2032 }
const uint16_t * PCWSTR
Definition: typedefs.h:55
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS res
Definition: rtl.c:1174
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void init_ip6(IN6_ADDR *addr, const int src[8])
Definition: rtl.c:1739
Definition: name.c:36
GLuint res
Definition: glext.h:9613

Referenced by test_RtlIpv6StringToAddress().

◆ critsect_locked_thread()

static DWORD WINAPI critsect_locked_thread ( void param)
static

Definition at line 3055 of file rtl.c.

3056 {
3057  struct critsect_locked_info *info = param;
3058  DWORD ret;
3059 
3060  ret = pRtlIsCriticalSectionLocked(&info->crit);
3061  ok(ret == TRUE, "expected TRUE, got %u\n", ret);
3062  ret = pRtlIsCriticalSectionLockedByThread(&info->crit);
3063  ok(ret == FALSE, "expected FALSE, got %u\n", ret);
3064 
3065  ReleaseSemaphore(info->semaphores[0], 1, NULL);
3066  ret = WaitForSingleObject(info->semaphores[1], 1000);
3067  ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", ret);
3068 
3069  ret = pRtlIsCriticalSectionLocked(&info->crit);
3070  ok(ret == FALSE, "expected FALSE, got %u\n", ret);
3071  ret = pRtlIsCriticalSectionLockedByThread(&info->crit);
3072  ok(ret == FALSE, "expected FALSE, got %u\n", ret);
3073 
3074  EnterCriticalSection(&info->crit);
3075 
3076  ret = pRtlIsCriticalSectionLocked(&info->crit);
3077  ok(ret == TRUE, "expected TRUE, got %u\n", ret);
3078  ret = pRtlIsCriticalSectionLockedByThread(&info->crit);
3079  ok(ret == TRUE, "expected TRUE, got %u\n", ret);
3080 
3081  ReleaseSemaphore(info->semaphores[0], 1, NULL);
3082  ret = WaitForSingleObject(info->semaphores[1], 1000);
3083  ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", ret);
3084 
3085  LeaveCriticalSection(&info->crit);
3086  return 0;
3087 }
#define TRUE
Definition: types.h:120
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define WAIT_OBJECT_0
Definition: winbase.h:387
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore(IN HANDLE hSemaphore, IN LONG lReleaseCount, IN LPLONG lpPreviousCount)
Definition: synch.c:488
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by test_RtlIsCriticalSectionLocked().

◆ DWORD() [1/2]

static DWORD ( WINAPI pRtlComputeCrc32)
static

◆ DWORD() [2/2]

static DWORD ( CALLBACK orig_entry)
static

◆ fake_dll_main()

static BOOL WINAPI fake_dll_main ( HINSTANCE  instance,
DWORD  reason,
void reserved 
)
static

Definition at line 3471 of file rtl.c.

3472 {
3473  if (reason == DLL_PROCESS_ATTACH)
3474  {
3475  *dll_main_data <<= 4;
3476  *dll_main_data |= 3;
3477  }
3478  else if (reason == DLL_PROCESS_DETACH)
3479  {
3480  *dll_main_data <<= 4;
3481  *dll_main_data |= 4;
3482  }
3483  return orig_entry(instance, reason, reserved);
3484 }
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
r reserved
Definition: btrfs.c:2655
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
static HINSTANCE instance
Definition: main.c:40
static DWORD * dll_main_data
Definition: rtl.c:3409

Referenced by ldr_notify_callback_dll_main().

◆ fake_dll_main_fail()

static BOOL WINAPI fake_dll_main_fail ( HINSTANCE  instance,
DWORD  reason,
void reserved 
)
static

Definition at line 3510 of file rtl.c.

3511 {
3512  if (reason == DLL_PROCESS_ATTACH)
3513  {
3514  *dll_main_data <<= 4;
3515  *dll_main_data |= 3;
3516  }
3517  else if (reason == DLL_PROCESS_DETACH)
3518  {
3519  *dll_main_data <<= 4;
3520  *dll_main_data |= 4;
3521  }
3522  return FALSE;
3523 }
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define DLL_PROCESS_DETACH
Definition: compat.h:119
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
static DWORD * dll_main_data
Definition: rtl.c:3409

Referenced by ldr_notify_callback_fail().

◆ get_rva()

static void* get_rva ( HMODULE  module,
DWORD  va 
)
inlinestatic

Definition at line 3411 of file rtl.c.

3412 {
3413  return (void *)((char *)module + va);
3414 }

Referenced by ldr_notify_callback1().

◆ init_ip4()

static void init_ip4 ( IN_ADDR addr,
const int  src[4] 
)
static

Definition at line 1252 of file rtl.c.

1253 {
1254  if (!src || src[0] == -1)
1255  {
1256  addr->S_un.S_addr = 0xabababab;
1257  }
1258  else
1259  {
1260  addr->S_un.S_un_b.s_b1 = src[0];
1261  addr->S_un.S_un_b.s_b2 = src[1];
1262  addr->S_un.S_un_b.s_b3 = src[2];
1263  addr->S_un.S_un_b.s_b4 = src[3];
1264  }
1265 }
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum src
Definition: glext.h:6340

Referenced by test_RtlIpv4StringToAddress(), and test_RtlIpv4StringToAddressEx().

◆ init_ip6()

static void init_ip6 ( IN6_ADDR addr,
const int  src[8] 
)
static

Definition at line 1739 of file rtl.c.

1740 {
1741  unsigned int j;
1742  if (!src || src[0] == -1)
1743  {
1744  for (j = 0; j < 8; ++j)
1745  addr->s6_words[j] = 0xabab;
1746  }
1747  else
1748  {
1749  for (j = 0; j < 8; ++j)
1750  addr->s6_words[j] = src[j];
1751  }
1752 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum src
Definition: glext.h:6340

Referenced by compare_RtlIpv6StringToAddressExW(), compare_RtlIpv6StringToAddressW(), test_RtlIpv6AddressToString(), test_RtlIpv6AddressToStringEx(), test_RtlIpv6StringToAddress(), and test_RtlIpv6StringToAddressEx().

◆ InitFunctionPtrs()

static void InitFunctionPtrs ( void  )
static

Definition at line 137 of file rtl.c.

138 {
139  hntdll = LoadLibraryA("ntdll.dll");
140  ok(hntdll != 0, "LoadLibrary failed\n");
141  if (hntdll) {
142  pRtlCompareMemory = (void *)GetProcAddress(hntdll, "RtlCompareMemory");
143  pRtlCompareMemoryUlong = (void *)GetProcAddress(hntdll, "RtlCompareMemoryUlong");
144  pRtlDeleteTimer = (void *)GetProcAddress(hntdll, "RtlDeleteTimer");
145  pRtlMoveMemory = (void *)GetProcAddress(hntdll, "RtlMoveMemory");
146  pRtlFillMemory = (void *)GetProcAddress(hntdll, "RtlFillMemory");
147  pRtlFillMemoryUlong = (void *)GetProcAddress(hntdll, "RtlFillMemoryUlong");
148  pRtlZeroMemory = (void *)GetProcAddress(hntdll, "RtlZeroMemory");
149  pRtlUlonglongByteSwap = (void *)GetProcAddress(hntdll, "RtlUlonglongByteSwap");
150  pRtlUniform = (void *)GetProcAddress(hntdll, "RtlUniform");
151  pRtlRandom = (void *)GetProcAddress(hntdll, "RtlRandom");
152  pRtlAreAllAccessesGranted = (void *)GetProcAddress(hntdll, "RtlAreAllAccessesGranted");
153  pRtlAreAnyAccessesGranted = (void *)GetProcAddress(hntdll, "RtlAreAnyAccessesGranted");
154  pRtlComputeCrc32 = (void *)GetProcAddress(hntdll, "RtlComputeCrc32");
155  pRtlInitializeHandleTable = (void *)GetProcAddress(hntdll, "RtlInitializeHandleTable");
156  pRtlIsValidIndexHandle = (void *)GetProcAddress(hntdll, "RtlIsValidIndexHandle");
157  pRtlDestroyHandleTable = (void *)GetProcAddress(hntdll, "RtlDestroyHandleTable");
158  pRtlAllocateHandle = (void *)GetProcAddress(hntdll, "RtlAllocateHandle");
159  pRtlFreeHandle = (void *)GetProcAddress(hntdll, "RtlFreeHandle");
160  pRtlAllocateAndInitializeSid = (void *)GetProcAddress(hntdll, "RtlAllocateAndInitializeSid");
161  pRtlFreeSid = (void *)GetProcAddress(hntdll, "RtlFreeSid");
162  pRtlGetThreadErrorMode = (void *)GetProcAddress(hntdll, "RtlGetThreadErrorMode");
163  pRtlSetThreadErrorMode = (void *)GetProcAddress(hntdll, "RtlSetThreadErrorMode");
164  pLdrProcessRelocationBlock = (void *)GetProcAddress(hntdll, "LdrProcessRelocationBlock");
165  pRtlIpv4AddressToStringA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringA");
166  pRtlIpv4AddressToStringExA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringExA");
167  pRtlIpv4StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressA");
168  pRtlIpv4StringToAddressExA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressExA");
169  pRtlIpv6AddressToStringA = (void *)GetProcAddress(hntdll, "RtlIpv6AddressToStringA");
170  pRtlIpv6AddressToStringExA = (void *)GetProcAddress(hntdll, "RtlIpv6AddressToStringExA");
171  pRtlIpv6StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressA");
172  pRtlIpv6StringToAddressW = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressW");
173  pRtlIpv6StringToAddressExA = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressExA");
174  pRtlIpv6StringToAddressExW = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressExW");
175  pLdrAddRefDll = (void *)GetProcAddress(hntdll, "LdrAddRefDll");
176  pLdrLockLoaderLock = (void *)GetProcAddress(hntdll, "LdrLockLoaderLock");
177  pLdrUnlockLoaderLock = (void *)GetProcAddress(hntdll, "LdrUnlockLoaderLock");
178  pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll, "RtlMultiByteToUnicodeN");
179  pRtlGetCompressionWorkSpaceSize = (void *)GetProcAddress(hntdll, "RtlGetCompressionWorkSpaceSize");
180  pRtlDecompressBuffer = (void *)GetProcAddress(hntdll, "RtlDecompressBuffer");
181  pRtlDecompressFragment = (void *)GetProcAddress(hntdll, "RtlDecompressFragment");
182  pRtlCompressBuffer = (void *)GetProcAddress(hntdll, "RtlCompressBuffer");
183  pRtlIsCriticalSectionLocked = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLocked");
184  pRtlIsCriticalSectionLockedByThread = (void *)GetProcAddress(hntdll, "RtlIsCriticalSectionLockedByThread");
185  pRtlInitializeCriticalSectionEx = (void *)GetProcAddress(hntdll, "RtlInitializeCriticalSectionEx");
186  pLdrEnumerateLoadedModules = (void *)GetProcAddress(hntdll, "LdrEnumerateLoadedModules");
187  pRtlQueryPackageIdentity = (void *)GetProcAddress(hntdll, "RtlQueryPackageIdentity");
188  pRtlMakeSelfRelativeSD = (void *)GetProcAddress(hntdll, "RtlMakeSelfRelativeSD");
189  pRtlAbsoluteToSelfRelativeSD = (void *)GetProcAddress(hntdll, "RtlAbsoluteToSelfRelativeSD");
190  pLdrRegisterDllNotification = (void *)GetProcAddress(hntdll, "LdrRegisterDllNotification");
191  pLdrUnregisterDllNotification = (void *)GetProcAddress(hntdll, "LdrUnregisterDllNotification");
192  }
193  hkernel32 = LoadLibraryA("kernel32.dll");
194  ok(hkernel32 != 0, "LoadLibrary failed\n");
195  if (hkernel32) {
196  pIsWow64Process = (void *)GetProcAddress(hkernel32, "IsWow64Process");
197  }
199  ok(strlen(src) == 15, "Source must be 16 bytes long!\n");
200 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static IMAGE_BASE_RELOCATION *WINAPI * pLdrProcessRelocationBlock(void *, UINT, USHORT *, INT_PTR)
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static RTL_HANDLE *WINAPI * pRtlAllocateHandle(RTL_HANDLE_TABLE *, ULONG *)
static HMODULE hkernel32
Definition: rtl.c:123
#define ok(value,...)
Definition: CComObject.cpp:34
static const char * src_src
Definition: rtl.c:128
static CHAR *WINAPI * pRtlIpv4AddressToStringA(const IN_ADDR *, LPSTR)
GLenum src
Definition: glext.h:6340
static HMODULE hntdll
Definition: rtl.c:71
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define GetProcAddress(x, y)
Definition: compat.h:410
static CHAR *WINAPI * pRtlIpv6AddressToStringA(struct in6_addr *, PSTR)
static ULONG src_aligned_block[4]
Definition: rtl.c:132

Referenced by START_TEST().

◆ is_incomplete_chunk()

static BOOL is_incomplete_chunk ( const UCHAR compressed,
ULONG  compressed_size,
BOOL  check_all 
)
static

Definition at line 2607 of file rtl.c.

2608 {
2609  ULONG chunk_size;
2610 
2611  if (compressed_size <= sizeof(WORD))
2612  return TRUE;
2613 
2614  while (compressed_size >= sizeof(WORD))
2615  {
2616  chunk_size = (*(WORD *)compressed & 0xFFF) + 1;
2617  if (compressed_size < sizeof(WORD) + chunk_size)
2618  return TRUE;
2619  if (!check_all)
2620  break;
2621  compressed += sizeof(WORD) + chunk_size;
2622  compressed_size -= sizeof(WORD) + chunk_size;
2623  }
2624 
2625  return FALSE;
2626 }
#define TRUE
Definition: types.h:120
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int ULONG
Definition: retypes.h:1

Referenced by test_RtlDecompressBuffer().

◆ ldr_enum_callback()

static void WINAPI ldr_enum_callback ( LDR_MODULE module,
void context,
BOOLEAN stop 
)
static

Definition at line 3245 of file rtl.c.

3246 {
3247  static const WCHAR ntdllW[] = {'n','t','d','l','l','.','d','l','l',0};
3248  struct ldr_enum_context *ctx = context;
3249 
3250  if (!lstrcmpiW(module->BaseDllName.Buffer, ntdllW))
3251  ctx->found = TRUE;
3252 
3253  ctx->count++;
3254  *stop = ctx->abort;
3255 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
BOOL found
Definition: rtl.c:3241
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL abort
Definition: rtl.c:3240

Referenced by test_LdrEnumerateLoadedModules().

◆ ldr_notify_callback1()

static void CALLBACK ldr_notify_callback1 ( ULONG  reason,
LDR_DLL_NOTIFICATION_DATA data,
void context 
)
static

Definition at line 3416 of file rtl.c.

3417 {
3419  const IMAGE_THUNK_DATA *import_list;
3420  IMAGE_THUNK_DATA *thunk_list;
3421  DWORD *calls = context;
3422  LIST_ENTRY *mark;
3423  LDR_MODULE *mod;
3424  ULONG size;
3425  int i, j;
3426 
3427  *calls <<= 4;
3428  *calls |= reason;
3429 
3430  ok(data->Loaded.Flags == 0, "Expected flags 0, got %x\n", data->Loaded.Flags);
3431  ok(!lstrcmpiW(data->Loaded.BaseDllName->Buffer, ws2_32dllW), "Expected ws2_32.dll, got %s\n",
3432  wine_dbgstr_w(data->Loaded.BaseDllName->Buffer));
3433  ok(!!data->Loaded.DllBase, "Expected non zero base address\n");
3434  ok(data->Loaded.SizeOfImage, "Expected non zero image size\n");
3435 
3436  /* expect module to be last module listed in LdrData load order list */
3437  mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
3438  mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
3439  ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
3440  data->Loaded.DllBase, mod->BaseAddress);
3441  ok(!lstrcmpiW(mod->BaseDllName.Buffer, ws2_32dllW), "Expected ws2_32.dll, got %s\n",
3442  wine_dbgstr_w(mod->BaseDllName.Buffer));
3443 
3444  /* show that imports have already been resolved */
3446  ok(!!imports, "Expected dll to have imports\n");
3447 
3448  for (i = 0; imports[i].Name; i++)
3449  {
3450  thunk_list = get_rva(data->Loaded.DllBase, (DWORD)imports[i].FirstThunk);
3451  if (imports[i].OriginalFirstThunk)
3452  import_list = get_rva(data->Loaded.DllBase, (DWORD)imports[i].OriginalFirstThunk);
3453  else
3454  import_list = thunk_list;
3455 
3456  for (j = 0; import_list[j].u1.Ordinal; j++)
3457  {
3458  ok(thunk_list[j].u1.AddressOfData > data->Loaded.SizeOfImage,
3459  "Import has not been resolved: %p\n", (void*)thunk_list[j].u1.Function);
3460  }
3461  }
3462 }
#define TRUE
Definition: types.h:120
Definition: http.c:6587
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
GLdouble u1
Definition: glext.h:8308
static WCHAR ws2_32dllW[]
Definition: rtl.c:129
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
static void * get_rva(HMODULE module, DWORD va)
Definition: rtl.c:3411
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define RtlImageDirectoryEntryToData
Definition: compat.h:460
Definition: typedefs.h:117
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define IMAGE_DIRECTORY_ENTRY_IMPORT
Definition: pedump.c:260
unsigned int ULONG
Definition: retypes.h:1
union _IMAGE_THUNK_DATA32::@2046 u1
static int mod
Definition: i386-dis.c:1273

Referenced by test_LdrRegisterDllNotification().

◆ ldr_notify_callback2()

static void CALLBACK ldr_notify_callback2 ( ULONG  reason,
LDR_DLL_NOTIFICATION_DATA data,
void context 
)
static

Definition at line 3464 of file rtl.c.

3465 {
3466  DWORD *calls = context;
3467  *calls <<= 4;
3468  *calls |= reason + 2;
3469 }
Definition: http.c:6587
unsigned long DWORD
Definition: ntddk_ex.h:95
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904

Referenced by test_LdrRegisterDllNotification().

◆ ldr_notify_callback_dll_main()

static void CALLBACK ldr_notify_callback_dll_main ( ULONG  reason,
LDR_DLL_NOTIFICATION_DATA data,
void context 
)
static

Definition at line 3486 of file rtl.c.

3487 {
3488  DWORD *calls = context;
3489  LIST_ENTRY *mark;
3490  LDR_MODULE *mod;
3491 
3492  *calls <<= 4;
3493  *calls |= reason;
3494 
3496  return;
3497 
3498  mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
3499  mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
3500  ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
3501  data->Loaded.DllBase, mod->BaseAddress);
3502  if (mod->BaseAddress != data->Loaded.DllBase)
3503  return;
3504 
3505  orig_entry = mod->EntryPoint;
3506  mod->EntryPoint = fake_dll_main;
3507  dll_main_data = calls;
3508 }
Definition: http.c:6587
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
static BOOL WINAPI fake_dll_main(HINSTANCE instance, DWORD reason, void *reserved)
Definition: rtl.c:3471
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
Definition: typedefs.h:117
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define LDR_DLL_NOTIFICATION_REASON_LOADED
Definition: winternl.h:2303
static int mod
Definition: i386-dis.c:1273
static DWORD * dll_main_data
Definition: rtl.c:3409

Referenced by test_LdrRegisterDllNotification().

◆ ldr_notify_callback_fail()

static void CALLBACK ldr_notify_callback_fail ( ULONG  reason,
LDR_DLL_NOTIFICATION_DATA data,
void context 
)
static

Definition at line 3525 of file rtl.c.

3526 {
3527  DWORD *calls = context;
3528  LIST_ENTRY *mark;
3529  LDR_MODULE *mod;
3530 
3531  *calls <<= 4;
3532  *calls |= reason;
3533 
3535  return;
3536 
3537  mark = &NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList;
3538  mod = CONTAINING_RECORD(mark->Blink, LDR_MODULE, InMemoryOrderModuleList);
3539  ok(mod->BaseAddress == data->Loaded.DllBase, "Expected base address %p, got %p\n",
3540  data->Loaded.DllBase, mod->BaseAddress);
3541  if (mod->BaseAddress != data->Loaded.DllBase)
3542  return;
3543 
3544  orig_entry = mod->EntryPoint;
3545  mod->EntryPoint = fake_dll_main_fail;
3546  dll_main_data = calls;
3547 }
Definition: http.c:6587
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
static BOOL WINAPI fake_dll_main_fail(HINSTANCE instance, DWORD reason, void *reserved)
Definition: rtl.c:3510
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
Definition: typedefs.h:117
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define LDR_DLL_NOTIFICATION_REASON_LOADED
Definition: winternl.h:2303
static int mod
Definition: i386-dis.c:1273
static DWORD * dll_main_data
Definition: rtl.c:3409

Referenced by test_LdrRegisterDllNotification().

◆ ldr_notify_callback_imports()

static void CALLBACK ldr_notify_callback_imports ( ULONG  reason,
LDR_DLL_NOTIFICATION_DATA data,
void context 
)
static

Definition at line 3549 of file rtl.c.

3550 {
3551  DWORD *calls = context;
3552 
3554  return;
3555 
3556  if (!lstrcmpiW(data->Loaded.BaseDllName->Buffer, crypt32dllW))
3557  {
3558  *calls <<= 4;
3559  *calls |= 1;
3560  }
3561 
3562  if (!lstrcmpiW(data->Loaded.BaseDllName->Buffer, wintrustdllW))
3563  {
3564  *calls <<= 4;
3565  *calls |= 2;
3566  }
3567 }
static WCHAR wintrustdllW[]
Definition: rtl.c:130
static WCHAR crypt32dllW[]
Definition: rtl.c:131
Definition: http.c:6587
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
#define LDR_DLL_NOTIFICATION_REASON_LOADED
Definition: winternl.h:2303

Referenced by test_LdrRegisterDllNotification().

◆ NTSTATUS()

static NTSTATUS ( WINAPI pRtlDeleteTimer)
static

◆ pLdrProcessRelocationBlock()

static IMAGE_BASE_RELOCATION* WINAPI* pLdrProcessRelocationBlock ( void ,
UINT  ,
USHORT ,
INT_PTR   
)
static

◆ pRtlAllocateHandle()

static RTL_HANDLE* WINAPI* pRtlAllocateHandle ( RTL_HANDLE_TABLE ,
ULONG  
)
static

◆ pRtlIpv4AddressToStringA()

static CHAR* WINAPI* pRtlIpv4AddressToStringA ( const IN_ADDR ,
LPSTR   
)
static

◆ pRtlIpv6AddressToStringA()

static CHAR* WINAPI* pRtlIpv6AddressToStringA ( struct in6_addr ,
PSTR   
)
static

◆ RtlpMakeHandleAllocated()

static void RtlpMakeHandleAllocated ( RTL_HANDLE Handle)
inlinestatic

Definition at line 832 of file rtl.c.

833 {
834  ULONG_PTR *AllocatedBit = (ULONG_PTR *)(&Handle->Next);
835  *AllocatedBit = *AllocatedBit | 1;
836 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
_In_ HANDLE Handle
Definition: extypes.h:390

Referenced by test_HandleTables().

◆ SIZE_T()

static SIZE_T ( WINAPI pRtlCompareMemory)
static

◆ START_TEST()

START_TEST ( rtl  )

Definition at line 3650 of file rtl.c.

3651 {
3652  InitFunctionPtrs();
3653 
3661  test_RtlUniform();
3662  test_RtlRandom();
3691 }
static void test_RtlCompareMemory(void)
Definition: rtl.c:205
static void test_RtlAreAllAccessesGranted(void)
Definition: rtl.c:746
static void test_RtlMoveMemory(void)
Definition: rtl.c:277
static void test_LdrEnumerateLoadedModules(void)
Definition: rtl.c:3257
static void test_RtlIpv4AddressToStringEx(void)
Definition: rtl.c:1052
static void test_RtlUniform(void)
Definition: rtl.c:404
static void test_RtlDecompressBuffer(void)
Definition: rtl.c:2631
static void test_RtlMakeSelfRelativeSD(void)
Definition: rtl.c:3292
static void test_HandleTables(void)
Definition: rtl.c:838
static void test_RtlThreadErrorMode(void)
Definition: rtl.c:909
static void test_RtlRandom(void)
Definition: rtl.c:702
static void test_RtlIpv6StringToAddressEx(void)
Definition: rtl.c:2153
static void test_RtlIpv4StringToAddress(void)
Definition: rtl.c:1267
static void test_RtlComputeCrc32(void)
Definition: rtl.c:811
static void test_RtlIpv4AddressToString(void)
Definition: rtl.c:1008
static void InitFunctionPtrs(void)
Definition: rtl.c:137
static void test_RtlIpv6AddressToString(void)
Definition: rtl.c:1754
static void test_RtlIpv6AddressToStringEx(void)
Definition: rtl.c:1874
static void test_LdrRegisterDllNotification(void)
Definition: rtl.c:3569
static void test_RtlCompareMemoryUlong(void)
Definition: rtl.c:223
static void test_RtlIpv4StringToAddressEx(void)
Definition: rtl.c:1340
static void test_RtlFillMemory(void)
Definition: rtl.c:308
static void test_RtlQueryPackageIdentity(void)
Definition: rtl.c:3338
static void test_RtlDeleteTimer(void)
Definition: rtl.c:893
static void test_RtlFillMemoryUlong(void)
Definition: rtl.c:333
static void test_RtlLeaveCriticalSection(void)
Definition: rtl.c:3179
static void test_LdrLockLoaderLock(void)
Definition: rtl.c:2442
static void test_RtlAreAnyAccessesGranted(void)
Definition: rtl.c:789
static void test_LdrProcessRelocationBlock(void)
Definition: rtl.c:977
static void test_RtlUlonglongByteSwap(void)
Definition: rtl.c:381
static void test_RtlCompressBuffer(void)
Definition: rtl.c:2494
static void test_RtlZeroMemory(void)
Definition: rtl.c:360
static void test_LdrAddRefDll(void)
Definition: rtl.c:2387
static void test_RtlIsCriticalSectionLocked(void)
Definition: rtl.c:3089
static void test_RtlAllocateAndInitializeSid(void)
Definition: rtl.c:865
static void test_RtlIpv6StringToAddress(void)
Definition: rtl.c:2034
static void test_RtlGetCompressionWorkSpaceSize(void)
Definition: rtl.c:2567
static void test_RtlInitializeCriticalSectionEx(void)
Definition: rtl.c:3145

◆ test_HandleTables()

static void test_HandleTables ( void  )
static

Definition at line 838 of file rtl.c.

839 {
840  BOOLEAN result;
842  ULONG Index;
843  MY_HANDLE * MyHandle;
845 
846  if (!pRtlInitializeHandleTable)
847  {
848  win_skip("RtlInitializeHandleTable is not available\n");
849  return;
850  }
851 
852  pRtlInitializeHandleTable(0x3FFF, sizeof(MY_HANDLE), &HandleTable);
853  MyHandle = (MY_HANDLE *)pRtlAllocateHandle(&HandleTable, &Index);
854  ok(MyHandle != NULL, "RtlAllocateHandle failed\n");
856  MyHandle = NULL;
857  result = pRtlIsValidIndexHandle(&HandleTable, Index, (RTL_HANDLE **)&MyHandle);
858  ok(result, "Handle %p wasn't valid\n", MyHandle);
859  result = pRtlFreeHandle(&HandleTable, &MyHandle->RtlHandle);
860  ok(result, "Couldn't free handle %p\n", MyHandle);
861  status = pRtlDestroyHandleTable(&HandleTable);
862  ok(status == STATUS_SUCCESS, "RtlDestroyHandleTable failed with error 0x%08x\n", status);
863 }
LONG NTSTATUS
Definition: precomp.h:26
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
RTL_HANDLE RtlHandle
Definition: rtl.c:828
unsigned char BOOLEAN
static RTL_HANDLE *WINAPI * pRtlAllocateHandle(RTL_HANDLE_TABLE *, ULONG *)
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static const UCHAR Index[8]
Definition: usbohci.c:18
Definition: rtl.c:826
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
static void RtlpMakeHandleAllocated(RTL_HANDLE *Handle)
Definition: rtl.c:832
Definition: ps.c:97

Referenced by START_TEST().

◆ test_LdrAddRefDll()

static void test_LdrAddRefDll ( void  )
static

Definition at line 2387 of file rtl.c.

2388 {
2389  HMODULE mod, mod2;
2390  NTSTATUS status;
2391  BOOL ret;
2392 
2393  if (!pLdrAddRefDll)
2394  {
2395  win_skip( "LdrAddRefDll not supported\n" );
2396  return;
2397  }
2398 
2399  mod = LoadLibraryA("comctl32.dll");
2400  ok(mod != NULL, "got %p\n", mod);
2401  ret = FreeLibrary(mod);
2402  ok(ret, "got %d\n", ret);
2403 
2404  mod2 = GetModuleHandleA("comctl32.dll");
2405  ok(mod2 == NULL, "got %p\n", mod2);
2406 
2407  /* load, addref and release 2 times */
2408  mod = LoadLibraryA("comctl32.dll");
2409  ok(mod != NULL, "got %p\n", mod);
2410  status = pLdrAddRefDll(0, mod);
2411  ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
2412  ret = FreeLibrary(mod);
2413  ok(ret, "got %d\n", ret);
2414 
2415  mod2 = GetModuleHandleA("comctl32.dll");
2416  ok(mod2 != NULL, "got %p\n", mod2);
2417  ret = FreeLibrary(mod);
2418  ok(ret, "got %d\n", ret);
2419 
2420  mod2 = GetModuleHandleA("comctl32.dll");
2421  ok(mod2 == NULL, "got %p\n", mod2);
2422 
2423  /* pin refcount */
2424  mod = LoadLibraryA("comctl32.dll");
2425  ok(mod != NULL, "got %p\n", mod);
2426  status = pLdrAddRefDll(LDR_ADDREF_DLL_PIN, mod);
2427  ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
2428 
2429  ret = FreeLibrary(mod);
2430  ok(ret, "got %d\n", ret);
2431  ret = FreeLibrary(mod);
2432  ok(ret, "got %d\n", ret);
2433  ret = FreeLibrary(mod);
2434  ok(ret, "got %d\n", ret);
2435  ret = FreeLibrary(mod);
2436  ok(ret, "got %d\n", ret);
2437 
2438  mod2 = GetModuleHandleA("comctl32.dll");
2439  ok(mod2 != NULL, "got %p\n", mod2);
2440 }
LONG NTSTATUS
Definition: precomp.h:26
unsigned int BOOL
Definition: ntddk_ex.h:94
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define FreeLibrary(x)
Definition: compat.h:405
int ret
#define mod2(n)
Definition: vgavideo.h:71
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define LDR_ADDREF_DLL_PIN
Definition: ldrtypes.h:70
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
static int mod
Definition: i386-dis.c:1273
Definition: ps.c:97

Referenced by START_TEST().

◆ test_LdrEnumerateLoadedModules()

static void test_LdrEnumerateLoadedModules ( void  )
static

Definition at line 3257 of file rtl.c.

3258 {
3259  struct ldr_enum_context ctx;
3260  NTSTATUS status;
3261 
3262  if (!pLdrEnumerateLoadedModules)
3263  {
3264  win_skip("LdrEnumerateLoadedModules not available\n");
3265  return;
3266  }
3267 
3268  ctx.abort = FALSE;
3269  ctx.found = FALSE;
3270  ctx.count = 0;
3271  status = pLdrEnumerateLoadedModules(NULL, ldr_enum_callback, &ctx);
3272  ok(status == STATUS_SUCCESS, "LdrEnumerateLoadedModules failed with %08x\n", status);
3273  ok(ctx.count > 1, "Expected more than one module, got %d\n", ctx.count);
3274  ok(ctx.found, "Could not find ntdll in list of modules\n");
3275 
3276  ctx.abort = TRUE;
3277  ctx.count = 0;
3278  status = pLdrEnumerateLoadedModules(NULL, ldr_enum_callback, &ctx);
3279  ok(status == STATUS_SUCCESS, "LdrEnumerateLoadedModules failed with %08x\n", status);
3280  ok(ctx.count == 1, "Expected exactly one module, got %d\n", ctx.count);
3281 
3282  status = pLdrEnumerateLoadedModules((void *)0x1, ldr_enum_callback, (void *)0xdeadbeef);
3283  ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got 0x%08x\n", status);
3284 
3285  status = pLdrEnumerateLoadedModules((void *)0xdeadbeef, ldr_enum_callback, (void *)0xdeadbeef);
3286  ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got 0x%08x\n", status);
3287 
3288  status = pLdrEnumerateLoadedModules(NULL, NULL, (void *)0xdeadbeef);
3289  ok(status == STATUS_INVALID_PARAMETER, "expected STATUS_INVALID_PARAMETER, got 0x%08x\n", status);
3290 }
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
static void WINAPI ldr_enum_callback(LDR_MODULE *module, void *context, BOOLEAN *stop)
Definition: rtl.c:3245
Definition: ps.c:97

Referenced by START_TEST().

◆ test_LdrLockLoaderLock()

static void test_LdrLockLoaderLock ( void  )
static

Definition at line 2442 of file rtl.c.

2443 {
2444  ULONG_PTR magic;
2445  ULONG result;
2446  NTSTATUS status;
2447 
2448  if (!pLdrLockLoaderLock)
2449  {
2450  win_skip("LdrLockLoaderLock() is not available\n");
2451  return;
2452  }
2453 
2454  /* invalid flags */
2455  result = 10;
2456  magic = 0xdeadbeef;
2457  status = pLdrLockLoaderLock(0x10, &result, &magic);
2458  ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status);
2459  ok(result == 0, "got %d\n", result);
2460  ok(magic == 0, "got %lx\n", magic);
2461 
2462  magic = 0xdeadbeef;
2463  status = pLdrLockLoaderLock(0x10, NULL, &magic);
2464  ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status);
2465  ok(magic == 0, "got %lx\n", magic);
2466 
2467  result = 10;
2468  status = pLdrLockLoaderLock(0x10, &result, NULL);
2469  ok(status == STATUS_INVALID_PARAMETER_1, "got 0x%08x\n", status);
2470  ok(result == 0, "got %d\n", result);
2471 
2472  /* non-blocking mode, result is null */
2473  magic = 0xdeadbeef;
2474  status = pLdrLockLoaderLock(0x2, NULL, &magic);
2475  ok(status == STATUS_INVALID_PARAMETER_2, "got 0x%08x\n", status);
2476  ok(magic == 0, "got %lx\n", magic);
2477 
2478  /* magic pointer is null */
2479  result = 10;
2480  status = pLdrLockLoaderLock(0, &result, NULL);
2481  ok(status == STATUS_INVALID_PARAMETER_3, "got 0x%08x\n", status);
2482  ok(result == 0, "got %d\n", result);
2483 
2484  /* lock in non-blocking mode */
2485  result = 0;
2486  magic = 0;
2487  status = pLdrLockLoaderLock(0x2, &result, &magic);
2488  ok(status == STATUS_SUCCESS, "got 0x%08x\n", status);
2489  ok(result == 1, "got %d\n", result);
2490  ok(magic != 0, "got %lx\n", magic);
2491  pLdrUnlockLoaderLock(0, magic);
2492 }
LONG NTSTATUS
Definition: precomp.h:26
u32_t magic(void)
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define STATUS_INVALID_PARAMETER_3
Definition: ntstatus.h:463
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:462
#define ok(value,...)
Definition: CComObject.cpp:34
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:461
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
GLuint64EXT * result
Definition: glext.h:11304
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
Definition: ps.c:97

Referenced by START_TEST().

◆ test_LdrProcessRelocationBlock()

static void test_LdrProcessRelocationBlock ( void  )
static

Definition at line 977 of file rtl.c.

978 {
980  USHORT reloc;
981  DWORD addr32;
982  SHORT addr16;
983 
985  win_skip("LdrProcessRelocationBlock not available\n");
986  return;
987  }
988 
989  addr32 = 0x50005;
990  reloc = IMAGE_REL_BASED_HIGHLOW<<12;
991  ret = pLdrProcessRelocationBlock(&addr32, 1, &reloc, 0x500050);
992  ok((USHORT*)ret == &reloc+1, "ret = %p, expected %p\n", ret, &reloc+1);
993  ok(addr32 == 0x550055, "addr32 = %x, expected 0x550055\n", addr32);
994 
995  addr16 = 0x505;
996  reloc = IMAGE_REL_BASED_HIGH<<12;
997  ret = pLdrProcessRelocationBlock(&addr16, 1, &reloc, 0x500060);
998  ok((USHORT*)ret == &reloc+1, "ret = %p, expected %p\n", ret, &reloc+1);
999  ok(addr16 == 0x555, "addr16 = %x, expected 0x555\n", addr16);
1000 
1001  addr16 = 0x505;
1002  reloc = IMAGE_REL_BASED_LOW<<12;
1003  ret = pLdrProcessRelocationBlock(&addr16, 1, &reloc, 0x500060);
1004  ok((USHORT*)ret == &reloc+1, "ret = %p, expected %p\n", ret, &reloc+1);
1005  ok(addr16 == 0x565, "addr16 = %x, expected 0x565\n", addr16);
1006 }
#define IMAGE_REL_BASED_HIGHLOW
Definition: winnt_old.h:885
static IMAGE_BASE_RELOCATION *WINAPI * pLdrProcessRelocationBlock(void *, UINT, USHORT *, INT_PTR)
short SHORT
Definition: pedump.c:59
#define IMAGE_REL_BASED_LOW
Definition: winnt_old.h:884
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define IMAGE_REL_BASED_HIGH
Definition: winnt_old.h:883
unsigned short USHORT
Definition: pedump.c:61
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_LdrRegisterDllNotification()

static void test_LdrRegisterDllNotification ( void  )
static

Definition at line 3569 of file rtl.c.

3570 {
3571  void *cookie, *cookie2;
3572  NTSTATUS status;
3573  HMODULE mod;
3574  DWORD calls;
3575 
3576  if (!pLdrRegisterDllNotification || !pLdrUnregisterDllNotification)
3577  {
3578  win_skip("Ldr(Un)RegisterDllNotification not available\n");
3579  return;
3580  }
3581 
3582  /* generic test */
3583  status = pLdrRegisterDllNotification(0, ldr_notify_callback1, &calls, &cookie);
3584  ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
3585 
3586  calls = 0;
3588  ok(!!mod, "Failed to load library: %d\n", GetLastError());
3589  ok(calls == LDR_DLL_NOTIFICATION_REASON_LOADED, "Expected LDR_DLL_NOTIFICATION_REASON_LOADED, got %x\n", calls);
3590 
3591  calls = 0;
3592  FreeLibrary(mod);
3593  ok(calls == LDR_DLL_NOTIFICATION_REASON_UNLOADED, "Expected LDR_DLL_NOTIFICATION_REASON_UNLOADED, got %x\n", calls);
3594 
3595  /* test order of callbacks */
3596  status = pLdrRegisterDllNotification(0, ldr_notify_callback2, &calls, &cookie2);
3597  ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
3598 
3599  calls = 0;
3601  ok(!!mod, "Failed to load library: %d\n", GetLastError());
3602  ok(calls == 0x13, "Expected order 0x13, got %x\n", calls);
3603 
3604  calls = 0;
3605  FreeLibrary(mod);
3606  ok(calls == 0x24, "Expected order 0x24, got %x\n", calls);
3607 
3608  pLdrUnregisterDllNotification(cookie2);
3609  pLdrUnregisterDllNotification(cookie);
3610 
3611  /* test dll main order */
3612  status = pLdrRegisterDllNotification(0, ldr_notify_callback_dll_main, &calls, &cookie);
3613  ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
3614 
3615  calls = 0;
3617  ok(!!mod, "Failed to load library: %d\n", GetLastError());
3618  ok(calls == 0x13, "Expected order 0x13, got %x\n", calls);
3619 
3620  calls = 0;
3621  FreeLibrary(mod);
3622  ok(calls == 0x42, "Expected order 0x42, got %x\n", calls);
3623 
3624  pLdrUnregisterDllNotification(cookie);
3625 
3626  /* test dll main order */
3627  status = pLdrRegisterDllNotification(0, ldr_notify_callback_fail, &calls, &cookie);
3628  ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
3629 
3630  calls = 0;
3632  ok(!mod, "Expected library to fail loading\n");
3633  ok(calls == 0x1342, "Expected order 0x1342, got %x\n", calls);
3634 
3635  pLdrUnregisterDllNotification(cookie);
3636 
3637  /* test dll with dependencies */
3638  status = pLdrRegisterDllNotification(0, ldr_notify_callback_imports, &calls, &cookie);
3639  ok(!status, "Expected STATUS_SUCCESS, got %08x\n", status);
3640 
3641  calls = 0;
3643  ok(!!mod, "Failed to load library: %d\n", GetLastError());
3644  ok(calls == 0x12, "Expected order 0x12, got %x\n", calls);
3645 
3646  FreeLibrary(mod);
3647  pLdrUnregisterDllNotification(cookie);
3648 }
static void CALLBACK ldr_notify_callback_dll_main(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
Definition: rtl.c:3486
static WCHAR wintrustdllW[]
Definition: rtl.c:130
LONG NTSTATUS
Definition: precomp.h:26
static void CALLBACK ldr_notify_callback2(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
Definition: rtl.c:3464
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static WCHAR ws2_32dllW[]
Definition: rtl.c:129
static void CALLBACK ldr_notify_callback_fail(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
Definition: rtl.c:3525
#define LoadLibraryW(x)
Definition: compat.h:404
#define ok(value,...)
Definition: CComObject.cpp:34
#define FreeLibrary(x)
Definition: compat.h:405
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LDR_DLL_NOTIFICATION_REASON_UNLOADED
Definition: winternl.h:2304
#define LDR_DLL_NOTIFICATION_REASON_LOADED
Definition: winternl.h:2303
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
static void CALLBACK ldr_notify_callback_imports(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
Definition: rtl.c:3549
static void CALLBACK ldr_notify_callback1(ULONG reason, LDR_DLL_NOTIFICATION_DATA *data, void *context)
Definition: rtl.c:3416
static int mod
Definition: i386-dis.c:1273
Definition: ps.c:97

Referenced by START_TEST().

◆ test_RtlAllocateAndInitializeSid()

static void test_RtlAllocateAndInitializeSid ( void  )
static

Definition at line 865 of file rtl.c.

866 {
867  NTSTATUS ret;
868  SID_IDENTIFIER_AUTHORITY sia = {{ 1, 2, 3, 4, 5, 6 }};
869  PSID psid;
870 
871  if (!pRtlAllocateAndInitializeSid)
872  {
873  win_skip("RtlAllocateAndInitializeSid is not available\n");
874  return;
875  }
876 
877  ret = pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
878  ok(!ret, "RtlAllocateAndInitializeSid error %08x\n", ret);
879  ret = pRtlFreeSid(psid);
880  ok(!ret, "RtlFreeSid error %08x\n", ret);
881 
882  /* these tests crash on XP */
883  if (0)
884  {
885  pRtlAllocateAndInitializeSid(NULL, 0, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
886  pRtlAllocateAndInitializeSid(&sia, 0, 1, 2, 3, 4, 5, 6, 7, 8, NULL);
887  }
888 
889  ret = pRtlAllocateAndInitializeSid(&sia, 9, 1, 2, 3, 4, 5, 6, 7, 8, &psid);
890  ok(ret == STATUS_INVALID_SID, "wrong error %08x\n", ret);
891 }
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_INVALID_SID
Definition: ntstatus.h:342
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlAreAllAccessesGranted()

static void test_RtlAreAllAccessesGranted ( void  )
static

Definition at line 746 of file rtl.c.

747 {
748  unsigned int test_num;
749  BOOLEAN result;
750 
751  if (!pRtlAreAllAccessesGranted)
752  {
753  win_skip("RtlAreAllAccessesGranted is not available\n");
754  return;
755  }
756 
757  for (test_num = 0; test_num < NB_ALL_ACCESSES; test_num++) {
758  result = pRtlAreAllAccessesGranted(all_accesses[test_num].GrantedAccess,
759  all_accesses[test_num].DesiredAccess);
760  ok(all_accesses[test_num].result == result,
761  "(test %d): RtlAreAllAccessesGranted(%08x, %08x) returns %d, expected %d\n",
762  test_num, all_accesses[test_num].GrantedAccess,
763  all_accesses[test_num].DesiredAccess,
764  result, all_accesses[test_num].result);
765  } /* for */
766 }
static const all_accesses_t all_accesses[]
Definition: rtl.c:731
unsigned char BOOLEAN
#define ok(value,...)
Definition: CComObject.cpp:34
#define NB_ALL_ACCESSES
Definition: rtl.c:743
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13
GLuint64EXT * result
Definition: glext.h:11304
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlAreAnyAccessesGranted()

static void test_RtlAreAnyAccessesGranted ( void  )
static

Definition at line 789 of file rtl.c.

790 {
791  unsigned int test_num;
792  BOOLEAN result;
793 
794  if (!pRtlAreAnyAccessesGranted)
795  {
796  win_skip("RtlAreAnyAccessesGranted is not available\n");
797  return;
798  }
799 
800  for (test_num = 0; test_num < NB_ANY_ACCESSES; test_num++) {
801  result = pRtlAreAnyAccessesGranted(any_accesses[test_num].GrantedAccess,
802  any_accesses[test_num].DesiredAccess);
803  ok(any_accesses[test_num].result == result,
804  "(test %d): RtlAreAnyAccessesGranted(%08x, %08x) returns %d, expected %d\n",
805  test_num, any_accesses[test_num].GrantedAccess,
806  any_accesses[test_num].DesiredAccess,
807  result, any_accesses[test_num].result);
808  } /* for */
809 }
#define NB_ANY_ACCESSES
Definition: rtl.c:786
unsigned char BOOLEAN
#define ok(value,...)
Definition: CComObject.cpp:34
static const any_accesses_t any_accesses[]
Definition: rtl.c:775
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
_In_ PSECURITY_SUBJECT_CONTEXT _In_ BOOLEAN _In_ ACCESS_MASK _In_ ACCESS_MASK _Outptr_opt_ PPRIVILEGE_SET _In_ PGENERIC_MAPPING _In_ KPROCESSOR_MODE _Out_ PACCESS_MASK GrantedAccess
Definition: sefuncs.h:13
GLuint64EXT * result
Definition: glext.h:11304
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlCompareMemory()

static void test_RtlCompareMemory ( void  )
static

Definition at line 205 of file rtl.c.

206 {
207  SIZE_T size;
208 
209  if (!pRtlCompareMemory)
210  {
211  win_skip("RtlCompareMemory is not available\n");
212  return;
213  }
214 
215  strcpy(dest, src);
216 
217  COMP(src,src,0,0);
218  COMP(src,src,LEN,LEN);
219  dest[0] = 'x';
220  COMP(src,dest,LEN,0);
221 }
GLsizeiptr size
Definition: glext.h:5919
#define LEN
Definition: rtl.c:127
#define COMP(str1, str2, cmplen, len)
Definition: rtl.c:202
GLenum src
Definition: glext.h:6340
ULONG_PTR SIZE_T
Definition: typedefs.h:78
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static char * dest
Definition: rtl.c:135
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlCompareMemoryUlong()

static void test_RtlCompareMemoryUlong ( void  )
static

Definition at line 223 of file rtl.c.

224 {
225  ULONG a[10];
226  ULONG result;
227 
228  if (!pRtlCompareMemoryUlong)
229  {
230  win_skip("RtlCompareMemoryUlong is not available\n");
231  return;
232  }
233 
234  a[0]= 0x0123;
235  a[1]= 0x4567;
236  a[2]= 0x89ab;
237  a[3]= 0xcdef;
238  result = pRtlCompareMemoryUlong(a, 0, 0x0123);
239  ok(result == 0, "RtlCompareMemoryUlong(%p, 0, 0x0123) returns %u, expected 0\n", a, result);
240  result = pRtlCompareMemoryUlong(a, 3, 0x0123);
241  ok(result == 0, "RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0\n", a, result);
242  result = pRtlCompareMemoryUlong(a, 4, 0x0123);
243  ok(result == 4, "RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4\n", a, result);
244  result = pRtlCompareMemoryUlong(a, 5, 0x0123);
245  ok(result == 4, "RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4\n", a, result);
246  result = pRtlCompareMemoryUlong(a, 7, 0x0123);
247  ok(result == 4, "RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4\n", a, result);
248  result = pRtlCompareMemoryUlong(a, 8, 0x0123);
249  ok(result == 4, "RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 4\n", a, result);
250  result = pRtlCompareMemoryUlong(a, 9, 0x0123);
251  ok(result == 4, "RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 4\n", a, result);
252  result = pRtlCompareMemoryUlong(a, 4, 0x0127);
253  ok(result == 0, "RtlCompareMemoryUlong(%p, 4, 0x0127) returns %u, expected 0\n", a, result);
254  result = pRtlCompareMemoryUlong(a, 4, 0x7123);
255  ok(result == 0, "RtlCompareMemoryUlong(%p, 4, 0x7123) returns %u, expected 0\n", a, result);
256  result = pRtlCompareMemoryUlong(a, 16, 0x4567);
257  ok(result == 0, "RtlCompareMemoryUlong(%p, 16, 0x4567) returns %u, expected 0\n", a, result);
258 
259  a[1]= 0x0123;
260  result = pRtlCompareMemoryUlong(a, 3, 0x0123);
261  ok(result == 0, "RtlCompareMemoryUlong(%p, 3, 0x0123) returns %u, expected 0\n", a, result);
262  result = pRtlCompareMemoryUlong(a, 4, 0x0123);
263  ok(result == 4, "RtlCompareMemoryUlong(%p, 4, 0x0123) returns %u, expected 4\n", a, result);
264  result = pRtlCompareMemoryUlong(a, 5, 0x0123);
265  ok(result == 4, "RtlCompareMemoryUlong(%p, 5, 0x0123) returns %u, expected 4\n", a, result);
266  result = pRtlCompareMemoryUlong(a, 7, 0x0123);
267  ok(result == 4, "RtlCompareMemoryUlong(%p, 7, 0x0123) returns %u, expected 4\n", a, result);
268  result = pRtlCompareMemoryUlong(a, 8, 0x0123);
269  ok(result == 8, "RtlCompareMemoryUlong(%p, 8, 0x0123) returns %u, expected 8\n", a, result);
270  result = pRtlCompareMemoryUlong(a, 9, 0x0123);
271  ok(result == 8, "RtlCompareMemoryUlong(%p, 9, 0x0123) returns %u, expected 8\n", a, result);
272 }
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned int ULONG
Definition: retypes.h:1
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLuint64EXT * result
Definition: glext.h:11304
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlCompressBuffer()

static void test_RtlCompressBuffer ( void  )
static

Definition at line 2494 of file rtl.c.

2495 {
2496  ULONG compress_workspace, decompress_workspace;
2497  static const UCHAR test_buffer[] = "WineWineWine";
2498  static UCHAR buf1[0x1000], buf2[0x1000];
2499  ULONG final_size, buf_size;
2500  UCHAR *workspace = NULL;
2501  NTSTATUS status;
2502 
2503  if (!pRtlCompressBuffer || !pRtlDecompressBuffer || !pRtlGetCompressionWorkSpaceSize)
2504  {
2505  win_skip("skipping RtlCompressBuffer tests, required functions not available\n");
2506  return;
2507  }
2508 
2509  compress_workspace = decompress_workspace = 0xdeadbeef;
2510  status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace,
2511  &decompress_workspace);
2512  ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
2513  ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
2514  workspace = HeapAlloc(GetProcessHeap(), 0, compress_workspace);
2515  ok(workspace != NULL, "HeapAlloc failed %d\n", GetLastError());
2516 
2517  /* test compression format / engine */
2518  final_size = 0xdeadbeef;
2519  status = pRtlCompressBuffer(COMPRESSION_FORMAT_NONE, test_buffer, sizeof(test_buffer),
2520  buf1, sizeof(buf1) - 1, 4096, &final_size, workspace);
2521  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2522  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2523 
2524  final_size = 0xdeadbeef;
2525  status = pRtlCompressBuffer(COMPRESSION_FORMAT_DEFAULT, test_buffer, sizeof(test_buffer),
2526  buf1, sizeof(buf1) - 1, 4096, &final_size, workspace);
2527  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2528  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2529 
2530  final_size = 0xdeadbeef;
2531  status = pRtlCompressBuffer(0xFF, test_buffer, sizeof(test_buffer),
2532  buf1, sizeof(buf1) - 1, 4096, &final_size, workspace);
2533  ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status);
2534  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2535 
2536  /* test compression */
2537  final_size = 0xdeadbeef;
2538  memset(buf1, 0x11, sizeof(buf1));
2539  status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer),
2540  buf1, sizeof(buf1), 4096, &final_size, workspace);
2541  ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
2542  ok((*(WORD *)buf1 & 0x7000) == 0x3000, "no chunk signature found %04x\n", *(WORD *)buf1);
2543  todo_wine
2544  ok(final_size < sizeof(test_buffer), "got wrong final_size %u\n", final_size);
2545 
2546  /* test decompression */
2547  buf_size = final_size;
2548  final_size = 0xdeadbeef;
2549  memset(buf2, 0x11, sizeof(buf2));
2550  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf2, sizeof(buf2),
2551  buf1, buf_size, &final_size);
2552  ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
2553  ok(final_size == sizeof(test_buffer), "got wrong final_size %u\n", final_size);
2554  ok(!memcmp(buf2, test_buffer, sizeof(test_buffer)), "got wrong decoded data\n");
2555  ok(buf2[sizeof(test_buffer)] == 0x11, "too many bytes written\n");
2556 
2557  /* buffer too small */
2558  final_size = 0xdeadbeef;
2559  memset(buf1, 0x11, sizeof(buf1));
2560  status = pRtlCompressBuffer(COMPRESSION_FORMAT_LZNT1, test_buffer, sizeof(test_buffer),
2561  buf1, 4, 4096, &final_size, workspace);
2562  ok(status == STATUS_BUFFER_TOO_SMALL, "got wrong status 0x%08x\n", status);
2563 
2564  HeapFree(GetProcessHeap(), 0, workspace);
2565 }
#define STATUS_UNSUPPORTED_COMPRESSION
Definition: ntstatus.h:718
#define COMPRESSION_FORMAT_NONE
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define COMPRESSION_FORMAT_LZNT1
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned char UCHAR
Definition: xmlstorage.h:181
#define todo_wine
Definition: test.h:154
static TCHAR test_buffer[TEST_BUFFER_SIZE]
Definition: _tfileio.c:53
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: ps.c:97
#define COMPRESSION_FORMAT_DEFAULT

Referenced by START_TEST().

◆ test_RtlComputeCrc32()

static void test_RtlComputeCrc32 ( void  )
static

Definition at line 811 of file rtl.c.

812 {
813  DWORD crc = 0;
814 
815  if (!pRtlComputeCrc32)
816  {
817  win_skip("RtlComputeCrc32 is not available\n");
818  return;
819  }
820 
821  crc = pRtlComputeCrc32(crc, (const BYTE *)src, LEN);
822  ok(crc == 0x40861dc2,"Expected 0x40861dc2, got %8x\n", crc);
823 }
#define ok(value,...)
Definition: CComObject.cpp:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LEN
Definition: rtl.c:127
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlDecompressBuffer()

static void test_RtlDecompressBuffer ( void  )
static

Definition at line 2631 of file rtl.c.

2632 {
2633  static const struct
2634  {
2635  UCHAR compressed[32];
2636  ULONG compressed_size;
2637  NTSTATUS status;
2638  UCHAR uncompressed[32];
2639  ULONG uncompressed_size;
2640  DWORD broken_flags;
2641  }
2642  test_lznt[] =
2643  {
2644  /* 4 byte uncompressed chunk */
2645  {
2646  {0x03, 0x30, 'W', 'i', 'n', 'e'},
2647  6,
2649  "Wine",
2650  4,
2652  },
2653  /* 8 byte uncompressed chunk */
2654  {
2655  {0x07, 0x30, 'W', 'i', 'n', 'e', 'W', 'i', 'n', 'e'},
2656  10,
2658  "WineWine",
2659  8,
2661  },
2662  /* 4 byte compressed chunk */
2663  {
2664  {0x04, 0xB0, 0x00, 'W', 'i', 'n', 'e'},
2665  7,
2667  "Wine",
2668  4
2669  },
2670  /* 8 byte compressed chunk */
2671  {
2672  {0x08, 0xB0, 0x00, 'W', 'i', 'n', 'e', 'W', 'i', 'n', 'e'},
2673  11,
2675  "WineWine",
2676  8
2677  },
2678  /* compressed chunk using backwards reference */
2679  {
2680  {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x01, 0x30},
2681  9,
2683  "WineWine",
2684  8,
2686  },
2687  /* compressed chunk using backwards reference with length > bytes_read */
2688  {
2689  {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05, 0x30},
2690  9,
2692  "WineWineWine",
2693  12,
2695  },
2696  /* same as above, but unused bits != 0 */
2697  {
2698  {0x06, 0xB0, 0x30, 'W', 'i', 'n', 'e', 0x01, 0x30},
2699  9,
2701  "WineWine",
2702  8,
2704  },
2705  /* compressed chunk without backwards reference and unused bits != 0 */
2706  {
2707  {0x01, 0xB0, 0x02, 'W'},
2708  4,
2710  "W",
2711  1
2712  },
2713  /* termination sequence after first chunk */
2714  {
2715  {0x03, 0x30, 'W', 'i', 'n', 'e', 0x00, 0x00, 0x03, 0x30, 'W', 'i', 'n', 'e'},
2716  14,
2718  "Wine",
2719  4,
2721  },
2722  /* compressed chunk using backwards reference with 4 bit offset, 12 bit length */
2723  {
2724  {0x14, 0xB0, 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
2725  0x00, 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
2726  0x01, 0x01, 0xF0},
2727  23,
2729  "ABCDEFGHIJKLMNOPABCD",
2730  20,
2732  },
2733  /* compressed chunk using backwards reference with 5 bit offset, 11 bit length */
2734  {
2735  {0x15, 0xB0, 0x00, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
2736  0x00, 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
2737  0x02, 'A', 0x00, 0x78},
2738  24,
2740  "ABCDEFGHIJKLMNOPABCD",
2741  20,
2743  },
2744  /* uncompressed chunk with invalid magic */
2745  {
2746  {0x03, 0x20, 'W', 'i', 'n', 'e'},
2747  6,
2749  "Wine",
2750  4,
2752  },
2753  /* compressed chunk with invalid magic */
2754  {
2755  {0x04, 0xA0, 0x00, 'W', 'i', 'n', 'e'},
2756  7,
2758  "Wine",
2759  4
2760  },
2761  /* garbage byte after end of buffer */
2762  {
2763  {0x00, 0xB0, 0x02, 0x01},
2764  4,
2766  "",
2767  0
2768  },
2769  /* empty compressed chunk */
2770  {
2771  {0x00, 0xB0, 0x00},
2772  3,
2774  "",
2775  0
2776  },
2777  /* empty compressed chunk with unused bits != 0 */
2778  {
2779  {0x00, 0xB0, 0x01},
2780  3,
2782  "",
2783  0
2784  },
2785  /* empty input buffer */
2786  {
2787  {0},
2788  0,
2790  },
2791  /* incomplete chunk header */
2792  {
2793  {0x01},
2794  1,
2796  },
2797  /* incomplete chunk header */
2798  {
2799  {0x00, 0x30},
2800  2,
2802  },
2803  /* compressed chunk with invalid backwards reference */
2804  {
2805  {0x06, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05, 0x40},
2806  9,
2808  },
2809  /* compressed chunk with incomplete backwards reference */
2810  {
2811  {0x05, 0xB0, 0x10, 'W', 'i', 'n', 'e', 0x05},
2812  8,
2814  },
2815  /* incomplete uncompressed chunk */
2816  {
2817  {0x07, 0x30, 'W', 'i', 'n', 'e'},
2818  6,
2820  },
2821  /* incomplete compressed chunk */
2822  {
2823  {0x08, 0xB0, 0x00, 'W', 'i', 'n', 'e'},
2824  7,
2826  },
2827  /* two compressed chunks, the second one incomplete */
2828  {
2829  {0x00, 0xB0, 0x02, 0x00, 0xB0},
2830  5,
2832  }
2833  };
2834 
2835  static UCHAR buf[0x2000], workspace[0x1000];
2836  NTSTATUS status, expected_status;
2837  ULONG final_size;
2838  int i;
2839 
2840  if (!pRtlDecompressBuffer || !pRtlDecompressFragment)
2841  {
2842  win_skip("RtlDecompressBuffer or RtlDecompressFragment is not available\n");
2843  return;
2844  }
2845 
2846  /* test compression format / engine */
2847  final_size = 0xdeadbeef;
2848  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_NONE, buf, sizeof(buf), test_lznt[0].compressed,
2849  test_lznt[0].compressed_size, &final_size);
2850  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2851  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2852 
2853  final_size = 0xdeadbeef;
2854  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_DEFAULT, buf, sizeof(buf), test_lznt[0].compressed,
2855  test_lznt[0].compressed_size, &final_size);
2856  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2857  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2858 
2859  final_size = 0xdeadbeef;
2860  status = pRtlDecompressBuffer(0xFF, buf, sizeof(buf), test_lznt[0].compressed,
2861  test_lznt[0].compressed_size, &final_size);
2862  ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status);
2863  ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
2864 
2865  /* regular tests for RtlDecompressBuffer */
2866  for (i = 0; i < sizeof(test_lznt) / sizeof(test_lznt[0]); i++)
2867  {
2868  trace("Running test %d (compressed_size=%u, uncompressed_size=%u, status=0x%08x)\n",
2869  i, test_lznt[i].compressed_size, test_lznt[i].uncompressed_size, test_lznt[i].status);
2870 
2871  /* test with very big buffer */
2872  final_size = 0xdeadbeef;
2873  memset(buf, 0x11, sizeof(buf));
2874  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
2875  test_lznt[i].compressed_size, &final_size);
2877  (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
2878  if (!status)
2879  {
2880  ok(final_size == test_lznt[i].uncompressed_size,
2881  "%d: got wrong final_size %u\n", i, final_size);
2882  ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
2883  "%d: got wrong decoded data\n", i);
2884  ok(buf[test_lznt[i].uncompressed_size] == 0x11,
2885  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
2886  }
2887 
2888  /* test that modifier for compression engine is ignored */
2889  final_size = 0xdeadbeef;
2890  memset(buf, 0x11, sizeof(buf));
2891  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM, buf, sizeof(buf),
2892  test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
2894  (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)), "%d: got wrong status 0x%08x\n", i, status);
2895  if (!status)
2896  {
2897  ok(final_size == test_lznt[i].uncompressed_size,
2898  "%d: got wrong final_size %u\n", i, final_size);
2899  ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
2900  "%d: got wrong decoded data\n", i);
2901  ok(buf[test_lznt[i].uncompressed_size] == 0x11,
2902  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
2903  }
2904 
2905  /* test with expected output size */
2906  if (test_lznt[i].uncompressed_size > 0)
2907  {
2908  final_size = 0xdeadbeef;
2909  memset(buf, 0x11, sizeof(buf));
2910  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, test_lznt[i].uncompressed_size,
2911  test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
2912  ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
2913  if (!status)
2914  {
2915  ok(final_size == test_lznt[i].uncompressed_size,
2916  "%d: got wrong final_size %u\n", i, final_size);
2917  ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
2918  "%d: got wrong decoded data\n", i);
2919  ok(buf[test_lznt[i].uncompressed_size] == 0x11,
2920  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
2921  }
2922  }
2923 
2924  /* test with smaller output size */
2925  if (test_lznt[i].uncompressed_size > 1)
2926  {
2927  final_size = 0xdeadbeef;
2928  memset(buf, 0x11, sizeof(buf));
2929  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, test_lznt[i].uncompressed_size - 1,
2930  test_lznt[i].compressed, test_lznt[i].compressed_size, &final_size);
2931  if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_TRUNCATED)
2932  todo_wine
2933  ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
2934  else
2935  ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
2936  if (!status)
2937  {
2938  ok(final_size == test_lznt[i].uncompressed_size - 1,
2939  "%d: got wrong final_size %u\n", i, final_size);
2940  ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size - 1),
2941  "%d: got wrong decoded data\n", i);
2942  ok(buf[test_lznt[i].uncompressed_size - 1] == 0x11,
2943  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size - 1);
2944  }
2945  }
2946 
2947  /* test with zero output size */
2948  final_size = 0xdeadbeef;
2949  memset(buf, 0x11, sizeof(buf));
2950  status = pRtlDecompressBuffer(COMPRESSION_FORMAT_LZNT1, buf, 0, test_lznt[i].compressed,
2951  test_lznt[i].compressed_size, &final_size);
2952  if (is_incomplete_chunk(test_lznt[i].compressed, test_lznt[i].compressed_size, FALSE))
2953  ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
2954  else
2955  {
2956  ok(status == STATUS_SUCCESS, "%d: got wrong status 0x%08x\n", i, status);
2957  ok(final_size == 0, "%d: got wrong final_size %u\n", i, final_size);
2958  ok(buf[0] == 0x11, "%d: buf[0] was modified\n", i);
2959  }
2960 
2961  /* test RtlDecompressFragment with offset = 0 */
2962  final_size = 0xdeadbeef;
2963  memset(buf, 0x11, sizeof(buf));
2964  status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
2965  test_lznt[i].compressed_size, 0, &final_size, workspace);
2966  if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
2967  todo_wine
2968  ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
2969  else
2970  ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
2971  if (!status)
2972  {
2973  ok(final_size == test_lznt[i].uncompressed_size,
2974  "%d: got wrong final_size %u\n", i, final_size);
2975  ok(!memcmp(buf, test_lznt[i].uncompressed, test_lznt[i].uncompressed_size),
2976  "%d: got wrong decoded data\n", i);
2977  ok(buf[test_lznt[i].uncompressed_size] == 0x11,
2978  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size);
2979  }
2980 
2981  /* test RtlDecompressFragment with offset = 1 */
2982  final_size = 0xdeadbeef;
2983  memset(buf, 0x11, sizeof(buf));
2984  status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
2985  test_lznt[i].compressed_size, 1, &final_size, workspace);
2986  if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
2987  todo_wine
2988  ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
2989  else
2990  ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
2991  if (!status)
2992  {
2993  if (test_lznt[i].uncompressed_size == 0)
2994  {
2995  todo_wine
2996  ok(final_size == 4095, "%d: got wrong final_size %u\n", i, final_size);
2997  /* Buffer doesn't contain any useful value on Windows */
2998  ok(buf[4095] == 0x11, "%d: buf[4095] was modified\n", i);
2999  }
3000  else
3001  {
3002  ok(final_size == test_lznt[i].uncompressed_size - 1,
3003  "%d: got wrong final_size %u\n", i, final_size);
3004  ok(!memcmp(buf, test_lznt[i].uncompressed + 1, test_lznt[i].uncompressed_size - 1),
3005  "%d: got wrong decoded data\n", i);
3006  ok(buf[test_lznt[i].uncompressed_size - 1] == 0x11,
3007  "%d: buf[%u] was modified\n", i, test_lznt[i].uncompressed_size - 1);
3008  }
3009  }
3010 
3011  /* test RtlDecompressFragment with offset = 4095 */
3012  final_size = 0xdeadbeef;
3013  memset(buf, 0x11, sizeof(buf));
3014  status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
3015  test_lznt[i].compressed_size, 4095, &final_size, workspace);
3016  if (test_lznt[i].broken_flags & DECOMPRESS_BROKEN_FRAGMENT)
3017  todo_wine
3018  ok(status == STATUS_BAD_COMPRESSION_BUFFER, "%d: got wrong status 0x%08x\n", i, status);
3019  else
3020  ok(status == test_lznt[i].status, "%d: got wrong status 0x%08x\n", i, status);
3021  if (!status)
3022  {
3023  todo_wine
3024  ok(final_size == 1, "%d: got wrong final_size %u\n", i, final_size);
3025  todo_wine
3026  ok(buf[0] == 0, "%d: padding is not zero\n", i);
3027  ok(buf[1] == 0x11, "%d: buf[1] was modified\n", i);
3028  }
3029 
3030  /* test RtlDecompressFragment with offset = 4096 */
3031  final_size = 0xdeadbeef;
3032  memset(buf, 0x11, sizeof(buf));
3033  status = pRtlDecompressFragment(COMPRESSION_FORMAT_LZNT1, buf, sizeof(buf), test_lznt[i].compressed,
3034  test_lznt[i].compressed_size, 4096, &final_size, workspace);
3035  expected_status = is_incomplete_chunk(test_lznt[i].compressed, test_lznt[i].compressed_size, TRUE) ?
3036  test_lznt[i].status : STATUS_SUCCESS;
3037  ok(status == expected_status, "%d: got wrong status 0x%08x, expected 0x%08x\n", i, status, expected_status);
3038  if (!status)
3039  {
3040  ok(final_size == 0, "%d: got wrong final_size %u\n", i, final_size);
3041  ok(buf[0] == 0x11, "%d: buf[4096] was modified\n", i);
3042  }
3043  }
3044 }
#define STATUS_UNSUPPORTED_COMPRESSION
Definition: ntstatus.h:718
#define COMPRESSION_FORMAT_NONE
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
static BOOL is_incomplete_chunk(const UCHAR *compressed, ULONG compressed_size, BOOL check_all)
Definition: rtl.c:2607
static const BYTE uncompressed[]
Definition: misc.c:392
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DECOMPRESS_BROKEN_TRUNCATED
Definition: rtl.c:2629
#define STATUS_BAD_COMPRESSION_BUFFER
Definition: ntstatus.h:696
#define ok(value,...)
Definition: CComObject.cpp:34
#define COMPRESSION_FORMAT_LZNT1
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char UCHAR
Definition: xmlstorage.h:181
#define todo_wine
Definition: test.h:154
#define COMPRESSION_ENGINE_MAXIMUM
#define broken(x)
Definition: _sntprintf.h:21
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
#define DECOMPRESS_BROKEN_FRAGMENT
Definition: rtl.c:2628
Definition: ps.c:97
#define COMPRESSION_FORMAT_DEFAULT

Referenced by START_TEST().

◆ test_RtlDeleteTimer()

static void test_RtlDeleteTimer ( void  )
static

Definition at line 893 of file rtl.c.

894 {
895  NTSTATUS ret;
896 
897  if (!pRtlDeleteTimer)
898  {
899  win_skip("RtlDeleteTimer is not available\n");
900  return;
901  }
902 
903  ret = pRtlDeleteTimer(NULL, NULL, NULL);
905  ret == STATUS_INVALID_PARAMETER, /* W2K */
906  "expected STATUS_INVALID_PARAMETER_1 or STATUS_INVALID_PARAMETER, got %x\n", ret);
907 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
int ret
#define STATUS_INVALID_PARAMETER_1
Definition: ntstatus.h:461
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlFillMemory()

static void test_RtlFillMemory ( void  )
static

Definition at line 308 of file rtl.c.

309 {
310  if (!pRtlFillMemory)
311  {
312  win_skip("RtlFillMemory is not available\n");
313  return;
314  }
315 
316  /* Length should be in bytes and not rounded. Use strcmp to ensure we
317  * didn't write past the end (the remainder of the string should match)
318  */
319  FILL(0); CMP("This is a test!");
320  FILL(1); CMP("xhis is a test!");
321  FILL(2); CMP("xxis is a test!");
322  FILL(3); CMP("xxxs is a test!");
323  FILL(4); CMP("xxxx is a test!");
324  FILL(5); CMP("xxxxxis a test!");
325  FILL(6); CMP("xxxxxxs a test!");
326  FILL(7); CMP("xxxxxxx a test!");
327  FILL(8); CMP("xxxxxxxxa test!");
328  FILL(9); CMP("xxxxxxxxx test!");
329 }
#define CMP(str)
Definition: rtl.c:275
#define FILL(len)
Definition: rtl.c:306
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlFillMemoryUlong()

static void test_RtlFillMemoryUlong ( void  )
static

Definition at line 333 of file rtl.c.

334 {
335  ULONG val = ('x' << 24) | ('x' << 16) | ('x' << 8) | 'x';
336  if (!pRtlFillMemoryUlong)
337  {
338  win_skip("RtlFillMemoryUlong is not available\n");
339  return;
340  }
341 
342  /* Length should be in bytes and not rounded. Use strcmp to ensure we
343  * didn't write past the end (the remainder of the string should match)
344  */
345  LFILL(0); CMP("This is a test!");
346  LFILL(1); CMP("This is a test!");
347  LFILL(2); CMP("This is a test!");
348  LFILL(3); CMP("This is a test!");
349  LFILL(4); CMP("xxxx is a test!");
350  LFILL(5); CMP("xxxx is a test!");
351  LFILL(6); CMP("xxxx is a test!");
352  LFILL(7); CMP("xxxx is a test!");
353  LFILL(8); CMP("xxxxxxxxa test!");
354  LFILL(9); CMP("xxxxxxxxa test!");
355 }
#define LFILL(len)
Definition: rtl.c:331
#define CMP(str)
Definition: rtl.c:275
GLuint GLfloat * val
Definition: glext.h:7180
unsigned int ULONG
Definition: retypes.h:1
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlGetCompressionWorkSpaceSize()

static void test_RtlGetCompressionWorkSpaceSize ( void  )
static

Definition at line 2567 of file rtl.c.

2568 {
2569  ULONG compress_workspace, decompress_workspace;
2570  NTSTATUS status;
2571 
2572  if (!pRtlGetCompressionWorkSpaceSize)
2573  {
2574  win_skip("RtlGetCompressionWorkSpaceSize is not available\n");
2575  return;
2576  }
2577 
2578  /* test invalid format / engine */
2579  status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_NONE, &compress_workspace,
2580  &decompress_workspace);
2581  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2582 
2583  status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_DEFAULT, &compress_workspace,
2584  &decompress_workspace);
2585  ok(status == STATUS_INVALID_PARAMETER, "got wrong status 0x%08x\n", status);
2586 
2587  status = pRtlGetCompressionWorkSpaceSize(0xFF, &compress_workspace, &decompress_workspace);
2588  ok(status == STATUS_UNSUPPORTED_COMPRESSION, "got wrong status 0x%08x\n", status);
2589 
2590  /* test LZNT1 with normal and maximum compression */
2591  compress_workspace = decompress_workspace = 0xdeadbeef;
2592  status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1, &compress_workspace,
2593  &decompress_workspace);
2594  ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
2595  ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
2596  ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace);
2597 
2598  compress_workspace = decompress_workspace = 0xdeadbeef;
2599  status = pRtlGetCompressionWorkSpaceSize(COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM,
2600  &compress_workspace, &decompress_workspace);
2601  ok(status == STATUS_SUCCESS, "got wrong status 0x%08x\n", status);
2602  ok(compress_workspace != 0, "got wrong compress_workspace %u\n", compress_workspace);
2603  ok(decompress_workspace == 0x1000, "got wrong decompress_workspace %u\n", decompress_workspace);
2604 }
#define STATUS_UNSUPPORTED_COMPRESSION
Definition: ntstatus.h:718
#define COMPRESSION_FORMAT_NONE
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
#define ok(value,...)
Definition: CComObject.cpp:34
#define COMPRESSION_FORMAT_LZNT1
#define COMPRESSION_ENGINE_MAXIMUM
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
#define win_skip
Definition: test.h:141
Definition: ps.c:97
#define COMPRESSION_FORMAT_DEFAULT

Referenced by START_TEST().

◆ test_RtlInitializeCriticalSectionEx()

static void test_RtlInitializeCriticalSectionEx ( void  )
static

Definition at line 3145 of file rtl.c.

3146 {
3147  static const CRITICAL_SECTION_DEBUG *no_debug = (void *)~(ULONG_PTR)0;
3149 
3150  if (!pRtlInitializeCriticalSectionEx)
3151  {
3152  win_skip("RtlInitializeCriticalSectionEx is not available\n");
3153  return;
3154  }
3155 
3156  memset(&cs, 0x11, sizeof(cs));
3157  pRtlInitializeCriticalSectionEx(&cs, 0, 0);
3158  ok((cs.DebugInfo != NULL && cs.DebugInfo != no_debug) || broken(cs.DebugInfo == no_debug) /* >= Win 8 */,
3159  "expected DebugInfo != NULL and DebugInfo != ~0, got %p\n", cs.DebugInfo);
3160  ok(cs.LockCount == -1, "expected LockCount == -1, got %d\n", cs.LockCount);
3161  ok(cs.RecursionCount == 0, "expected RecursionCount == 0, got %d\n", cs.RecursionCount);
3162  ok(cs.LockSemaphore == NULL, "expected LockSemaphore == NULL, got %p\n", cs.LockSemaphore);
3163  ok(cs.SpinCount == 0 || broken(cs.SpinCount != 0) /* >= Win 8 */,
3164  "expected SpinCount == 0, got %ld\n", cs.SpinCount);
3166 
3167  memset(&cs, 0x11, sizeof(cs));
3168  pRtlInitializeCriticalSectionEx(&cs, 0, RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO);
3169  todo_wine
3170  ok(cs.DebugInfo == no_debug, "expected DebugInfo == ~0, got %p\n", cs.DebugInfo);
3171  ok(cs.LockCount == -1, "expected LockCount == -1, got %d\n", cs.LockCount);
3172  ok(cs.RecursionCount == 0, "expected RecursionCount == 0, got %d\n", cs.RecursionCount);
3173  ok(cs.LockSemaphore == NULL, "expected LockSemaphore == NULL, got %p\n", cs.LockSemaphore);
3174  ok(cs.SpinCount == 0 || broken(cs.SpinCount != 0) /* >= Win 8 */,
3175  "expected SpinCount == 0, got %ld\n", cs.SpinCount);
3177 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
uint32_t cs
Definition: isohybrid.c:75
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define todo_wine
Definition: test.h:154
#define broken(x)
Definition: _sntprintf.h:21
#define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO
Definition: winnt_old.h:1116
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlIpv4AddressToString()

static void test_RtlIpv4AddressToString ( void  )
static

Definition at line 1008 of file rtl.c.

1009 {
1010  CHAR buffer[20];
1011  CHAR *res;
1012  IN_ADDR ip;
1013  DWORD_PTR len;
1014 
1016  {
1017  win_skip("RtlIpv4AddressToStringA not available\n");
1018  return;
1019  }
1020 
1021  ip.S_un.S_un_b.s_b1 = 1;
1022  ip.S_un.S_un_b.s_b2 = 2;
1023  ip.S_un.S_un_b.s_b3 = 3;
1024  ip.S_un.S_un_b.s_b4 = 4;
1025 
1026  memset(buffer, '#', sizeof(buffer) - 1);
1027  buffer[sizeof(buffer) -1] = 0;
1029  len = strlen(buffer);
1030  ok(res == (buffer + len), "got %p with '%s' (expected %p)\n", res, buffer, buffer + len);
1031 
1033  ok( (res == (char *)~0) ||
1034  broken(res == (char *)len), /* XP and w2003 */
1035  "got %p (expected ~0)\n", res);
1036 
1037  if (0) {
1038  /* this crashes in windows */
1039  memset(buffer, '#', sizeof(buffer) - 1);
1040  buffer[sizeof(buffer) -1] = 0;
1042  trace("got %p with '%s'\n", res, buffer);
1043  }
1044 
1045  if (0) {
1046  /* this crashes in windows */
1048  trace("got %p\n", res);
1049  }
1050 }
#define trace(...)
Definition: kmt_test.h:217
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
GLuint buffer
Definition: glext.h:5915
NTSTATUS res
Definition: rtl.c:1174
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
Definition: tcpip.h:125
GLenum GLsizei len
Definition: glext.h:6722
static CHAR *WINAPI * pRtlIpv4AddressToStringA(const IN_ADDR *, LPSTR)
uint32_t DWORD_PTR
Definition: typedefs.h:63
#define broken(x)
Definition: _sntprintf.h:21
GLuint res
Definition: glext.h:9613
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlIpv4AddressToStringEx()

static void test_RtlIpv4AddressToStringEx ( void  )
static

Definition at line 1052 of file rtl.c.

1053 {
1054  CHAR ip_1234[] = "1.2.3.4";
1055  CHAR ip_1234_80[] = "1.2.3.4:80";
1056  LPSTR expect;
1057  CHAR buffer[30];
1058  NTSTATUS res;
1059  IN_ADDR ip;
1060  ULONG size;
1061  DWORD used;
1062  USHORT port;
1063 
1064  if (!pRtlIpv4AddressToStringExA)
1065  {
1066  win_skip("RtlIpv4AddressToStringExA not available\n");
1067  return;
1068  }
1069 
1070  ip.S_un.S_un_b.s_b1 = 1;
1071  ip.S_un.S_un_b.s_b2 = 2;
1072  ip.S_un.S_un_b.s_b3 = 3;
1073  ip.S_un.S_un_b.s_b4 = 4;
1074 
1075  port = htons(80);
1076  expect = ip_1234_80;
1077 
1078  size = sizeof(buffer);
1079  memset(buffer, '#', sizeof(buffer) - 1);
1080  buffer[sizeof(buffer) -1] = 0;
1081  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1082  used = strlen(buffer);
1083  ok( (res == STATUS_SUCCESS) &&
1084  (size == strlen(expect) + 1) && !strcmp(buffer, expect),
1085  "got 0x%x and size %d with '%s'\n", res, size, buffer);
1086 
1087  size = used + 1;
1088  memset(buffer, '#', sizeof(buffer) - 1);
1089  buffer[sizeof(buffer) -1] = 0;
1090  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1091  ok( (res == STATUS_SUCCESS) &&
1092  (size == strlen(expect) + 1) && !strcmp(buffer, expect),
1093  "got 0x%x and size %d with '%s'\n", res, size, buffer);
1094 
1095  size = used;
1096  memset(buffer, '#', sizeof(buffer) - 1);
1097  buffer[sizeof(buffer) -1] = 0;
1098  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1099  ok( (res == STATUS_INVALID_PARAMETER) && (size == used + 1),
1100  "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1101  res, size, buffer, used + 1);
1102 
1103  size = used - 1;
1104  memset(buffer, '#', sizeof(buffer) - 1);
1105  buffer[sizeof(buffer) -1] = 0;
1106  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1107  ok( (res == STATUS_INVALID_PARAMETER) && (size == used + 1),
1108  "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1109  res, size, buffer, used + 1);
1110 
1111 
1112  /* to get only the ip, use 0 as port */
1113  port = 0;
1114  expect = ip_1234;
1115 
1116  size = sizeof(buffer);
1117  memset(buffer, '#', sizeof(buffer) - 1);
1118  buffer[sizeof(buffer) -1] = 0;
1119  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1120  used = strlen(buffer);
1121  ok( (res == STATUS_SUCCESS) &&
1122  (size == strlen(expect) + 1) && !strcmp(buffer, expect),
1123  "got 0x%x and size %d with '%s'\n", res, size, buffer);
1124 
1125  size = used + 1;
1126  memset(buffer, '#', sizeof(buffer) - 1);
1127  buffer[sizeof(buffer) -1] = 0;
1128  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1129  ok( (res == STATUS_SUCCESS) &&
1130  (size == strlen(expect) + 1) && !strcmp(buffer, expect),
1131  "got 0x%x and size %d with '%s'\n", res, size, buffer);
1132 
1133  size = used;
1134  memset(buffer, '#', sizeof(buffer) - 1);
1135  buffer[sizeof(buffer) -1] = 0;
1136  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1137  ok( (res == STATUS_INVALID_PARAMETER) && (size == used + 1),
1138  "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1139  res, size, buffer, used + 1);
1140 
1141  size = used - 1;
1142  memset(buffer, '#', sizeof(buffer) - 1);
1143  buffer[sizeof(buffer) -1] = 0;
1144  res = pRtlIpv4AddressToStringExA(&ip, port, buffer, &size);
1145  ok( (res == STATUS_INVALID_PARAMETER) && (size == used + 1),
1146  "got 0x%x and %d with '%s' (expected STATUS_INVALID_PARAMETER and %d)\n",
1147  res, size, buffer, used + 1);
1148 
1149 
1150  /* parameters are checked */
1151  memset(buffer, '#', sizeof(buffer) - 1);
1152  buffer[sizeof(buffer) -1] = 0;
1153  res = pRtlIpv4AddressToStringExA(&ip, 0, buffer, NULL);
1155  "got 0x%x with '%s' (expected STATUS_INVALID_PARAMETER)\n", res, buffer);
1156 
1157  size = sizeof(buffer);
1158  res = pRtlIpv4AddressToStringExA(&ip, 0, NULL, &size);
1160  "got 0x%x and size %d (expected STATUS_INVALID_PARAMETER)\n", res, size);
1161 
1162  size = sizeof(buffer);
1163  memset(buffer, '#', sizeof(buffer) - 1);
1164  buffer[sizeof(buffer) -1] = 0;
1165  res = pRtlIpv4AddressToStringExA(NULL, 0, buffer, &size);
1167  "got 0x%x and size %d with '%s' (expected STATUS_INVALID_PARAMETER)\n",
1168  res, size, buffer);
1169 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
GLuint buffer
Definition: glext.h:5915
NTSTATUS res
Definition: rtl.c:1174
char * LPSTR
Definition: xmlstorage.h:182
#define htons(s)
Definition: rtl.c:65
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
c used
Definition: write.c:2885
GLsizeiptr size
Definition: glext.h:5919
Definition: dhcpd.h:61
Definition: tcpip.h:125
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short USHORT
Definition: pedump.c:61
#define expect(expected, got)
Definition: combo.c:36
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
return STATUS_SUCCESS
Definition: btrfs.c:2725
USHORT port
Definition: uri.c:227
#define memset(x, y, z)
Definition: compat.h:39
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_RtlIpv4StringToAddress()

static void test_RtlIpv4StringToAddress ( void  )
static

Definition at line 1267 of file rtl.c.

1268 {
1269  NTSTATUS res;
1270  IN_ADDR ip, expected_ip;
1271  PCSTR terminator;
1272  CHAR dummy;
1273  unsigned int i;
1274 
1275  if (!pRtlIpv4StringToAddressA)
1276  {
1277  skip("RtlIpv4StringToAddress not available\n");
1278  return;
1279  }
1280 
1281  if (0)
1282  {
1283  /* leaving either parameter NULL crashes on Windows */
1284  res = pRtlIpv4StringToAddressA(NULL, FALSE, &terminator, &ip);
1285  res = pRtlIpv4StringToAddressA("1.1.1.1", FALSE, NULL, &ip);
1286  res = pRtlIpv4StringToAddressA("1.1.1.1", FALSE, &terminator, NULL);
1287  /* same for the wide char version */
1288  /*
1289  res = pRtlIpv4StringToAddressW(NULL, FALSE, &terminatorW, &ip);
1290  res = pRtlIpv4StringToAddressW(L"1.1.1.1", FALSE, NULL, &ip);
1291  res = pRtlIpv4StringToAddressW(L"1.1.1.1", FALSE, &terminatorW, NULL);
1292  */
1293  }
1294 
1295  for (i = 0; i < ipv4_testcount; i++)
1296  {
1297  /* non-strict */
1298  terminator = &dummy;
1299  ip.S_un.S_addr = 0xabababab;
1300  res = pRtlIpv4StringToAddressA(ipv4_tests[i].address, FALSE, &terminator, &ip);
1301  ok(res == ipv4_tests[i].res,
1302  "[%s] res = 0x%08x, expected 0x%08x\n",
1304  ok(terminator == ipv4_tests[i].address + ipv4_tests[i].terminator_offset,
1305  "[%s] terminator = %p, expected %p\n",
1307 
1308  init_ip4(&expected_ip, ipv4_tests[i].ip);
1309  ok(ip.S_un.S_addr == expected_ip.S_un.S_addr,
1310  "[%s] ip = %08x, expected %08x\n",
1311  ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr);
1312 
1313  if (!(ipv4_tests[i].flags & strict_diff_4))
1314  {
1315  ipv4_tests[i].res_strict = ipv4_tests[i].res;
1316  ipv4_tests[i].terminator_offset_strict = ipv4_tests[i].terminator_offset;
1317  ipv4_tests[i].ip_strict[0] = ipv4_tests[i].ip[0];
1318  ipv4_tests[i].ip_strict[1] = ipv4_tests[i].ip[1];
1319  ipv4_tests[i].ip_strict[2] = ipv4_tests[i].ip[2];
1320  ipv4_tests[i].ip_strict[3] = ipv4_tests[i].ip[3];
1321  }
1322  /* strict */
1323  terminator = &dummy;
1324  ip.S_un.S_addr = 0xabababab;
1325  res = pRtlIpv4StringToAddressA(ipv4_tests[i].address, TRUE, &terminator, &ip);
1327  "[%s] res = 0x%08x, expected 0x%08x\n",
1330  "[%s] terminator = %p, expected %p\n",
1332 
1333  init_ip4(&expected_ip, ipv4_tests[i].ip_strict);
1334  ok(ip.S_un.S_addr == expected_ip.S_un.S_addr,
1335  "[%s] ip = %08x, expected %08x\n",
1336  ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr);
1337  }
1338 }
int ip_strict[4]
Definition: rtl.c:1180
NTSTATUS res_strict
Definition: rtl.c:1178
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
int terminator_offset_strict
Definition: rtl.c:1179
NTSTATUS res
Definition: rtl.c:1174
static struct @1609 ipv4_tests[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
int terminator_offset
Definition: rtl.c:1175
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
Definition: tcpip.h:125
static void init_ip4(IN_ADDR *addr, const int src[4])
Definition: rtl.c:1252
GLuint address
Definition: glext.h:9393
GLbitfield flags
Definition: glext.h:7161
u_long S_addr
Definition: tcpip.h:131
union in_addr::@981 S_un
unsigned char dummy
Definition: maze.c:118
#define skip(...)
Definition: CString.cpp:57
GLuint res
Definition: glext.h:9613
const char * PCSTR
Definition: typedefs.h:51
const unsigned int ipv4_testcount
Definition: rtl.c:1250

Referenced by START_TEST().

◆ test_RtlIpv4StringToAddressEx()

static void test_RtlIpv4StringToAddressEx ( void  )
static

Definition at line 1340 of file rtl.c.

1341 {
1342  NTSTATUS res;
1343  IN_ADDR ip, expected_ip;
1344  USHORT port;
1345  static const struct
1346  {
1347  PCSTR address;
1348  NTSTATUS res;
1349  int ip[4];
1350  USHORT port;
1351  } ipv4_ex_tests[] =
1352  {
1353  { "", STATUS_INVALID_PARAMETER, { -1 }, 0xdead },
1354  { " ", STATUS_INVALID_PARAMETER, { -1 }, 0xdead },
1355  { "1.1.1.1:", STATUS_INVALID_PARAMETER, { 1, 1, 1, 1 }, 0xdead },
1356  { "1.1.1.1+", STATUS_INVALID_PARAMETER, { 1, 1, 1, 1 }, 0xdead },
1357  { "1.1.1.1:1", STATUS_SUCCESS, { 1, 1, 1, 1 }, 0x100 },
1358  { "256.1.1.1:1", STATUS_INVALID_PARAMETER, { -1 }, 0xdead },
1359  { "-1.1.1.1:1", STATUS_INVALID_PARAMETER, { -1 }, 0xdead },
1360  { "0.0.0.0:0", STATUS_INVALID_PARAMETER, { 0, 0, 0, 0 }, 0xdead },
1361  { "0.0.0.0:1", STATUS_SUCCESS, { 0, 0, 0, 0 }, 0x100 },
1362  { "1.2.3.4:65535", STATUS_SUCCESS, { 1, 2, 3, 4 }, 65535 },
1363  { "1.2.3.4:65536", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead },
1364  { "1.2.3.4:0xffff", STATUS_SUCCESS, { 1, 2, 3, 4 }, 65535 },
1365  { "1.2.3.4:0XfFfF", STATUS_SUCCESS, { 1, 2, 3, 4 }, 65535 },
1366  { "1.2.3.4:011064", STATUS_SUCCESS, { 1, 2, 3, 4 }, 0x3412 },
1367  { "1.2.3.4:1234a", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead },
1368  { "1.2.3.4:1234+", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead },
1369  { "1.2.3.4: 1234", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead },
1370  { "1.2.3.4:\t1234", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead },
1371  };
1372  const unsigned int ipv4_ex_testcount = sizeof(ipv4_ex_tests) / sizeof(ipv4_ex_tests[0]);
1373  unsigned int i;
1374  BOOLEAN strict;
1375 
1376  if (!pRtlIpv4StringToAddressExA)
1377  {
1378  skip("RtlIpv4StringToAddressEx not available\n");
1379  return;
1380  }
1381 
1382  /* do not crash, and do not touch the ip / port. */
1383  ip.S_un.S_addr = 0xabababab;
1384  port = 0xdead;
1385  res = pRtlIpv4StringToAddressExA(NULL, FALSE, &ip, &port);
1386  ok(res == STATUS_INVALID_PARAMETER, "[null address] res = 0x%08x, expected 0x%08x\n",
1388  ok(ip.S_un.S_addr == 0xabababab, "RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n", ip.S_un.S_addr);
1389  ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port);
1390 
1391  port = 0xdead;
1392  res = pRtlIpv4StringToAddressExA("1.1.1.1", FALSE, NULL, &port);
1393  ok(res == STATUS_INVALID_PARAMETER, "[null ip] res = 0x%08x, expected 0x%08x\n",
1395  ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port);
1396 
1397  ip.S_un.S_addr = 0xabababab;
1398  port = 0xdead;
1399  res = pRtlIpv4StringToAddressExA("1.1.1.1", FALSE, &ip, NULL);
1400  ok(res == STATUS_INVALID_PARAMETER, "[null port] res = 0x%08x, expected 0x%08x\n",
1402  ok(ip.S_un.S_addr == 0xabababab, "RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n", ip.S_un.S_addr);
1403  ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port);
1404 
1405  /* first we run the non-ex testcases on the ex function */
1406  for (i = 0; i < ipv4_testcount; i++)
1407  {
1408  NTSTATUS expect_res = (ipv4_tests[i].flags & ex_fail_4) ? STATUS_INVALID_PARAMETER : ipv4_tests[i].res;
1409 
1410  /* non-strict */
1411  port = 0xdead;
1412  ip.S_un.S_addr = 0xabababab;
1413  res = pRtlIpv4StringToAddressExA(ipv4_tests[i].address, FALSE, &ip, &port);
1414  ok(res == expect_res, "[%s] res = 0x%08x, expected 0x%08x\n",
1415  ipv4_tests[i].address, res, expect_res);
1416 
1417  init_ip4(&expected_ip, ipv4_tests[i].ip);
1418  ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n",
1419  ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr);
1420 
1421  if (!(ipv4_tests[i].flags & strict_diff_4))
1422  {
1423  ipv4_tests[i].res_strict = ipv4_tests[i].res;
1424  ipv4_tests[i].terminator_offset_strict = ipv4_tests[i].terminator_offset;
1425  ipv4_tests[i].ip_strict[0] = ipv4_tests[i].ip[0];
1426  ipv4_tests[i].ip_strict[1] = ipv4_tests[i].ip[1];
1427  ipv4_tests[i].ip_strict[2] = ipv4_tests[i].ip[2];
1428  ipv4_tests[i].ip_strict[3] = ipv4_tests[i].ip[3];
1429  }
1430  /* strict */
1431  expect_res = (ipv4_tests[i].flags & ex_fail_4) ? STATUS_INVALID_PARAMETER : ipv4_tests[i].res_strict;
1432  port = 0xdead;
1433  ip.S_un.S_addr = 0xabababab;
1434  res = pRtlIpv4StringToAddressExA(ipv4_tests[i].address, TRUE, &ip, &port);
1435  ok(res == expect_res, "[%s] res = 0x%08x, expected 0x%08x\n",
1436  ipv4_tests[i].address, res, expect_res);
1437 
1438  init_ip4(&expected_ip, ipv4_tests[i].ip_strict);
1439  ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n",
1440  ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr);
1441  }
1442 
1443 
1444  for (i = 0; i < ipv4_ex_testcount; i++)
1445  {
1446  /* Strict is only relevant for the ip address, so make sure that it does not influence the port */
1447  for (strict = 0; strict < 2; strict++)
1448  {
1449  ip.S_un.S_addr = 0xabababab;
1450  port = 0xdead;
1451  res = pRtlIpv4StringToAddressExA(ipv4_ex_tests[i].address, strict, &ip, &port);
1452  ok(res == ipv4_ex_tests[i].res, "[%s] res = 0x%08x, expected 0x%08x\n",
1453  ipv4_ex_tests[i].address, res, ipv4_ex_tests[i].res);
1454 
1455  init_ip4(&expected_ip, ipv4_ex_tests[i].ip);
1456  ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n",
1457  ipv4_ex_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr);
1458  ok(port == ipv4_ex_tests[i].port, "[%s] port = %u, expected %u\n",
1459  ipv4_ex_tests[i].address, port, ipv4_ex_tests[i].port);
1460  }
1461  }
1462 }
int ip_strict[4]
Definition: rtl.c:1180
NTSTATUS res_strict
Definition: rtl.c:1178
#define TRUE
Definition: types.h:120
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS res
Definition: rtl.c:1174
static struct @1609 ipv4_tests[]
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int ip[4]
Definition: rtl.c:1176
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
PCSTR address
Definition: rtl.c:1173
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
Definition: tcpip.h:125
static int strict
Definition: error.c:51
static void init_ip4(IN_ADDR *addr, const int src[4])
Definition: rtl.c:1252
GLuint address
Definition: glext.h:9393
GLbitfield flags
Definition: glext.h:7161
u_long S_addr
Definition: tcpip.h:131
union in_addr::@981 S_un
unsigned short USHORT
Definition: pedump.c:61
#define skip(...)
Definition: CString.cpp:57
GLuint res
Definition: glext.h:9613
const char * PCSTR
Definition: typedefs.h:51
const unsigned int ipv4_testcount
Definition: rtl.c:1250
return STATUS_SUCCESS
Definition: btrfs.c:2725
USHORT port
Definition: uri.c:227

Referenced by START_TEST().

◆ test_RtlIpv6AddressToString()

static void test_RtlIpv6AddressToString ( void  )
static

Definition at line 1754 of file rtl.c.

1755 {
1756  CHAR buffer[50];
1757  LPCSTR result;
1758  IN6_ADDR ip;
1759  DWORD_PTR len;
1760  struct
1761  {
1762  PCSTR address;
1763  int ip[8];
1764  } tests[] =
1765  {
1766  /* ipv4 addresses & ISATAP addresses */
1767  { "::13.1.68.3", { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1768  { "::ffff:13.1.68.3", { 0, 0, 0, 0, 0, 0xffff, 0x10d, 0x344 } },
1769  { "::feff:d01:4403", { 0, 0, 0, 0, 0, 0xfffe, 0x10d, 0x344 } },
1770  { "::fffe:d01:4403", { 0, 0, 0, 0, 0, 0xfeff, 0x10d, 0x344 } },
1771  { "::100:d01:4403", { 0, 0, 0, 0, 0, 1, 0x10d, 0x344 } },
1772  { "::1:d01:4403", { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1773  { "::ffff:0:4403", { 0, 0, 0, 0, 0, 0xffff, 0, 0x344 } },
1774  { "::ffff:13.1.0.0", { 0, 0, 0, 0, 0, 0xffff, 0x10d, 0 } },
1775  { "::ffff:0:0", { 0, 0, 0, 0, 0, 0xffff, 0, 0 } },
1776  { "::ffff:0:13.1.68.3", { 0, 0, 0, 0, 0xffff, 0, 0x10d, 0x344 } },
1777  { "::ffff:ffff:d01:4403", { 0, 0, 0, 0, 0xffff, 0xffff, 0x10d, 0x344 } },
1778  { "::ffff:0:0:d01:4403", { 0, 0, 0, 0xffff, 0, 0, 0x10d, 0x344 } },
1779  { "::ffff:255.255.255.255", { 0, 0, 0, 0, 0, 0xffff, 0xffff, 0xffff } },
1780  { "::ffff:129.144.52.38", { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } },
1781  { "::5efe:129.144.52.38", { 0, 0, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1782  { "1111:2222:3333:4444:0:5efe:129.144.52.38", { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1783  { "1111:2222:3333::5efe:129.144.52.38", { 0x1111, 0x2222, 0x3333, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1784  { "1111:2222::5efe:129.144.52.38", { 0x1111, 0x2222, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1785  { "1111::5efe:129.144.52.38", { 0x1111, 0, 0, 0, 0, 0xfe5e, 0x9081, 0x2634 } },
1786  { "::200:5efe:129.144.52.38", { 0, 0, 0, 0, 2, 0xfe5e, 0x9081, 0x2634 } },
1787  { "::100:5efe:8190:3426", { 0, 0, 0, 0, 1, 0xfe5e, 0x9081, 0x2634 } },
1788  /* 'normal' addresses */
1789  { "::1", { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1790  { "0:1:2:3:4:5:6:7", { 0, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 } },
1791  { "1080::8:800:200c:417a", { 0x8010, 0, 0, 0, 0x800, 0x8, 0x0c20, 0x7a41 } },
1792  { "1111:2222:3333:4444:5555:6666:7b7b:7b7b", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1793  { "1111:2222:3333:4444:5555:6666:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1794  { "1111:2222:3333:4444:5555:6666::", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0 } },
1795  { "1111:2222:3333:4444:5555:6666:0:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } },
1796  { "1111:2222:3333:4444:5555::", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } },
1797  { "1111:2222:3333:4444:5555:0:7b7b:7b7b", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7b7b, 0x7b7b } },
1798  { "1111:2222:3333:4444:5555:0:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7777, 0x8888 } },
1799  { "1111:2222:3333:4444:5555::8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 } },
1800  { "1111::", { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1801  { "1111::7b7b:7b7b", { 0x1111, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1802  { "1111:0:3333:4444:5555:6666:7b7b:7b7b", { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1803  { "1111:0:3333:4444:5555:6666:7777:8888", { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1804  { "1111::4444:5555:6666:7b7b:7b7b", { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1805  { "1111::4444:5555:6666:7777:8888", { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1806  { "1111::5555:6666:7b7b:7b7b", { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1807  { "1111::5555:6666:7777:8888", { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7777, 0x8888 } },
1808  { "1111::6666:7b7b:7b7b", { 0x1111, 0, 0, 0, 0, 0x6666, 0x7b7b, 0x7b7b } },
1809  { "1111::6666:7777:8888", { 0x1111, 0, 0, 0, 0, 0x6666, 0x7777, 0x8888 } },
1810  { "1111::7777:8888", { 0x1111, 0, 0, 0, 0, 0, 0x7777, 0x8888 } },
1811  { "1111::8888", { 0x1111, 0, 0, 0, 0, 0, 0, 0x8888 } },
1812  { "1:2:3:4:5:6:102:304", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x201, 0x403 } },
1813  { "1:2:3:4:5:6:7:8", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800 } },
1814  { "1:2:3:4:5:6::", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0 } },
1815  { "1:2:3:4:5:6:0:8", { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0x800 } },
1816  { "2001:0:1234::c1c0:abcd:876", { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
1817  { "2001:0:4136:e378:8000:63bf:3fff:fdd2", { 0x120, 0, 0x3641, 0x78e3, 0x80, 0xbf63, 0xff3f, 0xd2fd } },
1818  { "2001:db8::1428:57ab", { 0x120, 0xb80d, 0, 0, 0, 0, 0x2814, 0xab57 } },
1819  { "2001:db8:1234:ffff:ffff:ffff:ffff:ffff", { 0x120, 0xb80d, 0x3412, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1820  { "2001:0:ce49:7601:2cad:dfff:7c94:fffe", { 0x120, 0, 0x49ce, 0x176, 0xad2c, 0xffdf, 0x947c, 0xfeff } },
1821  { "2001:db8:85a3::8a2e:370:7334", { 0x120, 0xb80d, 0xa385, 0, 0, 0x2e8a, 0x7003, 0x3473 } },
1822  { "3ffe:b00::1:0:0:a", { 0xfe3f, 0xb, 0, 0, 0x100, 0, 0, 0xa00 } },
1823  { "::a:b:c:d:e", { 0, 0, 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00 } },
1824  { "::123.123.123.123", { 0, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } },
1825  { "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } },
1826  { "1111:2222:3333:4444:5555:6666:7777:1", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 } },
1827  { "1111:2222:3333:4444:5555:6666:7777:8888", { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } },
1828  { "1111:2222::", { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 } },
1829  { "1111::3333:4444:5555:6666:7777", { 0x1111, 0, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777 } },
1830  { "1111:2222::", { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 } },
1831  { "1111::3333", { 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 } },
1832  { "2001:0:1234::c1c0:abcd:876", { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } },
1833  { "2001::ffd3", { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1834  };
1835  const size_t testcount = sizeof(tests) / sizeof(tests[0]);
1836  unsigned int i;
1837 
1839  {
1840  skip("RtlIpv6AddressToStringA not available\n");
1841  return;
1842  }
1843 
1844  memset(buffer, '#', sizeof(buffer));
1845  buffer[sizeof(buffer)-1] = 0;
1846  memset(&ip, 0, sizeof(ip));
1848 
1849  len = strlen(buffer);
1850  ok(result == (buffer + len) && !strcmp(buffer, "::"),
1851  "got %p with '%s' (expected %p with '::')\n", result, buffer, buffer + len);
1852 
1854  ok(result == (LPCSTR)~0 || broken(result == (LPCSTR)len) /* WinXP / Win2k3 */,
1855  "got %p, expected %p\n", result, (LPCSTR)~0);
1856 
1857  for (i = 0; i < testcount; i++)
1858  {
1859  init_ip6(&ip, tests[i].ip);
1860  memset(buffer, '#', sizeof(buffer));
1861  buffer[sizeof(buffer)-1] = 0;
1862 
1864  len = strlen(buffer);
1865  ok(result == (buffer + len) && !strcmp(buffer, tests[i].address),
1866  "got %p with '%s' (expected %p with '%s')\n", result, buffer, buffer + len, tests[i].address);
1867 
1868  ok(buffer[45] == 0 || broken(buffer[45] != 0) /* WinXP / Win2k3 */,
1869  "expected data at buffer[45] to always be NULL\n");
1870  ok(buffer[46] == '#', "expected data at buffer[46] not to change\n");
1871  }
1872 }
struct param_test tests[]
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char CHAR
Definition: xmlstorage.h:175
GLuint buffer
Definition: glext.h:5915
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
PCSTR address
Definition: rtl.c:1173
const char * LPCSTR
Definition: xmlstorage.h:183
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
GLuint address
Definition: glext.h:9393
GLenum GLsizei len
Definition: glext.h:6722
uint32_t DWORD_PTR
Definition: typedefs.h:63
static void init_ip6(IN6_ADDR *addr, const int src[8])
Definition: rtl.c:1739
#define broken(x)
Definition: _sntprintf.h:21
#define skip(...)
Definition: CString.cpp:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const char * PCSTR
Definition: typedefs.h:51
GLuint64EXT * result
Definition: glext.h:11304
#define memset(x, y, z)
Definition: compat.h:39
static CHAR *WINAPI * pRtlIpv6AddressToStringA(struct in6_addr *, PSTR)

Referenced by START_TEST().

◆ test_RtlIpv6AddressToStringEx()

static void test_RtlIpv6AddressToStringEx ( void  )
static

Definition at line 1874 of file rtl.c.

1875 {
1876  CHAR buffer[70];
1877  NTSTATUS res;
1878  IN6_ADDR ip;
1879  ULONG len;
1880  struct
1881  {
1882  PCSTR address;
1883  ULONG scopeid;
1884  USHORT port;
1885  int ip[8];
1886  } tests[] =
1887  {
1888  /* ipv4 addresses & ISATAP addresses */
1889  { "::13.1.68.3", 0, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1890  { "::13.1.68.3%1", 1, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1891  { "::13.1.68.3%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1892  { "[::13.1.68.3%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1893  { "[::13.1.68.3%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1894  { "[::13.1.68.3]:256", 0, 1, { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } },
1895 
1896  { "::1:d01:4403", 0, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1897  { "::1:d01:4403%1", 1, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1898  { "::1:d01:4403%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1899  { "[::1:d01:4403%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1900  { "[::1:d01:4403%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1901  { "[::1:d01:4403]:256", 0, 1, { 0, 0, 0, 0, 0, 0x100, 0x10d, 0x344 } },
1902 
1903  { "1111:2222:3333:4444:0:5efe:129.144.52.38", 0, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1904  { "1111:2222:3333:4444:0:5efe:129.144.52.38%1", 1, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1905  { "1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819", 0xffffbbbb, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1906  { "[1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819]:65518",0xffffbbbb, 0xeeff, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1907  { "[1111:2222:3333:4444:0:5efe:129.144.52.38%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1908  { "[1111:2222:3333:4444:0:5efe:129.144.52.38]:256", 0, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0, 0xfe5e, 0x9081, 0x2634 } },
1909 
1910  { "::1", 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1911  { "::1%1", 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1912  { "::1%4294949819", 0xffffbbbb, 0, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1913  { "[::1%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1914  { "[::1%4294949819]:256", 0xffffbbbb, 1, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1915  { "[::1]:256", 0, 1, { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
1916 
1917  { "1111:2222:3333:4444:5555:6666:7b7b:7b7b", 0, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1918  { "1111:2222:3333:4444:5555:6666:7b7b:7b7b%1", 1, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1919  { "1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819", 0xffffbbbb, 0, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1920  { "[1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1921  { "[1111:2222:3333:4444:5555:6666:7b7b:7b7b%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1922  { "[1111:2222:3333:4444:5555:6666:7b7b:7b7b]:256", 0, 1, { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } },
1923 
1924  { "1111::", 0, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1925  { "1111::%1", 1, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1926  { "1111::%4294949819", 0xffffbbbb, 0, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1927  { "[1111::%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1928  { "[1111::%4294949819]:256", 0xffffbbbb, 1, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1929  { "[1111::]:256", 0, 1, { 0x1111, 0, 0, 0, 0, 0, 0, 0 } },
1930 
1931  { "2001::ffd3", 0, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1932  { "2001::ffd3%1", 1, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1933  { "2001::ffd3%4294949819", 0xffffbbbb, 0, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1934  { "[2001::ffd3%4294949819]:65518", 0xffffbbbb, 0xeeff, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1935  { "[2001::ffd3%4294949819]:256", 0xffffbbbb, 1, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1936  { "[2001::ffd3]:256", 0, 1, { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff } },
1937  };
1938  const size_t testcount = sizeof(tests) / sizeof(tests[0]);
1939  unsigned int i;
1940 
1941  if (!pRtlIpv6AddressToStringExA)
1942  {
1943  skip("RtlIpv6AddressToStringExA not available\n");
1944  return;
1945  }
1946 
1947  memset(buffer, '#', sizeof(buffer));
1948  buffer[sizeof(buffer)-1] = 0;
1949  memset(&ip, 0, sizeof(ip));
1950  len = sizeof(buffer);
1951  res = pRtlIpv6AddressToStringExA(&ip, 0, 0, buffer, &len);
1952 
1953  ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res);
1954  ok(len == 3 && !strcmp(buffer, "::"),
1955  "got len %d with '%s' (expected 3 with '::')\n", len, buffer);
1956 
1957  memset(buffer, '#', sizeof(buffer));
1958  buffer[sizeof(buffer)-1] = 0;
1959 
1960  len = sizeof(buffer);
1961  res = pRtlIpv6AddressToStringExA(NULL, 0, 0, buffer, &len);
1962  ok(res == STATUS_INVALID_PARAMETER, "[null ip] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
1963 
1964  len = sizeof(buffer);
1965  res = pRtlIpv6AddressToStringExA(&ip, 0, 0, NULL, &len);
1966  ok(res == STATUS_INVALID_PARAMETER, "[null buffer] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
1967 
1968  res = pRtlIpv6AddressToStringExA(&ip, 0, 0, buffer, NULL);
1969  ok(res == STATUS_INVALID_PARAMETER, "[null length] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
1970 
1971  len = 2;
1972  memset(buffer, '#', sizeof(buffer));
1973  buffer[sizeof(buffer)-1] = 0;
1974  res = pRtlIpv6AddressToStringExA(&ip, 0, 0, buffer, &len);
1975  ok(res == STATUS_INVALID_PARAMETER, "[null length] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
1976  ok(buffer[0] == '#', "got first char %c (expected '#')\n", buffer[0]);
1977  ok(len == 3, "got len %d (expected len 3)\n", len);
1978 
1979  for (i = 0; i < testcount; i++)
1980  {
1981  init_ip6(&ip, tests[i].ip);
1982  len = sizeof(buffer);
1983  memset(buffer, '#', sizeof(buffer));
1984  buffer[sizeof(buffer)-1] = 0;
1985 
1986  res = pRtlIpv6AddressToStringExA(&ip, tests[i].scopeid, tests[i].port, buffer, &len);
1987 
1988  ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res);
1989  ok(len == (strlen(tests[i].address) + 1) && !strcmp(buffer, tests[i].address),
1990  "got len %d with '%s' (expected %d with '%s')\n", len, buffer, (int)strlen(tests[i].address), tests[i].address);
1991  }
1992 }
struct param_test tests[]
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
GLuint buffer
Definition: glext.h:5915
NTSTATUS res
Definition: rtl.c:1174
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
PCSTR address
Definition: rtl.c:1173
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
GLuint address
Definition: glext.h:9393
GLenum GLsizei len
Definition: glext.h:6722
static void init_ip6(IN6_ADDR *addr, const int src[8])
Definition: rtl.c:1739
unsigned short USHORT
Definition: pedump.c:61
#define skip(...)
Definition: CString.cpp:57
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const char * PCSTR
Definition: typedefs.h:51
return STATUS_SUCCESS
Definition: btrfs.c:2725
USHORT port
Definition: uri.c:227
#define memset(x, y, z)
Definition: compat.h:39

Referenced by START_TEST().

◆ test_RtlIpv6StringToAddress()

static void test_RtlIpv6StringToAddress ( void  )
static

Definition at line 2034 of file rtl.c.

2035 {
2036  NTSTATUS res;
2037  IN6_ADDR ip, expected_ip;
2038  PCSTR terminator;
2039  unsigned int i;
2040 
2041  if (!pRtlIpv6StringToAddressW)
2042  {
2043  skip("RtlIpv6StringToAddressW not available\n");
2044  /* we can continue, just not test W */
2045  }
2046 
2047  if (!pRtlIpv6StringToAddressA)
2048  {
2049  skip("RtlIpv6StringToAddressA not available\n");
2050  return; /* all tests are centered around A, we cannot continue */
2051  }
2052 
2053  res = pRtlIpv6StringToAddressA("::", &terminator, &ip);
2054  ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res);
2055  if (0)
2056  {
2057  /* any of these crash */
2058  res = pRtlIpv6StringToAddressA(NULL, &terminator, &ip);
2059  ok(res == STATUS_INVALID_PARAMETER, "[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
2060  res = pRtlIpv6StringToAddressA("::", NULL, &ip);
2061  ok(res == STATUS_INVALID_PARAMETER, "[null terminator] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
2062  res = pRtlIpv6StringToAddressA("::", &terminator, NULL);
2063  ok(res == STATUS_INVALID_PARAMETER, "[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res);
2064  }
2065 
2066  /* sanity check */
2067  ok(sizeof(ip) == sizeof(USHORT)* 8, "sizeof(ip)\n");
2068 
2069  for (i = 0; i < ipv6_testcount; i++)
2070  {
2071  init_ip6(&ip, NULL);
2072  terminator = (void *)0xdeadbeef;
2073  res = pRtlIpv6StringToAddressA(ipv6_tests[i].address, &terminator, &ip);
2074  compare_RtlIpv6StringToAddressW(ipv6_tests[i].address, (terminator != (void *)0xdeadbeef) ?
2075  (terminator - ipv6_tests[i].address) : -1, &ip, res);
2076 
2077  if (ipv6_tests[i].flags & win_broken_6)
2078  {
2080  "[%s] res = 0x%08x, expected 0x%08x\n",
2082 
2084  continue;
2085  }
2086  else
2087  {
2088  ok(res == ipv6_tests[i].res,
2089  "[%s] res = 0x%08x, expected 0x%08x\n",
2091  }
2092 
2093  if (ipv6_tests[i].terminator_offset < 0)
2094  {
2095  ok(terminator == (void *)0xdeadbeef,
2096  "[%s] terminator = %p, expected it not to change\n",
2097  ipv6_tests[i].address, terminator);
2098  }
2099  else if (ipv6_tests[i].flags & win_broken_6)
2100  {
2101  PCSTR expected = ipv6_tests[i].address + ipv6_tests[i].terminator_offset;
2102  ok(terminator == expected || broken(terminator == expected + 2),
2103  "[%s] terminator = %p, expected %p\n",
2104  ipv6_tests[i].address, terminator, expected);
2105  }
2106  else
2107  {
2108  ok(terminator == ipv6_tests[i].address + ipv6_tests[i].terminator_offset,
2109  "[%s] terminator = %p, expected %p\n",
2111  }
2112 
2113  init_ip6(&expected_ip, ipv6_tests[i].ip);
2114  ok(!memcmp(&ip, &expected_ip, sizeof(ip)),
2115  "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n",
2116  ipv6_tests[i].address,
2117  ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3],
2118  ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7],
2119  expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3],
2120  expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]);
2121  }
2122 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const struct @1610 ipv6_tests[]
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS res
Definition: rtl.c:1174
static void compare_RtlIpv6StringToAddressW(PCSTR name_a, int terminator_offset_a, const struct in6_addr *addr_a, NTSTATUS res_a)
Definition: rtl.c:1994
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int ip[4]
Definition: rtl.c:1176
smooth NULL
Definition: ftsmooth.c:416
int terminator_offset
Definition: rtl.c:1175
#define ok(value,...)
Definition: CComObject.cpp:34
Definition: dhcpd.h:61
GLuint address
Definition: glext.h:9393
GLbitfield flags
Definition: glext.h:7161
static void init_ip6(IN6_ADDR *addr, const int src[8])
Definition: rtl.c:1739
const unsigned int ipv6_testcount
Definition: rtl.c:1737
#define broken(x)
Definition: _sntprintf.h:21
unsigned short USHORT
Definition: pedump.c:61
#define skip(...)
Definition: CString.cpp:57
GLuint res
Definition: glext.h:9613
const char * PCSTR
Definition: typedefs.h:51
return STATUS_SUCCESS
Definition: btrfs.c:2725
BOOL expected
Definition: store.c:2063

Referenced by START_TEST().

◆ test_RtlIpv6StringToAddressEx()

static void test_RtlIpv6StringToAddressEx ( void  )
static

Definition at line 2153 of file rtl.c.

2154 {
2155  NTSTATUS res;
2156  IN6_ADDR ip, expected_ip;
2157  ULONG scope;
2158  USHORT port;
2159  static const struct
2160  {
2161  PCSTR address;
2162  NTSTATUS res;
2163  ULONG scope;
2164  USHORT port;
2165  int ip[8];
2166  } ipv6_ex_tests[] =
2167  {
2168  { "[::]", STATUS_SUCCESS, 0, 0,
2169  { 0, 0, 0, 0, 0, 0, 0, 0 } },
2170  { "[::1]:8080", STATUS_SUCCESS, 0, 0x901f,
2171  { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2172  { "[::1]:0x80", STATUS_SUCCESS, 0, 0x8000,
2173  { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2174  { "[::1]:0X80", STATUS_SUCCESS, 0, 0x8000,
2175  { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2176  { "[::1]:080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef,
2177  { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2178  { "[::1]:800000000080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef,
2179  { 0, 0, 0, 0, 0, 0, 0, 0x100 } },
2180  { "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80", STATUS_SUCCESS, 0, 0x5000,
2181  { 0xdcfe, 0x98ba, 0x5476, 0x1032, 0xdcfe, 0x98ba, 0x5476, 0x1032 } },
2182  { "[1080:0:0:0:8:800:200C:417A]:1234", STATUS_SUCCESS, 0, 0xd204,
2183  { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } },
2184  { "[3ffe:2a00:100:7031::1]:8080",