ReactOS 0.4.15-dev-5875-g7c755d9
rtlstr.c File Reference
#include <stdlib.h>
#include "ntdll_test.h"
#include "winnls.h"
#include "guiddef.h"
Include dependency graph for rtlstr.c:

Go to the source code of this file.

Classes

struct  dupl_ustr_t
 
struct  ustr2astr_t
 
struct  app_asc2str_t
 
struct  app_str2str_t
 
struct  app_uni2str_t
 
struct  app_ustr2str_t
 
struct  find_ch_in_ustr_t
 
struct  str2int_t
 
struct  int2str_t
 
struct  hash_unicodestring_test
 
struct  unicode_to_utf8_test
 
struct  utf8_to_unicode_test
 

Macros

#define INITGUID
 
#define HASH_STRING_ALGORITHM_X65599   1
 
#define HASH_STRING_ALGORITHM_INVALID   0xffffffff
 
#define STRINGW   {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}
 
#define TESTSTRING2_LEN   1000000
 
#define NB_DUPL_USTR   (sizeof(dupl_ustr)/sizeof(*dupl_ustr))
 
#define NB_USTR2ASTR   (sizeof(ustr2astr)/sizeof(*ustr2astr))
 
#define NB_APP_ASC2STR   (sizeof(app_asc2str)/sizeof(*app_asc2str))
 
#define NB_APP_STR2STR   (sizeof(app_str2str)/sizeof(*app_str2str))
 
#define NB_APP_UNI2STR   (sizeof(app_uni2str)/sizeof(*app_uni2str))
 
#define NB_APP_USTR2STR   (sizeof(app_ustr2str)/sizeof(*app_ustr2str))
 
#define NB_FIND_CH_IN_USTR   (sizeof(find_ch_in_ustr)/sizeof(*find_ch_in_ustr))
 
#define NB_STR2INT   (sizeof(str2int)/sizeof(*str2int))
 
#define STRI_BUFFER_LENGTH   35
 
#define NB_INT2STR   (sizeof(int2str)/sizeof(*int2str))
 
#define utf8_expect(out_string, buflen, out_bytes, in_string, in_bytes, expect_status)    utf8_expect_(out_string, buflen, out_bytes, in_string, in_bytes, expect_status, __LINE__)
 
#define length_expect(in_chars, out_bytes, expect_status)
 
#define truncate_expect(buflen, out_bytes, expect_status)
 
#define unicode_expect(out_string, buflen, out_chars, in_string, in_chars, expect_status)    unicode_expect_(out_string, buflen, out_chars, in_string, in_chars, expect_status, __LINE__)
 
#define length_expect(in_chars, out_chars, expect_status)
 
#define truncate_expect(buflen, out_chars, expect_status)
 

Functions

static NTSTATUS (WINAPI *pRtlAnsiStringToUnicodeString)(PUNICODE_STRING
 
static int *static LONG (WINAPI *pRtlCompareUnicodeString)(const UNICODE_STRING *
 
static VOID (WINAPI *pRtlCopyString)(STRING *
 
static const STRING *static BOOLEAN (WINAPI *pRtlCreateUnicodeString)(PUNICODE_STRING
 
static int *static WCHAR (WINAPI *pRtlUpcaseUnicodeChar)(WCHAR)
 
static CHAR (WINAPI *pRtlUpperChar)(CHAR)
 
static WCHARAtoW (const char *p)
 
static void InitFunctionPtrs (void)
 
static void test_RtlInitString (void)
 
static void test_RtlInitUnicodeString (void)
 
static void test_RtlInitUnicodeStringEx (void)
 
static void test_RtlDuplicateUnicodeString (void)
 
static void test_RtlCopyString (void)
 
static void test_RtlUpperChar (void)
 
static void test_RtlUpperString (void)
 
static void test_RtlUpcaseUnicodeChar (void)
 
static void test_RtlUpcaseUnicodeString (void)
 
static void test_RtlDowncaseUnicodeString (void)
 
static void test_RtlUnicodeStringToAnsiString (void)
 
static void test_RtlAppendAsciizToString (void)
 
static void test_RtlAppendStringToString (void)
 
static void test_RtlAppendUnicodeToString (void)
 
static void test_RtlAppendUnicodeStringToString (void)
 
static void test_RtlFindCharInUnicodeString (void)
 
static void test_RtlUnicodeStringToInteger (void)
 
static void test_RtlCharToInteger (void)
 
static void one_RtlIntegerToUnicodeString_test (int test_num, const int2str_t *int2str)
 
static void test_RtlIntegerToUnicodeString (void)
 
static void one_RtlIntegerToChar_test (int test_num, const int2str_t *int2str)
 
static void test_RtlIntegerToChar (void)
 
static void test_RtlIsTextUnicode (void)
 
static void test_RtlCompareUnicodeString (void)
 
 DEFINE_GUID (IID_Endianness, 0x01020304, 0x0506, 0x0708, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x0A)
 
static void test_RtlGUIDFromString (void)
 
static void test_RtlStringFromGUID (void)
 
static void test_RtlHashUnicodeString (void)
 
static void utf8_expect_ (const unsigned char *out_string, ULONG buflen, ULONG out_bytes, const WCHAR *in_string, ULONG in_bytes, NTSTATUS expect_status, int line)
 
static void test_RtlUnicodeToUTF8N (void)
 
static void unicode_expect_ (const WCHAR *out_string, ULONG buflen, ULONG out_chars, const char *in_string, ULONG in_chars, NTSTATUS expect_status, int line)
 
static void test_RtlUTF8ToUnicodeN (void)
 
 START_TEST (rtlstr)
 

Variables

static HMODULE hntdll = 0
 
static PCANSI_STRING
 
static BOOLEAN
 
static LPCSTR
 
static const STRING *static const UNICODE_STRING *static LPCWSTR
 
static ULONG
 
static SIZE_T
 
static PCHAR
 
static UNICODE_STRING *static LONG
 
static int
 
static const STRING *static UNICODE_STRING *static GUID *static UNICODE_STRING *static INT
 
static const dupl_ustr_t dupl_ustr []
 
static const ustr2astr_t ustr2astr []
 
static const app_asc2str_t app_asc2str []
 
static const app_str2str_t app_str2str []
 
static const app_uni2str_t app_uni2str []
 
static const app_ustr2str_t app_ustr2str []
 
static const find_ch_in_ustr_t find_ch_in_ustr []
 
static const str2int_t str2int []
 
static const int2str_t int2str []
 
static const WCHAR szGuid []
 
static const WCHAR szGuid2 []
 
static const struct hash_unicodestring_test hash_test []
 
static const struct unicode_to_utf8_test unicode_to_utf8 []
 
static const struct utf8_to_unicode_test utf8_to_unicode []
 

Macro Definition Documentation

◆ HASH_STRING_ALGORITHM_INVALID

#define HASH_STRING_ALGORITHM_INVALID   0xffffffff

Definition at line 34 of file rtlstr.c.

◆ HASH_STRING_ALGORITHM_X65599

#define HASH_STRING_ALGORITHM_X65599   1

Definition at line 33 of file rtlstr.c.

◆ INITGUID

#define INITGUID

Definition at line 27 of file rtlstr.c.

◆ length_expect [1/2]

#define length_expect (   in_chars,
  out_bytes,
  expect_status 
)
Value:
utf8_expect_(NULL, 0, out_bytes, \
special_string, in_chars * sizeof(WCHAR), \
expect_status, __LINE__)
#define NULL
Definition: types.h:112
static void utf8_expect_(const unsigned char *out_string, ULONG buflen, ULONG out_bytes, const WCHAR *in_string, ULONG in_bytes, NTSTATUS expect_status, int line)
Definition: rtlstr.c:2050
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ length_expect [2/2]

#define length_expect (   in_chars,
  out_chars,
  expect_status 
)
Value:
unicode_expect_(NULL, 0, out_chars, special_string, in_chars, \
expect_status, __LINE__)
static void unicode_expect_(const WCHAR *out_string, ULONG buflen, ULONG out_chars, const char *in_string, ULONG in_chars, NTSTATUS expect_status, int line)
Definition: rtlstr.c:2352

◆ NB_APP_ASC2STR

#define NB_APP_ASC2STR   (sizeof(app_asc2str)/sizeof(*app_asc2str))

Definition at line 855 of file rtlstr.c.

◆ NB_APP_STR2STR

#define NB_APP_STR2STR   (sizeof(app_str2str)/sizeof(*app_str2str))

Definition at line 925 of file rtlstr.c.

◆ NB_APP_UNI2STR

#define NB_APP_UNI2STR   (sizeof(app_uni2str)/sizeof(*app_uni2str))

Definition at line 1008 of file rtlstr.c.

◆ NB_APP_USTR2STR

#define NB_APP_USTR2STR   (sizeof(app_ustr2str)/sizeof(*app_ustr2str))

Definition at line 1082 of file rtlstr.c.

◆ NB_DUPL_USTR

#define NB_DUPL_USTR   (sizeof(dupl_ustr)/sizeof(*dupl_ustr))

Definition at line 409 of file rtlstr.c.

◆ NB_FIND_CH_IN_USTR

#define NB_FIND_CH_IN_USTR   (sizeof(find_ch_in_ustr)/sizeof(*find_ch_in_ustr))

Definition at line 1192 of file rtlstr.c.

◆ NB_INT2STR

#define NB_INT2STR   (sizeof(int2str)/sizeof(*int2str))

Definition at line 1603 of file rtlstr.c.

◆ NB_STR2INT

#define NB_STR2INT   (sizeof(str2int)/sizeof(*str2int))

Definition at line 1374 of file rtlstr.c.

◆ NB_USTR2ASTR

#define NB_USTR2ASTR   (sizeof(ustr2astr)/sizeof(*ustr2astr))

Definition at line 779 of file rtlstr.c.

◆ STRI_BUFFER_LENGTH

#define STRI_BUFFER_LENGTH   35

Definition at line 1487 of file rtlstr.c.

◆ STRINGW

#define STRINGW   {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}

◆ TESTSTRING2_LEN

#define TESTSTRING2_LEN   1000000

Definition at line 195 of file rtlstr.c.

◆ truncate_expect [1/2]

#define truncate_expect (   buflen,
  out_bytes,
  expect_status 
)
Value:
utf8_expect_(special_expected, buflen, out_bytes, \
special_string, sizeof(special_string), \
expect_status, __LINE__)

◆ truncate_expect [2/2]

#define truncate_expect (   buflen,
  out_chars,
  expect_status 
)
Value:
unicode_expect_(special_expected, buflen, out_chars, \
special_string, sizeof(special_string), \
expect_status, __LINE__)

◆ unicode_expect

#define unicode_expect (   out_string,
  buflen,
  out_chars,
  in_string,
  in_chars,
  expect_status 
)     unicode_expect_(out_string, buflen, out_chars, in_string, in_chars, expect_status, __LINE__)

Definition at line 2383 of file rtlstr.c.

◆ utf8_expect

#define utf8_expect (   out_string,
  buflen,
  out_bytes,
  in_string,
  in_bytes,
  expect_status 
)     utf8_expect_(out_string, buflen, out_bytes, in_string, in_bytes, expect_status, __LINE__)

Definition at line 2081 of file rtlstr.c.

Function Documentation

◆ AtoW()

static WCHAR * AtoW ( const char p)
static

Definition at line 95 of file rtlstr.c.

96{
98 DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 );
99 buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR) );
101 return buffer;
102}
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722

Referenced by test_RtlUnicodeStringToInteger().

◆ BOOLEAN()

static const STRING *static BOOLEAN ( WINAPI pRtlCreateUnicodeString)
static

◆ CHAR()

static CHAR ( WINAPI pRtlUpperChar)
static

◆ DEFINE_GUID()

DEFINE_GUID ( IID_Endianness  ,
0x01020304  ,
0x0506  ,
0x0708  ,
0x09  ,
0x0A  ,
0x0B  ,
0x0C  ,
0x0D  ,
0x0E  ,
0x0F  ,
0x0A   
)

◆ InitFunctionPtrs()

static void InitFunctionPtrs ( void  )
static

Definition at line 105 of file rtlstr.c.

106{
107 hntdll = LoadLibraryA("ntdll.dll");
108 ok(hntdll != 0, "LoadLibrary failed\n");
109 if (hntdll) {
110 pRtlAnsiStringToUnicodeString = (void *)GetProcAddress(hntdll, "RtlAnsiStringToUnicodeString");
111 pRtlAppendAsciizToString = (void *)GetProcAddress(hntdll, "RtlAppendAsciizToString");
112 pRtlAppendStringToString = (void *)GetProcAddress(hntdll, "RtlAppendStringToString");
113 pRtlAppendUnicodeStringToString = (void *)GetProcAddress(hntdll, "RtlAppendUnicodeStringToString");
114 pRtlAppendUnicodeToString = (void *)GetProcAddress(hntdll, "RtlAppendUnicodeToString");
115 pRtlCharToInteger = (void *)GetProcAddress(hntdll, "RtlCharToInteger");
116 pRtlCompareUnicodeString = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeString");
117 pRtlCompareUnicodeStrings = (void *)GetProcAddress(hntdll, "RtlCompareUnicodeStrings");
118 pRtlCopyString = (void *)GetProcAddress(hntdll, "RtlCopyString");
119 pRtlCreateUnicodeString = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeString");
120 pRtlCreateUnicodeStringFromAsciiz = (void *)GetProcAddress(hntdll, "RtlCreateUnicodeStringFromAsciiz");
121 pRtlDowncaseUnicodeString = (void *)GetProcAddress(hntdll, "RtlDowncaseUnicodeString");
122 pRtlDuplicateUnicodeString = (void *)GetProcAddress(hntdll, "RtlDuplicateUnicodeString");
123 pRtlEqualUnicodeString = (void *)GetProcAddress(hntdll, "RtlEqualUnicodeString");
124 pRtlFindCharInUnicodeString = (void *)GetProcAddress(hntdll, "RtlFindCharInUnicodeString");
125 pRtlFreeAnsiString = (void *)GetProcAddress(hntdll, "RtlFreeAnsiString");
126 pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
127 pRtlInitAnsiString = (void *)GetProcAddress(hntdll, "RtlInitAnsiString");
128 pRtlInitString = (void *)GetProcAddress(hntdll, "RtlInitString");
129 pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
130 pRtlInitUnicodeStringEx = (void *)GetProcAddress(hntdll, "RtlInitUnicodeStringEx");
131 pRtlIntegerToChar = (void *)GetProcAddress(hntdll, "RtlIntegerToChar");
132 pRtlIntegerToUnicodeString = (void *)GetProcAddress(hntdll, "RtlIntegerToUnicodeString");
133 pRtlMultiAppendUnicodeStringBuffer = (void *)GetProcAddress(hntdll, "RtlMultiAppendUnicodeStringBuffer");
134 pRtlUnicodeStringToAnsiString = (void *)GetProcAddress(hntdll, "RtlUnicodeStringToAnsiString");
135 pRtlUnicodeStringToInteger = (void *)GetProcAddress(hntdll, "RtlUnicodeStringToInteger");
136 pRtlUpcaseUnicodeChar = (void *)GetProcAddress(hntdll, "RtlUpcaseUnicodeChar");
137 pRtlUpcaseUnicodeString = (void *)GetProcAddress(hntdll, "RtlUpcaseUnicodeString");
138 pRtlUpperChar = (void *)GetProcAddress(hntdll, "RtlUpperChar");
139 pRtlUpperString = (void *)GetProcAddress(hntdll, "RtlUpperString");
140 pRtlValidateUnicodeString = (void *)GetProcAddress(hntdll, "RtlValidateUnicodeString");
141 pRtlGUIDFromString = (void *)GetProcAddress(hntdll, "RtlGUIDFromString");
142 pRtlStringFromGUID = (void *)GetProcAddress(hntdll, "RtlStringFromGUID");
143 pRtlIsTextUnicode = (void *)GetProcAddress(hntdll, "RtlIsTextUnicode");
144 pRtlHashUnicodeString = (void*)GetProcAddress(hntdll, "RtlHashUnicodeString");
145 pRtlUnicodeToUTF8N = (void*)GetProcAddress(hntdll, "RtlUnicodeToUTF8N");
146 pRtlUTF8ToUnicodeN = (void*)GetProcAddress(hntdll, "RtlUTF8ToUnicodeN");
147 }
148}
#define ok(value,...)
Definition: atltest.h:57
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
static HMODULE hntdll
Definition: rtlstr.c:37

Referenced by START_TEST().

◆ LONG()

static int *static LONG ( WINAPI pRtlCompareUnicodeString) const
static

◆ NTSTATUS()

static NTSTATUS ( WINAPI pRtlAnsiStringToUnicodeString)
static

◆ one_RtlIntegerToChar_test()

static void one_RtlIntegerToChar_test ( int  test_num,
const int2str_t int2str 
)
static

Definition at line 1681 of file rtlstr.c.

1682{
1684 char dest_str[STRI_BUFFER_LENGTH + 1];
1685
1686 memset(dest_str, '-', STRI_BUFFER_LENGTH);
1687 dest_str[STRI_BUFFER_LENGTH] = '\0';
1688 result = pRtlIntegerToChar(int2str->value, int2str->base, int2str->MaximumLength, dest_str);
1689 ok(result == int2str->result,
1690 "(test %d): RtlIntegerToChar(%u, %d, %d, [out]) has result %x, expected: %x\n",
1692 ok(memcmp(dest_str, int2str->Buffer, STRI_BUFFER_LENGTH) == 0,
1693 "(test %d): RtlIntegerToChar(%u, %d, %d, [out]) assigns string \"%s\", expected: \"%s\"\n",
1694 test_num, int2str->value, int2str->base, int2str->MaximumLength, dest_str, int2str->Buffer);
1695}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
LONG NTSTATUS
Definition: precomp.h:26
GLuint64EXT * result
Definition: glext.h:11304
static const int2str_t int2str[]
Definition: rtlstr.c:1498
#define STRI_BUFFER_LENGTH
Definition: rtlstr.c:1487
#define memset(x, y, z)
Definition: compat.h:39
USHORT MaximumLength
Definition: rtlstr.c:1493
const char * Buffer
Definition: rtlstr.c:1494
ULONG value
Definition: rtlstr.c:1491
int base
Definition: rtlstr.c:1490
NTSTATUS result
Definition: rtlstr.c:1495

Referenced by test_RtlIntegerToChar().

◆ one_RtlIntegerToUnicodeString_test()

static void one_RtlIntegerToUnicodeString_test ( int  test_num,
const int2str_t int2str 
)
static

Definition at line 1606 of file rtlstr.c.

1607{
1608 int pos;
1609 WCHAR expected_str_Buffer[STRI_BUFFER_LENGTH + 1];
1610 UNICODE_STRING expected_unicode_string;
1611 STRING expected_ansi_str;
1612 WCHAR str_Buffer[STRI_BUFFER_LENGTH + 1];
1613 UNICODE_STRING unicode_string;
1614 STRING ansi_str;
1616
1617 for (pos = 0; pos < STRI_BUFFER_LENGTH; pos++) {
1618 expected_str_Buffer[pos] = int2str->Buffer[pos];
1619 }
1620 expected_unicode_string.Length = int2str->Length * sizeof(WCHAR);
1621 expected_unicode_string.MaximumLength = int2str->MaximumLength * sizeof(WCHAR);
1622 expected_unicode_string.Buffer = expected_str_Buffer;
1623 pRtlUnicodeStringToAnsiString(&expected_ansi_str, &expected_unicode_string, 1);
1624
1625 for (pos = 0; pos < STRI_BUFFER_LENGTH; pos++) {
1626 str_Buffer[pos] = '-';
1627 }
1628 unicode_string.Length = 0;
1629 unicode_string.MaximumLength = int2str->MaximumLength * sizeof(WCHAR);
1630 unicode_string.Buffer = str_Buffer;
1631
1632 result = pRtlIntegerToUnicodeString(int2str->value, int2str->base, &unicode_string);
1633 pRtlUnicodeStringToAnsiString(&ansi_str, &unicode_string, 1);
1635 /* On BUFFER_OVERFLOW the string Buffer should be unchanged */
1636 for (pos = 0; pos < STRI_BUFFER_LENGTH; pos++) {
1637 expected_str_Buffer[pos] = '-';
1638 }
1639 /* w2k: The native function has two reasons for BUFFER_OVERFLOW: */
1640 /* If the value is too large to convert: The Length is unchanged */
1641 /* If str is too small to hold the string: Set str->Length to the length */
1642 /* the string would have (which can be larger than the MaximumLength). */
1643 /* To allow all this in the tests we do the following: */
1644 if (expected_unicode_string.Length > 32 && unicode_string.Length == 0) {
1645 /* The value is too large to convert only triggered when testing native */
1646 expected_unicode_string.Length = 0;
1647 }
1648 } else {
1649 ok(result == int2str->result,
1650 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) has result %x, expected: %x\n",
1651 test_num, int2str->value, int2str->base, result, int2str->result);
1652 if (result == STATUS_SUCCESS) {
1653 ok(unicode_string.Buffer[unicode_string.Length/sizeof(WCHAR)] == '\0',
1654 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string \"%s\" is not NULL terminated\n",
1655 test_num, int2str->value, int2str->base, ansi_str.Buffer);
1656 }
1657 }
1658 ok(memcmp(unicode_string.Buffer, expected_unicode_string.Buffer, STRI_BUFFER_LENGTH * sizeof(WCHAR)) == 0,
1659 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) assigns string \"%s\", expected: \"%s\"\n",
1660 test_num, int2str->value, int2str->base, ansi_str.Buffer, expected_ansi_str.Buffer);
1661 ok(unicode_string.Length == expected_unicode_string.Length,
1662 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has Length %d, expected: %d\n",
1663 test_num, int2str->value, int2str->base, unicode_string.Length, expected_unicode_string.Length);
1664 ok(unicode_string.MaximumLength == expected_unicode_string.MaximumLength,
1665 "(test %d): RtlIntegerToUnicodeString(%u, %d, [out]) string has MaximumLength %d, expected: %d\n",
1666 test_num, int2str->value, int2str->base, unicode_string.MaximumLength, expected_unicode_string.MaximumLength);
1667 pRtlFreeAnsiString(&expected_ansi_str);
1668 pRtlFreeAnsiString(&ansi_str);
1669}
std::wstring STRING
Definition: fontsub.cpp:33
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
USHORT MaximumLength
Definition: env_spec_w32.h:370
USHORT Length
Definition: rtlstr.c:1492

Referenced by test_RtlIntegerToUnicodeString().

◆ START_TEST()

START_TEST ( rtlstr  )

Definition at line 2532 of file rtlstr.c.

2533{
2535 if (pRtlInitAnsiString) {
2550 }
2551
2559 if(0)
2560 {
2564 }
2568}
static void test_RtlIntegerToUnicodeString(void)
Definition: rtlstr.c:1672
static void test_RtlIntegerToChar(void)
Definition: rtlstr.c:1698
static void test_RtlDowncaseUnicodeString(void)
Definition: rtlstr.c:659
static void test_RtlUnicodeStringToAnsiString(void)
Definition: rtlstr.c:782
static void test_RtlUpcaseUnicodeString(void)
Definition: rtlstr.c:608
static void test_RtlCopyString(void)
Definition: rtlstr.c:504
static void test_RtlUpcaseUnicodeChar(void)
Definition: rtlstr.c:582
static void test_RtlHashUnicodeString(void)
Definition: rtlstr.c:1965
static void test_RtlAppendUnicodeStringToString(void)
Definition: rtlstr.c:1085
static void test_RtlIsTextUnicode(void)
Definition: rtlstr.c:1727
static void test_RtlInitString(void)
Definition: rtlstr.c:150
static void test_RtlGUIDFromString(void)
Definition: rtlstr.c:1901
static void test_RtlAppendStringToString(void)
Definition: rtlstr.c:928
static void test_RtlUpperString(void)
Definition: rtlstr.c:540
static void test_RtlUnicodeStringToInteger(void)
Definition: rtlstr.c:1377
static void test_RtlDuplicateUnicodeString(void)
Definition: rtlstr.c:412
static void test_RtlAppendAsciizToString(void)
Definition: rtlstr.c:858
static void test_RtlUnicodeToUTF8N(void)
Definition: rtlstr.c:2084
static void InitFunctionPtrs(void)
Definition: rtlstr.c:105
static void test_RtlAppendUnicodeToString(void)
Definition: rtlstr.c:1011
static void test_RtlInitUnicodeStringEx(void)
Definition: rtlstr.c:199
static void test_RtlCompareUnicodeString(void)
Definition: rtlstr.c:1862
static void test_RtlStringFromGUID(void)
Definition: rtlstr.c:1927
static void test_RtlUpperChar(void)
Definition: rtlstr.c:518
static void test_RtlFindCharInUnicodeString(void)
Definition: rtlstr.c:1195
static void test_RtlInitUnicodeString(void)
Definition: rtlstr.c:171
static void test_RtlCharToInteger(void)
Definition: rtlstr.c:1448
static void test_RtlUTF8ToUnicodeN(void)
Definition: rtlstr.c:2386

◆ test_RtlAppendAsciizToString()

static void test_RtlAppendAsciizToString ( void  )
static

Definition at line 858 of file rtlstr.c.

859{
860 CHAR dest_buf[257];
861 STRING dest_str;
863 unsigned int test_num;
864
865 for (test_num = 0; test_num < NB_APP_ASC2STR; test_num++) {
866 dest_str.Length = app_asc2str[test_num].dest_Length;
867 dest_str.MaximumLength = app_asc2str[test_num].dest_MaximumLength;
868 if (app_asc2str[test_num].dest_buf != NULL) {
869 memcpy(dest_buf, app_asc2str[test_num].dest_buf, app_asc2str[test_num].dest_buf_size);
870 dest_buf[app_asc2str[test_num].dest_buf_size] = '\0';
871 dest_str.Buffer = dest_buf;
872 } else {
873 dest_str.Buffer = NULL;
874 }
875 result = pRtlAppendAsciizToString(&dest_str, app_asc2str[test_num].src);
876 ok(result == app_asc2str[test_num].result,
877 "(test %d): RtlAppendAsciizToString(dest, src) has result %x, expected %x\n",
878 test_num, result, app_asc2str[test_num].result);
879 ok(dest_str.Length == app_asc2str[test_num].res_Length,
880 "(test %d): RtlAppendAsciizToString(dest, src) dest has Length %d, expected %d\n",
881 test_num, dest_str.Length, app_asc2str[test_num].res_Length);
882 ok(dest_str.MaximumLength == app_asc2str[test_num].res_MaximumLength,
883 "(test %d): RtlAppendAsciizToString(dest, src) dest has MaximumLength %d, expected %d\n",
884 test_num, dest_str.MaximumLength, app_asc2str[test_num].res_MaximumLength);
885 if (dest_str.Buffer == dest_buf) {
886 ok(memcmp(dest_buf, app_asc2str[test_num].res_buf, app_asc2str[test_num].res_buf_size) == 0,
887 "(test %d): RtlAppendAsciizToString(dest, src) has dest \"%s\" expected \"%s\"\n",
888 test_num, dest_buf, app_asc2str[test_num].res_buf);
889 } else {
890 ok(dest_str.Buffer == app_asc2str[test_num].res_buf,
891 "(test %d): RtlAppendAsciizToString(dest, src) dest has Buffer %p expected %p\n",
892 test_num, dest_str.Buffer, app_asc2str[test_num].res_buf);
893 }
894 }
895}
GLenum src
Definition: glext.h:6340
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const app_asc2str_t app_asc2str[]
Definition: rtlstr.c:844
#define NB_APP_ASC2STR
Definition: rtlstr.c:855
int dest_MaximumLength
Definition: rtlstr.c:833
int dest_Length
Definition: rtlstr.c:832
int res_Length
Definition: rtlstr.c:837
int dest_buf_size
Definition: rtlstr.c:834
const char * res_buf
Definition: rtlstr.c:840
int res_MaximumLength
Definition: rtlstr.c:838
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().

◆ test_RtlAppendStringToString()

static void test_RtlAppendStringToString ( void  )
static

Definition at line 928 of file rtlstr.c.

929{
930 CHAR dest_buf[257];
931 CHAR src_buf[257];
932 STRING dest_str;
933 STRING src_str;
935 unsigned int test_num;
936
937 for (test_num = 0; test_num < NB_APP_STR2STR; test_num++) {
938 dest_str.Length = app_str2str[test_num].dest_Length;
939 dest_str.MaximumLength = app_str2str[test_num].dest_MaximumLength;
940 if (app_str2str[test_num].dest_buf != NULL) {
941 memcpy(dest_buf, app_str2str[test_num].dest_buf, app_str2str[test_num].dest_buf_size);
942 dest_buf[app_str2str[test_num].dest_buf_size] = '\0';
943 dest_str.Buffer = dest_buf;
944 } else {
945 dest_str.Buffer = NULL;
946 }
947 src_str.Length = app_str2str[test_num].src_Length;
948 src_str.MaximumLength = app_str2str[test_num].src_MaximumLength;
949 if (app_str2str[test_num].src_buf != NULL) {
950 memcpy(src_buf, app_str2str[test_num].src_buf, app_str2str[test_num].src_buf_size);
951 src_buf[app_str2str[test_num].src_buf_size] = '\0';
952 src_str.Buffer = src_buf;
953 } else {
954 src_str.Buffer = NULL;
955 }
956 result = pRtlAppendStringToString(&dest_str, &src_str);
957 ok(result == app_str2str[test_num].result,
958 "(test %d): RtlAppendStringToString(dest, src) has result %x, expected %x\n",
959 test_num, result, app_str2str[test_num].result);
960 ok(dest_str.Length == app_str2str[test_num].res_Length,
961 "(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d\n",
962 test_num, dest_str.Length, app_str2str[test_num].res_Length);
963 ok(dest_str.MaximumLength == app_str2str[test_num].res_MaximumLength,
964 "(test %d): RtlAppendStringToString(dest, src) dest has MaximumLength %d, expected %d\n",
965 test_num, dest_str.MaximumLength, app_str2str[test_num].res_MaximumLength);
966 if (dest_str.Buffer == dest_buf) {
967 ok(memcmp(dest_buf, app_str2str[test_num].res_buf, app_str2str[test_num].res_buf_size) == 0,
968 "(test %d): RtlAppendStringToString(dest, src) has dest \"%s\" expected \"%s\"\n",
969 test_num, dest_buf, app_str2str[test_num].res_buf);
970 } else {
971 ok(dest_str.Buffer == app_str2str[test_num].res_buf,
972 "(test %d): RtlAppendStringToString(dest, src) dest has Buffer %p expected %p\n",
973 test_num, dest_str.Buffer, app_str2str[test_num].res_buf);
974 }
975 }
976}
static const app_str2str_t app_str2str[]
Definition: rtlstr.c:914
#define NB_APP_STR2STR
Definition: rtlstr.c:925
int dest_buf_size
Definition: rtlstr.c:901
const char * res_buf
Definition: rtlstr.c:910
int src_MaximumLength
Definition: rtlstr.c:904
int src_Length
Definition: rtlstr.c:903
int src_buf_size
Definition: rtlstr.c:905
int dest_MaximumLength
Definition: rtlstr.c:900
int res_Length
Definition: rtlstr.c:907
int res_MaximumLength
Definition: rtlstr.c:908
int dest_Length
Definition: rtlstr.c:899

Referenced by START_TEST().

◆ test_RtlAppendUnicodeStringToString()

static void test_RtlAppendUnicodeStringToString ( void  )
static

Definition at line 1085 of file rtlstr.c.

1086{
1087 WCHAR dest_buf[257];
1088 WCHAR src_buf[257];
1089 UNICODE_STRING dest_str;
1090 UNICODE_STRING src_str;
1092 unsigned int test_num;
1093
1094 for (test_num = 0; test_num < NB_APP_USTR2STR; test_num++) {
1095 dest_str.Length = app_ustr2str[test_num].dest_Length;
1096 dest_str.MaximumLength = app_ustr2str[test_num].dest_MaximumLength;
1097 if (app_ustr2str[test_num].dest_buf != NULL) {
1098 memcpy(dest_buf, app_ustr2str[test_num].dest_buf, app_ustr2str[test_num].dest_buf_size);
1099 dest_buf[app_ustr2str[test_num].dest_buf_size/sizeof(WCHAR)] = '\0';
1100 dest_str.Buffer = dest_buf;
1101 } else {
1102 dest_str.Buffer = NULL;
1103 }
1104 src_str.Length = app_ustr2str[test_num].src_Length;
1105 src_str.MaximumLength = app_ustr2str[test_num].src_MaximumLength;
1106 if (app_ustr2str[test_num].src_buf != NULL) {
1107 memcpy(src_buf, app_ustr2str[test_num].src_buf, app_ustr2str[test_num].src_buf_size);
1108 src_buf[app_ustr2str[test_num].src_buf_size/sizeof(WCHAR)] = '\0';
1109 src_str.Buffer = src_buf;
1110 } else {
1111 src_str.Buffer = NULL;
1112 }
1113 result = pRtlAppendUnicodeStringToString(&dest_str, &src_str);
1114 ok(result == app_ustr2str[test_num].result,
1115 "(test %d): RtlAppendStringToString(dest, src) has result %x, expected %x\n",
1116 test_num, result, app_ustr2str[test_num].result);
1117 ok(dest_str.Length == app_ustr2str[test_num].res_Length,
1118 "(test %d): RtlAppendStringToString(dest, src) dest has Length %d, expected %d\n",
1119 test_num, dest_str.Length, app_ustr2str[test_num].res_Length);
1120 ok(dest_str.MaximumLength == app_ustr2str[test_num].res_MaximumLength,
1121 "(test %d): RtlAppendStringToString(dest, src) dest has MaximumLength %d, expected %d\n",
1122 test_num, dest_str.MaximumLength, app_ustr2str[test_num].res_MaximumLength);
1123 if (dest_str.Buffer == dest_buf) {
1124 ok(memcmp(dest_buf, app_ustr2str[test_num].res_buf, app_ustr2str[test_num].res_buf_size) == 0,
1125 "(test %d): RtlAppendStringToString(dest, src) has dest \"%s\" expected \"%s\"\n",
1126 test_num, (char *) dest_buf, app_ustr2str[test_num].res_buf);
1127 } else {
1128 ok(dest_str.Buffer == (WCHAR *) app_ustr2str[test_num].res_buf,
1129 "(test %d): RtlAppendStringToString(dest, src) dest has Buffer %p expected %p\n",
1130 test_num, dest_str.Buffer, app_ustr2str[test_num].res_buf);
1131 }
1132 }
1133}
static const app_ustr2str_t app_ustr2str[]
Definition: rtlstr.c:1067
#define NB_APP_USTR2STR
Definition: rtlstr.c:1082
int dest_MaximumLength
Definition: rtlstr.c:1053
int dest_Length
Definition: rtlstr.c:1052
const char * res_buf
Definition: rtlstr.c:1063
int res_Length
Definition: rtlstr.c:1060
int src_MaximumLength
Definition: rtlstr.c:1057
int res_MaximumLength
Definition: rtlstr.c:1061
int src_Length
Definition: rtlstr.c:1056
int dest_buf_size
Definition: rtlstr.c:1054
int src_buf_size
Definition: rtlstr.c:1058

Referenced by START_TEST().

◆ test_RtlAppendUnicodeToString()

static void test_RtlAppendUnicodeToString ( void  )
static

Definition at line 1011 of file rtlstr.c.

1012{
1013 WCHAR dest_buf[257];
1014 UNICODE_STRING dest_str;
1016 unsigned int test_num;
1017
1018 for (test_num = 0; test_num < NB_APP_UNI2STR; test_num++) {
1019 dest_str.Length = app_uni2str[test_num].dest_Length;
1020 dest_str.MaximumLength = app_uni2str[test_num].dest_MaximumLength;
1021 if (app_uni2str[test_num].dest_buf != NULL) {
1022 memcpy(dest_buf, app_uni2str[test_num].dest_buf, app_uni2str[test_num].dest_buf_size);
1023 dest_buf[app_uni2str[test_num].dest_buf_size/sizeof(WCHAR)] = '\0';
1024 dest_str.Buffer = dest_buf;
1025 } else {
1026 dest_str.Buffer = NULL;
1027 }
1028 result = pRtlAppendUnicodeToString(&dest_str, (LPCWSTR) app_uni2str[test_num].src);
1029 ok(result == app_uni2str[test_num].result,
1030 "(test %d): RtlAppendUnicodeToString(dest, src) has result %x, expected %x\n",
1031 test_num, result, app_uni2str[test_num].result);
1032 ok(dest_str.Length == app_uni2str[test_num].res_Length,
1033 "(test %d): RtlAppendUnicodeToString(dest, src) dest has Length %d, expected %d\n",
1034 test_num, dest_str.Length, app_uni2str[test_num].res_Length);
1035 ok(dest_str.MaximumLength == app_uni2str[test_num].res_MaximumLength,
1036 "(test %d): RtlAppendUnicodeToString(dest, src) dest has MaximumLength %d, expected %d\n",
1037 test_num, dest_str.MaximumLength, app_uni2str[test_num].res_MaximumLength);
1038 if (dest_str.Buffer == dest_buf) {
1039 ok(memcmp(dest_buf, app_uni2str[test_num].res_buf, app_uni2str[test_num].res_buf_size) == 0,
1040 "(test %d): RtlAppendUnicodeToString(dest, src) has dest \"%s\" expected \"%s\"\n",
1041 test_num, (char *) dest_buf, app_uni2str[test_num].res_buf);
1042 } else {
1043 ok(dest_str.Buffer == (WCHAR *) app_uni2str[test_num].res_buf,
1044 "(test %d): RtlAppendUnicodeToString(dest, src) dest has Buffer %p expected %p\n",
1045 test_num, dest_str.Buffer, app_uni2str[test_num].res_buf);
1046 }
1047 }
1048}
#define NB_APP_UNI2STR
Definition: rtlstr.c:1008
static const app_uni2str_t app_uni2str[]
Definition: rtlstr.c:992
const char * res_buf
Definition: rtlstr.c:988
int dest_buf_size
Definition: rtlstr.c:982
int res_MaximumLength
Definition: rtlstr.c:986
int dest_MaximumLength
Definition: rtlstr.c:981
int res_Length
Definition: rtlstr.c:985
int dest_Length
Definition: rtlstr.c:980
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by START_TEST().

◆ test_RtlCharToInteger()

static void test_RtlCharToInteger ( void  )
static

Definition at line 1448 of file rtlstr.c.

1449{
1450 unsigned int test_num;
1451 int value;
1453
1454 for (test_num = 0; test_num < NB_STR2INT; test_num++) {
1455 /* w2k skips a leading '\0' and processes the string after */
1456 if (str2int[test_num].str[0] != '\0') {
1457 value = 0xdeadbeef;
1458 result = pRtlCharToInteger(str2int[test_num].str, str2int[test_num].base, &value);
1459 ok(result == str2int[test_num].result ||
1460 (str2int[test_num].alternative && result == str2int[test_num].alternative),
1461 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
1462 test_num, str2int[test_num].str, str2int[test_num].base, result,
1463 str2int[test_num].result, str2int[test_num].alternative);
1464 if (result == STATUS_SUCCESS)
1465 ok(value == str2int[test_num].value,
1466 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
1467 test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
1468 else
1469 ok(value == 0 || value == 0xdeadbeef,
1470 "(test %d): call failed: RtlCharToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
1471 test_num, str2int[test_num].str, str2int[test_num].base, value);
1472 }
1473 }
1474
1475 result = pRtlCharToInteger(str2int[1].str, str2int[1].base, NULL);
1477 "call failed: RtlCharToInteger(\"%s\", %d, NULL) has result %x\n",
1478 str2int[1].str, str2int[1].base, result);
1479
1480 result = pRtlCharToInteger(str2int[1].str, 20, NULL);
1482 "call failed: RtlCharToInteger(\"%s\", 20, NULL) has result %x\n",
1483 str2int[1].str, result);
1484}
#define NB_STR2INT
Definition: rtlstr.c:1374
static const str2int_t str2int[]
Definition: rtlstr.c:1260
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
const WCHAR * str
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: pdh_main.c:94

Referenced by START_TEST().

◆ test_RtlCompareUnicodeString()

static void test_RtlCompareUnicodeString ( void  )
static

Definition at line 1862 of file rtlstr.c.

1863{
1864 WCHAR ch1, ch2;
1865 UNICODE_STRING str1, str2;
1866
1867 str1.Buffer = &ch1;
1868 str1.Length = str1.MaximumLength = sizeof(WCHAR);
1869 str2.Buffer = &ch2;
1870 str2.Length = str2.MaximumLength = sizeof(WCHAR);
1871 for (ch1 = 0; ch1 < 512; ch1++)
1872 {
1873 for (ch2 = 0; ch2 < 1024; ch2++)
1874 {
1875 LONG res = pRtlCompareUnicodeString( &str1, &str2, FALSE );
1876 ok( res == (ch1 - ch2), "wrong result %d %04x %04x\n", res, ch1, ch2 );
1877 res = pRtlCompareUnicodeString( &str1, &str2, TRUE );
1878 ok( res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)),
1879 "wrong result %d %04x %04x\n", res, ch1, ch2 );
1880 if (pRtlCompareUnicodeStrings)
1881 {
1882 res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1, FALSE );
1883 ok( res == (ch1 - ch2), "wrong result %d %04x %04x\n", res, ch1, ch2 );
1884 res = pRtlCompareUnicodeStrings( &ch1, 1, &ch2, 1, TRUE );
1885 ok( res == (pRtlUpcaseUnicodeChar(ch1) - pRtlUpcaseUnicodeChar(ch2)),
1886 "wrong result %d %04x %04x\n", res, ch1, ch2 );
1887 }
1888 }
1889 }
1890}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLuint res
Definition: glext.h:9613
long LONG
Definition: pedump.c:60

Referenced by START_TEST().

◆ test_RtlCopyString()

static void test_RtlCopyString ( void  )
static

Definition at line 504 of file rtlstr.c.

505{
506 static const char teststring[] = "Some Wild String";
507 char deststring[] = " ";
508 STRING str;
509 STRING deststr;
510
511 pRtlInitString(&str, teststring);
512 pRtlInitString(&deststr, deststring);
513 pRtlCopyString(&deststr, &str);
514 ok(strncmp(str.Buffer, deststring, str.Length) == 0, "String not copied\n");
515}
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534

Referenced by START_TEST().

◆ test_RtlDowncaseUnicodeString()

static void test_RtlDowncaseUnicodeString ( void  )
static

Definition at line 659 of file rtlstr.c.

660{
661 int i;
662 WCHAR ch;
663 WCHAR lower_ch;
664 WCHAR source_buf[1025];
665 WCHAR result_buf[1025];
666 WCHAR lower_buf[1025];
667 UNICODE_STRING source_str;
668 UNICODE_STRING result_str;
669 UNICODE_STRING lower_str;
670
671 for (i = 0; i < 1024; i++) {
672 ch = (WCHAR) i;
673 if (ch >= 'A' && ch <= 'Z') {
674 lower_ch = ch - 'A' + 'a';
675 } else if (ch >= 0xc0 && ch <= 0xde && ch != 0xd7) {
676 lower_ch = ch + 0x20;
677 } else if (ch >= 0x391 && ch <= 0x3ab && ch != 0x3a2) {
678 lower_ch = ch + 0x20;
679 } else {
680 switch (ch) {
681 case 0x178: lower_ch = 0xff; break;
682 case 0x181: lower_ch = 0x253; break;
683 case 0x186: lower_ch = 0x254; break;
684 case 0x189: lower_ch = 0x256; break;
685 case 0x18a: lower_ch = 0x257; break;
686 case 0x18e: lower_ch = 0x1dd; break;
687 case 0x18f: lower_ch = 0x259; break;
688 case 0x190: lower_ch = 0x25b; break;
689 case 0x193: lower_ch = 0x260; break;
690 case 0x194: lower_ch = 0x263; break;
691 case 0x196: lower_ch = 0x269; break;
692 case 0x197: lower_ch = 0x268; break;
693 case 0x19c: lower_ch = 0x26f; break;
694 case 0x19d: lower_ch = 0x272; break;
695 case 0x19f: lower_ch = 0x275; break;
696 case 0x1a9: lower_ch = 0x283; break;
697 case 0x1ae: lower_ch = 0x288; break;
698 case 0x1b1: lower_ch = 0x28a; break;
699 case 0x1b2: lower_ch = 0x28b; break;
700 case 0x1b7: lower_ch = 0x292; break;
701 case 0x1c4: lower_ch = 0x1c6; break;
702 case 0x1c7: lower_ch = 0x1c9; break;
703 case 0x1ca: lower_ch = 0x1cc; break;
704 case 0x1f1: lower_ch = 0x1f3; break;
705 case 0x386: lower_ch = 0x3ac; break;
706 case 0x388: lower_ch = 0x3ad; break;
707 case 0x389: lower_ch = 0x3ae; break;
708 case 0x38a: lower_ch = 0x3af; break;
709 case 0x38c: lower_ch = 0x3cc; break;
710 case 0x38e: lower_ch = 0x3cd; break;
711 case 0x38f: lower_ch = 0x3ce; break;
712 default: lower_ch = ch; break;
713 } /* switch */
714 }
715 source_buf[i] = ch;
716 result_buf[i] = '\0';
717 lower_buf[i] = lower_ch;
718 }
719 source_buf[i] = '\0';
720 result_buf[i] = '\0';
721 lower_buf[i] = '\0';
722 source_str.Length = 2048;
723 source_str.MaximumLength = 2048;
724 source_str.Buffer = source_buf;
725 result_str.Length = 2048;
726 result_str.MaximumLength = 2048;
727 result_str.Buffer = result_buf;
728 lower_str.Length = 2048;
729 lower_str.MaximumLength = 2048;
730 lower_str.Buffer = lower_buf;
731
732 pRtlDowncaseUnicodeString(&result_str, &source_str, 0);
733 for (i = 0; i <= 1024; i++) {
734 ok(result_str.Buffer[i] == lower_str.Buffer[i] || result_str.Buffer[i] == source_str.Buffer[i] + 1,
735 "RtlDowncaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]\n",
736 source_str.Buffer[i], source_str.Buffer[i],
737 result_str.Buffer[i], result_str.Buffer[i],
738 lower_str.Buffer[i], lower_str.Buffer[i]);
739 }
740}
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

Referenced by START_TEST().

◆ test_RtlDuplicateUnicodeString()

static void test_RtlDuplicateUnicodeString ( void  )
static

Definition at line 412 of file rtlstr.c.

413{
414 size_t pos;
415 WCHAR source_buf[257];
416 WCHAR dest_buf[257];
417 WCHAR res_buf[257];
418 UNICODE_STRING source_str;
419 UNICODE_STRING dest_str;
420 UNICODE_STRING res_str;
421 CHAR dest_ansi_buf[257];
422 STRING dest_ansi_str;
424 unsigned int test_num;
425
426 if (!pRtlDuplicateUnicodeString)
427 {
428 win_skip("RtlDuplicateUnicodeString is not available\n");
429 return;
430 }
431
432 for (test_num = 0; test_num < NB_DUPL_USTR; test_num++) {
433 source_str.Length = dupl_ustr[test_num].source_Length;
434 source_str.MaximumLength = dupl_ustr[test_num].source_MaximumLength;
435 if (dupl_ustr[test_num].source_buf != NULL) {
436 for (pos = 0; pos < dupl_ustr[test_num].source_buf_size/sizeof(WCHAR); pos++) {
437 source_buf[pos] = dupl_ustr[test_num].source_buf[pos];
438 }
439 source_str.Buffer = source_buf;
440 } else {
441 source_str.Buffer = NULL;
442 }
443 dest_str.Length = dupl_ustr[test_num].dest_Length;
444 dest_str.MaximumLength = dupl_ustr[test_num].dest_MaximumLength;
445 if (dupl_ustr[test_num].dest_buf != NULL) {
446 for (pos = 0; pos < dupl_ustr[test_num].dest_buf_size/sizeof(WCHAR); pos++) {
447 dest_buf[pos] = dupl_ustr[test_num].dest_buf[pos];
448 }
449 dest_str.Buffer = dest_buf;
450 } else {
451 dest_str.Buffer = NULL;
452 }
453 res_str.Length = dupl_ustr[test_num].res_Length;
454 res_str.MaximumLength = dupl_ustr[test_num].res_MaximumLength;
455 if (dupl_ustr[test_num].res_buf != NULL) {
456 for (pos = 0; pos < dupl_ustr[test_num].res_buf_size/sizeof(WCHAR); pos++) {
457 res_buf[pos] = dupl_ustr[test_num].res_buf[pos];
458 }
459 res_str.Buffer = res_buf;
460 } else {
461 res_str.Buffer = NULL;
462 }
463 result = pRtlDuplicateUnicodeString(dupl_ustr[test_num].add_nul, &source_str, &dest_str);
464 dest_ansi_str.Length = dest_str.Length / sizeof(WCHAR);
465 dest_ansi_str.MaximumLength = dest_ansi_str.Length + 1;
466 for (pos = 0; pos < dest_ansi_str.Length; pos++) {
467 dest_ansi_buf[pos] = (char)dest_buf[pos];
468 }
469 dest_ansi_buf[dest_ansi_str.Length] = '\0';
470 dest_ansi_str.Buffer = dest_ansi_buf;
471 ok(result == dupl_ustr[test_num].result,
472 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has result %x, expected %x\n",
473 test_num, dupl_ustr[test_num].add_nul, result, dupl_ustr[test_num].result);
474 ok(dest_str.Length == dupl_ustr[test_num].res_Length,
475 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination has Length %d, expected %d\n",
476 test_num, dupl_ustr[test_num].add_nul, dest_str.Length, dupl_ustr[test_num].res_Length);
477 ok(dest_str.MaximumLength == dupl_ustr[test_num].res_MaximumLength,
478 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination has MaximumLength %d, expected %d\n",
479 test_num, dupl_ustr[test_num].add_nul, dest_str.MaximumLength, dupl_ustr[test_num].res_MaximumLength);
481 ok((dest_str.Buffer == NULL && res_str.Buffer == NULL) ||
482 dest_str.Buffer == dest_buf,
483 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) destination buffer changed %p expected %p\n",
484 test_num, dupl_ustr[test_num].add_nul, dest_str.Buffer, dest_buf);
485 } else {
486 ok(dest_str.Buffer != dest_buf,
487 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination buffer unchanged %p\n",
488 test_num, dupl_ustr[test_num].add_nul, dest_str.Buffer);
489 }
490 if (dest_str.Buffer != NULL && dupl_ustr[test_num].res_buf != NULL) {
491 ok(memcmp(dest_str.Buffer, res_str.Buffer, dupl_ustr[test_num].res_buf_size) == 0,
492 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination \"%s\" expected \"%s\"\n",
493 test_num, dupl_ustr[test_num].add_nul, dest_ansi_str.Buffer, dupl_ustr[test_num].res_buf);
494 if(result == STATUS_SUCCESS) pRtlFreeUnicodeString(&dest_str);
495 } else {
496 ok(dest_str.Buffer == NULL && dupl_ustr[test_num].res_buf == NULL,
497 "(test %d): RtlDuplicateUnicodeString(%d, source, dest) has destination %p expected %p\n",
498 test_num, dupl_ustr[test_num].add_nul, dest_str.Buffer, dupl_ustr[test_num].res_buf);
499 }
500 }
501}
unsigned char
Definition: typeof.h:29
#define NB_DUPL_USTR
Definition: rtlstr.c:409
static const dupl_ustr_t dupl_ustr[]
Definition: rtlstr.c:335
#define win_skip
Definition: test.h:160
const char * source_buf
Definition: rtlstr.c:323
int source_buf_size
Definition: rtlstr.c:322
const char * dest_buf
Definition: rtlstr.c:327
int dest_MaximumLength
Definition: rtlstr.c:325
int res_MaximumLength
Definition: rtlstr.c:329
int dest_Length
Definition: rtlstr.c:324
int res_Length
Definition: rtlstr.c:328
const char * res_buf
Definition: rtlstr.c:331
int source_MaximumLength
Definition: rtlstr.c:321
int add_nul
Definition: rtlstr.c:319
int dest_buf_size
Definition: rtlstr.c:326
int source_Length
Definition: rtlstr.c:320
int res_buf_size
Definition: rtlstr.c:330

Referenced by START_TEST().

◆ test_RtlFindCharInUnicodeString()

static void test_RtlFindCharInUnicodeString ( void  )
static

Definition at line 1195 of file rtlstr.c.

1196{
1197 WCHAR main_str_buf[257];
1198 WCHAR search_chars_buf[257];
1199 UNICODE_STRING main_str;
1200 UNICODE_STRING search_chars;
1201 USHORT pos;
1203 unsigned int idx;
1204 unsigned int test_num;
1205
1206 if (!pRtlFindCharInUnicodeString)
1207 {
1208 win_skip("RtlFindCharInUnicodeString is not available\n");
1209 return;
1210 }
1211
1212 for (test_num = 0; test_num < NB_FIND_CH_IN_USTR; test_num++) {
1213 if (find_ch_in_ustr[test_num].main_str != NULL) {
1214 main_str.Length = strlen(find_ch_in_ustr[test_num].main_str) * sizeof(WCHAR);
1215 main_str.MaximumLength = main_str.Length + sizeof(WCHAR);
1216 for (idx = 0; idx < main_str.Length / sizeof(WCHAR); idx++) {
1217 main_str_buf[idx] = find_ch_in_ustr[test_num].main_str[idx];
1218 }
1219 main_str.Buffer = main_str_buf;
1220 } else {
1221 main_str.Length = 0;
1222 main_str.MaximumLength = 0;
1223 main_str.Buffer = NULL;
1224 }
1225 if (find_ch_in_ustr[test_num].search_chars != NULL) {
1226 search_chars.Length = strlen(find_ch_in_ustr[test_num].search_chars) * sizeof(WCHAR);
1227 search_chars.MaximumLength = search_chars.Length + sizeof(WCHAR);
1228 for (idx = 0; idx < search_chars.Length / sizeof(WCHAR); idx++) {
1229 search_chars_buf[idx] = find_ch_in_ustr[test_num].search_chars[idx];
1230 }
1231 search_chars.Buffer = search_chars_buf;
1232 } else {
1233 search_chars.Length = 0;
1234 search_chars.MaximumLength = 0;
1235 search_chars.Buffer = NULL;
1236 }
1237 pos = 12345;
1238 result = pRtlFindCharInUnicodeString(find_ch_in_ustr[test_num].flags, &main_str, &search_chars, &pos);
1239 ok(result == find_ch_in_ustr[test_num].result,
1240 "(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) has result %x, expected %x\n",
1241 test_num, find_ch_in_ustr[test_num].flags,
1242 find_ch_in_ustr[test_num].main_str, find_ch_in_ustr[test_num].search_chars,
1243 result, find_ch_in_ustr[test_num].result);
1244 ok(pos == find_ch_in_ustr[test_num].pos,
1245 "(test %d): RtlFindCharInUnicodeString(%d, %s, %s, [out]) assigns %d to pos, expected %d\n",
1246 test_num, find_ch_in_ustr[test_num].flags,
1247 find_ch_in_ustr[test_num].main_str, find_ch_in_ustr[test_num].search_chars,
1248 pos, find_ch_in_ustr[test_num].pos);
1249 }
1250}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned int idx
Definition: utils.c:41
GLbitfield flags
Definition: glext.h:7161
#define NB_FIND_CH_IN_USTR
Definition: rtlstr.c:1192
static const find_ch_in_ustr_t find_ch_in_ustr[]
Definition: rtlstr.c:1144
unsigned short USHORT
Definition: pedump.c:61
const char * search_chars
Definition: rtlstr.c:1139
const char * main_str
Definition: rtlstr.c:1138

Referenced by START_TEST().

◆ test_RtlGUIDFromString()

static void test_RtlGUIDFromString ( void  )
static

Definition at line 1901 of file rtlstr.c.

1902{
1903 GUID guid;
1905 NTSTATUS ret;
1906
1907 if (!pRtlGUIDFromString)
1908 {
1909 win_skip("RtlGUIDFromString is not available\n");
1910 return;
1911 }
1912
1913 str.Length = str.MaximumLength = sizeof(szGuid) - sizeof(WCHAR);
1914 str.Buffer = (LPWSTR)szGuid;
1915
1916 ret = pRtlGUIDFromString(&str, &guid);
1917 ok(ret == 0, "expected ret=0, got 0x%0x\n", ret);
1918 ok(IsEqualGUID(&guid, &IID_Endianness), "Endianness broken\n");
1919
1920 str.Length = str.MaximumLength = sizeof(szGuid2) - sizeof(WCHAR);
1921 str.Buffer = (LPWSTR)szGuid2;
1922
1923 ret = pRtlGUIDFromString(&str, &guid);
1924 ok(ret, "expected ret!=0\n");
1925}
const GUID * guid
static const WCHAR szGuid[]
Definition: rtlstr.c:1892
static const WCHAR szGuid2[]
Definition: rtlstr.c:1895
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
int ret
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by START_TEST().

◆ test_RtlHashUnicodeString()

static void test_RtlHashUnicodeString ( void  )
static

Definition at line 1965 of file rtlstr.c.

1966{
1967 static const WCHAR strW[] = {'T','e','s','t',0,'1',0};
1968 const struct hash_unicodestring_test *ptr;
1971 ULONG hash;
1972
1973 if (!pRtlHashUnicodeString)
1974 {
1975 win_skip("RtlHashUnicodeString is not available\n");
1976 return;
1977 }
1978
1979 status = pRtlHashUnicodeString(NULL, FALSE, HASH_STRING_ALGORITHM_X65599, &hash);
1980 ok(status == STATUS_INVALID_PARAMETER, "got status 0x%08x\n", status);
1981
1983 status = pRtlHashUnicodeString(&str, FALSE, HASH_STRING_ALGORITHM_X65599, NULL);
1984 ok(status == STATUS_INVALID_PARAMETER, "got status 0x%08x\n", status);
1985
1986 status = pRtlHashUnicodeString(&str, FALSE, HASH_STRING_ALGORITHM_INVALID, &hash);
1987 ok(status == STATUS_INVALID_PARAMETER, "got status 0x%08x\n", status);
1988
1989 /* embedded null */
1990 str.Buffer = (PWSTR)strW;
1991 str.Length = sizeof(strW) - sizeof(WCHAR);
1992 str.MaximumLength = sizeof(strW);
1993 status = pRtlHashUnicodeString(&str, FALSE, HASH_STRING_ALGORITHM_X65599, &hash);
1994 ok(status == STATUS_SUCCESS, "got status 0x%08x\n", status);
1995 ok(hash == 0x32803083, "got 0x%08x\n", hash);
1996
1997 ptr = hash_test;
1998 while (*ptr->str)
1999 {
2001 hash = 0;
2002 status = pRtlHashUnicodeString(&str, ptr->case_insensitive, HASH_STRING_ALGORITHM_X65599, &hash);
2003 ok(status == STATUS_SUCCESS, "got status 0x%08x for %s\n", status, wine_dbgstr_w(ptr->str));
2004 ok(hash == ptr->hash, "got wrong hash 0x%08x, expected 0x%08x, for %s, mode %d\n", hash, ptr->hash,
2005 wine_dbgstr_w(ptr->str), ptr->case_insensitive);
2006
2007 ptr++;
2008 }
2009}
#define wine_dbgstr_w
Definition: kernel32.h:34
static PVOID ptr
Definition: dispmode.c:27
#define HASH_STRING_ALGORITHM_INVALID
Definition: rtlstr.c:34
static const struct hash_unicodestring_test hash_test[]
Definition: rtlstr.c:1953
#define HASH_STRING_ALGORITHM_X65599
Definition: rtlstr.c:33
WCHAR strW[12]
Definition: clipboard.c:2029
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
Definition: _hash_fun.h:40
Definition: ps.c:97
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59

Referenced by START_TEST().

◆ test_RtlInitString()

static void test_RtlInitString ( void  )
static

Definition at line 150 of file rtlstr.c.

151{
152 static const char teststring[] = "Some Wild String";
153 STRING str;
154
155 str.Length = 0;
156 str.MaximumLength = 0;
157 str.Buffer = (void *)0xdeadbeef;
158 pRtlInitString(&str, teststring);
159 ok(str.Length == sizeof(teststring) - sizeof(char), "Length uninitialized\n");
160 ok(str.MaximumLength == sizeof(teststring), "MaximumLength uninitialized\n");
161 ok(str.Buffer == teststring, "Buffer not equal to teststring\n");
162 ok(strcmp(str.Buffer, "Some Wild String") == 0, "Buffer written to\n");
163 pRtlInitString(&str, NULL);
164 ok(str.Length == 0, "Length uninitialized\n");
165 ok(str.MaximumLength == 0, "MaximumLength uninitialized\n");
166 ok(str.Buffer == NULL, "Buffer not equal to NULL\n");
167/* pRtlInitString(NULL, teststring); */
168}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test_RtlInitUnicodeString()

static void test_RtlInitUnicodeString ( void  )
static

Definition at line 171 of file rtlstr.c.

172{
173#define STRINGW {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0}
174 static const WCHAR teststring[] = STRINGW;
175 static const WCHAR originalstring[] = STRINGW;
176#undef STRINGW
177 UNICODE_STRING uni;
178
179 uni.Length = 0;
180 uni.MaximumLength = 0;
181 uni.Buffer = (void *)0xdeadbeef;
182 pRtlInitUnicodeString(&uni, teststring);
183 ok(uni.Length == sizeof(teststring) - sizeof(WCHAR), "Length uninitialized\n");
184 ok(uni.MaximumLength == sizeof(teststring), "MaximumLength uninitialized\n");
185 ok(uni.Buffer == teststring, "Buffer not equal to teststring\n");
186 ok(lstrcmpW(uni.Buffer, originalstring) == 0, "Buffer written to\n");
187 pRtlInitUnicodeString(&uni, NULL);
188 ok(uni.Length == 0, "Length uninitialized\n");
189 ok(uni.MaximumLength == 0, "MaximumLength uninitialized\n");
190 ok(uni.Buffer == NULL, "Buffer not equal to NULL\n");
191/* pRtlInitUnicodeString(NULL, teststring); */
192}
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define STRINGW

Referenced by START_TEST().

◆ test_RtlInitUnicodeStringEx()

static void test_RtlInitUnicodeStringEx ( void  )
static

Definition at line 199 of file rtlstr.c.

200{
201 static const WCHAR teststring[] = {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0};
202 WCHAR *teststring2;
203 UNICODE_STRING uni;
205
206 if (!pRtlInitUnicodeStringEx)
207 {
208 win_skip("RtlInitUnicodeStringEx is not available\n");
209 return;
210 }
211
212 teststring2 = HeapAlloc(GetProcessHeap(), 0, (TESTSTRING2_LEN + 1) * sizeof(WCHAR));
213 memset(teststring2, 'X', TESTSTRING2_LEN * sizeof(WCHAR));
214 teststring2[TESTSTRING2_LEN] = '\0';
215
216 uni.Length = 12345;
217 uni.MaximumLength = 12345;
218 uni.Buffer = (void *) 0xdeadbeef;
219 result = pRtlInitUnicodeStringEx(&uni, teststring);
221 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0\n",
222 result);
223 ok(uni.Length == 32,
224 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
225 uni.Length, 32);
226 ok(uni.MaximumLength == 34,
227 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected %u\n",
228 uni.MaximumLength, 34);
229 ok(uni.Buffer == teststring,
230 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %p\n",
231 uni.Buffer, teststring);
232
233 uni.Length = 12345;
234 uni.MaximumLength = 12345;
235 uni.Buffer = (void *) 0xdeadbeef;
236 pRtlInitUnicodeString(&uni, teststring);
237 ok(uni.Length == 32,
238 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
239 uni.Length, 32);
240 ok(uni.MaximumLength == 34,
241 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
242 uni.MaximumLength, 34);
243 ok(uni.Buffer == teststring,
244 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
245 uni.Buffer, teststring);
246
247 uni.Length = 12345;
248 uni.MaximumLength = 12345;
249 uni.Buffer = (void *) 0xdeadbeef;
250 result = pRtlInitUnicodeStringEx(&uni, teststring2);
252 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected %x\n",
254 ok(uni.Length == 12345 ||
255 uni.Length == 0, /* win2k3 */
256 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected 12345 or 0\n",
257 uni.Length);
258 ok(uni.MaximumLength == 12345 ||
259 uni.MaximumLength == 0, /* win2k3 */
260 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected 12345 or 0\n",
261 uni.MaximumLength);
262 ok(uni.Buffer == (void *) 0xdeadbeef ||
263 uni.Buffer == teststring2, /* win2k3 */
264 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %x or %p\n",
265 uni.Buffer, 0xdeadbeef, teststring2);
266
267 uni.Length = 12345;
268 uni.MaximumLength = 12345;
269 uni.Buffer = (void *) 0xdeadbeef;
270 pRtlInitUnicodeString(&uni, teststring2);
271 ok(uni.Length == 33920 /* <= Win2000 */ || uni.Length == 65532 /* >= Win XP */,
272 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
273 uni.Length, 65532);
274 ok(uni.MaximumLength == 33922 /* <= Win2000 */ || uni.MaximumLength == 65534 /* >= Win XP */,
275 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
276 uni.MaximumLength, 65534);
277 ok(uni.Buffer == teststring2,
278 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
279 uni.Buffer, teststring2);
280 ok(memcmp(uni.Buffer, teststring2, (TESTSTRING2_LEN + 1) * sizeof(WCHAR)) == 0,
281 "pRtlInitUnicodeString(&uni, 0) changes Buffer\n");
282
283 uni.Length = 12345;
284 uni.MaximumLength = 12345;
285 uni.Buffer = (void *) 0xdeadbeef;
286 result = pRtlInitUnicodeStringEx(&uni, 0);
288 "pRtlInitUnicodeStringEx(&uni, 0) returns %x, expected 0\n",
289 result);
290 ok(uni.Length == 0,
291 "pRtlInitUnicodeStringEx(&uni, 0) sets Length to %u, expected %u\n",
292 uni.Length, 0);
293 ok(uni.MaximumLength == 0,
294 "pRtlInitUnicodeStringEx(&uni, 0) sets MaximumLength to %u, expected %u\n",
295 uni.MaximumLength, 0);
296 ok(uni.Buffer == NULL,
297 "pRtlInitUnicodeStringEx(&uni, 0) sets Buffer to %p, expected %p\n",
298 uni.Buffer, NULL);
299
300 uni.Length = 12345;
301 uni.MaximumLength = 12345;
302 uni.Buffer = (void *) 0xdeadbeef;
303 pRtlInitUnicodeString(&uni, 0);
304 ok(uni.Length == 0,
305 "pRtlInitUnicodeString(&uni, 0) sets Length to %u, expected %u\n",
306 uni.Length, 0);
307 ok(uni.MaximumLength == 0,
308 "pRtlInitUnicodeString(&uni, 0) sets MaximumLength to %u, expected %u\n",
309 uni.MaximumLength, 0);
310 ok(uni.Buffer == NULL,
311 "pRtlInitUnicodeString(&uni, 0) sets Buffer to %p, expected %p\n",
312 uni.Buffer, NULL);
313
314 HeapFree(GetProcessHeap(), 0, teststring2);
315}
#define HeapFree(x, y, z)
Definition: compat.h:735
#define TESTSTRING2_LEN
Definition: rtlstr.c:195
#define STATUS_NAME_TOO_LONG
Definition: ntstatus.h:498

Referenced by START_TEST().

◆ test_RtlIntegerToChar()

static void test_RtlIntegerToChar ( void  )
static

Definition at line 1698 of file rtlstr.c.

1699{
1701 size_t test_num;
1702
1703 for (test_num = 0; test_num < NB_INT2STR; test_num++)
1704 one_RtlIntegerToChar_test(test_num, &int2str[test_num]);
1705
1706 result = pRtlIntegerToChar(int2str[0].value, 20, int2str[0].MaximumLength, NULL);
1708 "(test a): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1710
1711 result = pRtlIntegerToChar(int2str[0].value, 20, 0, NULL);
1713 "(test b): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1715
1716 result = pRtlIntegerToChar(int2str[0].value, int2str[0].base, 0, NULL);
1718 "(test c): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1720
1721 result = pRtlIntegerToChar(int2str[0].value, int2str[0].base, int2str[0].MaximumLength, NULL);
1723 "(test d): RtlIntegerToChar(%u, %d, %d, NULL) has result %x, expected: %x\n",
1725}
#define NB_INT2STR
Definition: rtlstr.c:1603
static void one_RtlIntegerToChar_test(int test_num, const int2str_t *int2str)
Definition: rtlstr.c:1681
_In_ WDFDMATRANSACTION _In_ size_t MaximumLength

Referenced by START_TEST().

◆ test_RtlIntegerToUnicodeString()

static void test_RtlIntegerToUnicodeString ( void  )
static

Definition at line 1672 of file rtlstr.c.

1673{
1674 size_t test_num;
1675
1676 for (test_num = 0; test_num < NB_INT2STR; test_num++)
1677 one_RtlIntegerToUnicodeString_test(test_num, &int2str[test_num]);
1678}
static void one_RtlIntegerToUnicodeString_test(int test_num, const int2str_t *int2str)
Definition: rtlstr.c:1606

Referenced by START_TEST().

◆ test_RtlIsTextUnicode()

static void test_RtlIsTextUnicode ( void  )
static

Definition at line 1727 of file rtlstr.c.

1728{
1729 char ascii[] = "A simple string";
1730 char false_positive[] = {0x41, 0x0a, 0x0d, 0x1d};
1731 WCHAR false_negative = 0x0d0a;
1732 WCHAR unicode[] = {'A',' ','U','n','i','c','o','d','e',' ','s','t','r','i','n','g',0};
1733 WCHAR unicode_no_controls[] = {'A','U','n','i','c','o','d','e','s','t','r','i','n','g',0};
1734 /* String with both byte-reversed and standard Unicode control characters. */
1735 WCHAR mixed_controls[] = {'\t',0x9000,0x0d00,'\n',0};
1736 WCHAR *be_unicode;
1737 WCHAR *be_unicode_no_controls;
1738 BOOLEAN res;
1739 int flags;
1740 int i;
1741
1742 if (!pRtlIsTextUnicode)
1743 {
1744 win_skip("RtlIsTextUnicode is not available\n");
1745 return;
1746 }
1747
1748 ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n");
1749
1750 res = pRtlIsTextUnicode(unicode, sizeof(unicode), NULL);
1751 ok(res ||
1752 broken(res == FALSE), /* NT4 */
1753 "Text should be Unicode\n");
1754
1755 ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, NULL), "Text should be Unicode\n");
1756
1758 ok(pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Text should not pass a Unicode\n");
1760 "Expected flags 0x6, obtained %x\n", flags);
1761
1763 ok(!pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Text should not pass reverse Unicode tests\n");
1764 ok(flags == 0, "Expected flags 0, obtained %x\n", flags);
1765
1767 ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, &flags), "Odd length test should have passed\n");
1768 ok(flags == IS_TEXT_UNICODE_ODD_LENGTH, "Expected flags 0x200, obtained %x\n", flags);
1769
1770 be_unicode = HeapAlloc(GetProcessHeap(), 0, sizeof(unicode) + sizeof(WCHAR));
1771 be_unicode[0] = 0xfffe;
1772 for (i = 0; i < sizeof(unicode)/sizeof(unicode[0]); i++)
1773 {
1774 be_unicode[i + 1] = (unicode[i] >> 8) | ((unicode[i] & 0xff) << 8);
1775 }
1776 ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, NULL), "Reverse endian should not be Unicode\n");
1777 ok(!pRtlIsTextUnicode(&be_unicode[1], sizeof(unicode), NULL), "Reverse endian should not be Unicode\n");
1778
1780 ok(!pRtlIsTextUnicode(&be_unicode[1], sizeof(unicode), &flags), "Reverse endian should be Unicode\n");
1781 todo_wine
1783 "Expected flags 0x70, obtained %x\n", flags);
1784
1786 ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, &flags), "Reverse endian should be Unicode\n");
1788 "Expected flags 0xc0, obtained %x\n", flags);
1789
1790 /* build byte reversed unicode string with no control chars */
1791 be_unicode_no_controls = HeapAlloc(GetProcessHeap(), 0, sizeof(unicode) + sizeof(WCHAR));
1792 ok(be_unicode_no_controls != NULL, "Expected HeapAlloc to succeed.\n");
1793 be_unicode_no_controls[0] = 0xfffe;
1794 for (i = 0; i < sizeof(unicode_no_controls)/sizeof(unicode_no_controls[0]); i++)
1795 be_unicode_no_controls[i + 1] = (unicode_no_controls[i] >> 8) | ((unicode_no_controls[i] & 0xff) << 8);
1796
1797
1798 /* The following tests verify that the tests for */
1799 /* IS_TEXT_UNICODE_CONTROLS and IS_TEXT_UNICODE_REVERSE_CONTROLS */
1800 /* are not mutually exclusive. Regardless of whether the strings */
1801 /* contain an indication of endianness, the tests are still */
1802 /* run if the flag is passed to (Rtl)IsTextUnicode. */
1803
1804 /* Test IS_TEXT_UNICODE_CONTROLS flag */
1806 ok(!pRtlIsTextUnicode(unicode_no_controls, sizeof(unicode_no_controls), &flags), "Test should not pass on Unicode string lacking control characters.\n");
1807 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1808
1810 ok(!pRtlIsTextUnicode(be_unicode_no_controls, sizeof(unicode_no_controls), &flags), "Test should not pass on byte-reversed Unicode string lacking control characters.\n");
1811 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1812
1814 ok(pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Test should pass on Unicode string lacking control characters.\n");
1815 ok(flags == IS_TEXT_UNICODE_CONTROLS, "Expected flags 0x04, obtained %x\n", flags);
1816
1818 ok(!pRtlIsTextUnicode(be_unicode_no_controls, sizeof(unicode_no_controls) + 2, &flags),
1819 "Test should not pass with standard Unicode string.\n");
1820 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1821
1823 ok(pRtlIsTextUnicode(mixed_controls, sizeof(mixed_controls), &flags), "Test should pass on a string containing control characters.\n");
1824 ok(flags == IS_TEXT_UNICODE_CONTROLS, "Expected flags 0x04, obtained %x\n", flags);
1825
1826 /* Test IS_TEXT_UNICODE_REVERSE_CONTROLS flag */
1828 ok(!pRtlIsTextUnicode(be_unicode_no_controls, sizeof(unicode_no_controls), &flags), "Test should not pass on Unicode string lacking control characters.\n");
1829 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1830
1832 ok(!pRtlIsTextUnicode(unicode_no_controls, sizeof(unicode_no_controls), &flags), "Test should not pass on Unicode string lacking control characters.\n");
1833 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1834
1836 ok(!pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Test should not pass on Unicode string lacking control characters.\n");
1837 ok(flags == 0, "Expected flags 0x0, obtained %x\n", flags);
1838
1840 ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, &flags),
1841 "Test should pass with byte-reversed Unicode string containing control characters.\n");
1842 ok(flags == IS_TEXT_UNICODE_REVERSE_CONTROLS, "Expected flags 0x40, obtained %x\n", flags);
1843
1845 ok(!pRtlIsTextUnicode(mixed_controls, sizeof(mixed_controls), &flags), "Test should pass on a string containing byte-reversed control characters.\n");
1846 ok(flags == IS_TEXT_UNICODE_REVERSE_CONTROLS, "Expected flags 0x40, obtained %x\n", flags);
1847
1848 /* Test with flags for both byte-reverse and standard Unicode characters */
1850 ok(!pRtlIsTextUnicode(mixed_controls, sizeof(mixed_controls), &flags), "Test should pass on string containing both byte-reversed and standard control characters.\n");
1851 ok(flags == (IS_TEXT_UNICODE_CONTROLS | IS_TEXT_UNICODE_REVERSE_CONTROLS), "Expected flags 0x44, obtained %x\n", flags);
1852
1854 todo_wine ok(pRtlIsTextUnicode(false_positive, sizeof(false_positive), &flags), "Test should pass on false positive.\n");
1855
1856 ok(!pRtlIsTextUnicode(&false_negative, sizeof(false_negative), NULL), "Test should fail on 0x0d0a (MALAYALAM LETTER UU).\n");
1857
1858 HeapFree(GetProcessHeap(), 0, be_unicode);
1859 HeapFree(GetProcessHeap(), 0, be_unicode_no_controls);
1860}
unsigned char BOOLEAN
#define broken(x)
Definition: _sntprintf.h:21
#define todo_wine
Definition: custom.c:79
#define IS_TEXT_UNICODE_UNICODE_MASK
Definition: winnt_old.h:932
#define IS_TEXT_UNICODE_REVERSE_ASCII16
Definition: winnt_old.h:921
#define IS_TEXT_UNICODE_REVERSE_CONTROLS
Definition: winnt_old.h:925
#define IS_TEXT_UNICODE_REVERSE_MASK
Definition: winnt_old.h:933
#define IS_TEXT_UNICODE_CONTROLS
Definition: winnt_old.h:924
#define IS_TEXT_UNICODE_ODD_LENGTH
Definition: winnt_old.h:929
#define IS_TEXT_UNICODE_REVERSE_SIGNATURE
Definition: winnt_old.h:927
#define IS_TEXT_UNICODE_STATISTICS
Definition: winnt_old.h:922
#define IS_TEXT_UNICODE_REVERSE_STATISTICS
Definition: winnt_old.h:923

Referenced by START_TEST().

◆ test_RtlStringFromGUID()

static void test_RtlStringFromGUID ( void  )
static

Definition at line 1927 of file rtlstr.c.

1928{
1930 NTSTATUS ret;
1931
1932 if (!pRtlStringFromGUID)
1933 {
1934 win_skip("RtlStringFromGUID is not available\n");
1935 return;
1936 }
1937
1938 str.Length = str.MaximumLength = 0;
1939 str.Buffer = NULL;
1940
1941 ret = pRtlStringFromGUID(&IID_Endianness, &str);
1942 ok(ret == 0, "expected ret=0, got 0x%0x\n", ret);
1943 ok(str.Buffer && !lstrcmpiW(str.Buffer, szGuid), "Endianness broken\n");
1944 pRtlFreeUnicodeString(&str);
1945}
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194

Referenced by START_TEST().

◆ test_RtlUnicodeStringToAnsiString()

static void test_RtlUnicodeStringToAnsiString ( void  )
static

Definition at line 782 of file rtlstr.c.

783{
784 size_t pos;
785 CHAR ansi_buf[257];
786 WCHAR uni_buf[257];
787 STRING ansi_str;
788 UNICODE_STRING uni_str;
790 unsigned int test_num;
791
792 for (test_num = 0; test_num < NB_USTR2ASTR; test_num++) {
793 ansi_str.Length = ustr2astr[test_num].ansi_Length;
794 ansi_str.MaximumLength = ustr2astr[test_num].ansi_MaximumLength;
795 if (ustr2astr[test_num].ansi_buf != NULL) {
796 memcpy(ansi_buf, ustr2astr[test_num].ansi_buf, ustr2astr[test_num].ansi_buf_size);
797 ansi_buf[ustr2astr[test_num].ansi_buf_size] = '\0';
798 ansi_str.Buffer = ansi_buf;
799 } else {
800 ansi_str.Buffer = NULL;
801 }
802 uni_str.Length = ustr2astr[test_num].uni_Length;
803 uni_str.MaximumLength = ustr2astr[test_num].uni_MaximumLength;
804 if (ustr2astr[test_num].uni_buf != NULL) {
805 for (pos = 0; pos < ustr2astr[test_num].uni_buf_size/sizeof(WCHAR); pos++) {
806 uni_buf[pos] = ustr2astr[test_num].uni_buf[pos];
807 }
808 uni_str.Buffer = uni_buf;
809 } else {
810 uni_str.Buffer = NULL;
811 }
812 result = pRtlUnicodeStringToAnsiString(&ansi_str, &uni_str, ustr2astr[test_num].doalloc);
813 ok(result == ustr2astr[test_num].result,
814 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has result %x, expected %x\n",
815 test_num, ustr2astr[test_num].doalloc, result, ustr2astr[test_num].result);
816 ok(ansi_str.Length == ustr2astr[test_num].res_Length,
817 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) ansi has Length %d, expected %d\n",
818 test_num, ustr2astr[test_num].doalloc, ansi_str.Length, ustr2astr[test_num].res_Length);
819 ok(ansi_str.MaximumLength == ustr2astr[test_num].res_MaximumLength,
820 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) ansi has MaximumLength %d, expected %d\n",
821 test_num, ustr2astr[test_num].doalloc, ansi_str.MaximumLength, ustr2astr[test_num].res_MaximumLength);
822 ok(memcmp(ansi_str.Buffer, ustr2astr[test_num].res_buf, ustr2astr[test_num].res_buf_size) == 0,
823 "(test %d): RtlUnicodeStringToAnsiString(ansi, uni, %d) has ansi \"%s\" expected \"%s\"\n",
824 test_num, ustr2astr[test_num].doalloc, ansi_str.Buffer, ustr2astr[test_num].res_buf);
825 if(result == STATUS_SUCCESS && ustr2astr[test_num].doalloc)
826 pRtlFreeAnsiString(&ansi_str);
827 }
828}
#define NB_USTR2ASTR
Definition: rtlstr.c:779
static const ustr2astr_t ustr2astr[]
Definition: rtlstr.c:760
int ansi_MaximumLength
Definition: rtlstr.c:745
int res_MaximumLength
Definition: rtlstr.c:754
int res_Length
Definition: rtlstr.c:753
int uni_buf_size
Definition: rtlstr.c:750
int uni_Length
Definition: rtlstr.c:748
int ansi_buf_size
Definition: rtlstr.c:746
const char * uni_buf
Definition: rtlstr.c:751
int res_buf_size
Definition: rtlstr.c:755
int ansi_Length
Definition: rtlstr.c:744
BOOLEAN doalloc
Definition: rtlstr.c:752
const char * res_buf
Definition: rtlstr.c:756
int uni_MaximumLength
Definition: rtlstr.c:749

Referenced by START_TEST().

◆ test_RtlUnicodeStringToInteger()

static void test_RtlUnicodeStringToInteger ( void  )
static

Definition at line 1377 of file rtlstr.c.

1378{
1379 unsigned int test_num;
1380 int value;
1382 WCHAR *wstr;
1383 UNICODE_STRING uni;
1384
1385 for (test_num = 0; test_num < NB_STR2INT; test_num++) {
1386 wstr = AtoW(str2int[test_num].str);
1387 value = 0xdeadbeef;
1388 pRtlInitUnicodeString(&uni, wstr);
1389 result = pRtlUnicodeStringToInteger(&uni, str2int[test_num].base, &value);
1390 ok(result == str2int[test_num].result ||
1391 (str2int[test_num].alternative && result == str2int[test_num].alternative),
1392 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) has result %x, expected: %x (%x)\n",
1393 test_num, str2int[test_num].str, str2int[test_num].base, result,
1394 str2int[test_num].result, str2int[test_num].alternative);
1395 if (result == STATUS_SUCCESS)
1396 ok(value == str2int[test_num].value ||
1397 broken(str2int[test_num].str[0] == '\0' && str2int[test_num].base == 16), /* nt4 */
1398 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected: %d\n",
1399 test_num, str2int[test_num].str, str2int[test_num].base, value, str2int[test_num].value);
1400 else
1401 ok(value == 0xdeadbeef || value == 0 /* vista */,
1402 "(test %d): RtlUnicodeStringToInteger(\"%s\", %d, [out]) assigns value %d, expected 0 or deadbeef\n",
1403 test_num, str2int[test_num].str, str2int[test_num].base, value);
1404 HeapFree(GetProcessHeap(), 0, wstr);
1405 }
1406
1407 wstr = AtoW(str2int[1].str);
1408 pRtlInitUnicodeString(&uni, wstr);
1409 result = pRtlUnicodeStringToInteger(&uni, str2int[1].base, NULL);
1411 "call failed: RtlUnicodeStringToInteger(\"%s\", %d, NULL) has result %x\n",
1412 str2int[1].str, str2int[1].base, result);
1413 result = pRtlUnicodeStringToInteger(&uni, 20, NULL);
1415 "call failed: RtlUnicodeStringToInteger(\"%s\", 20, NULL) has result %x\n",
1416 str2int[1].str, result);
1417
1418 uni.Length = 10; /* Make Length shorter (5 WCHARS instead of 7) */
1419 result = pRtlUnicodeStringToInteger(&uni, str2int[1].base, &value);
1421 "call failed: RtlUnicodeStringToInteger(\"12345\", %d, [out]) has result %x\n",
1422 str2int[1].base, result);
1423 ok(value == 12345,
1424 "didn't return expected value (test a): expected: %d, got: %d\n",
1425 12345, value);
1426
1427 uni.Length = 5; /* Use odd Length (2.5 WCHARS) */
1428 result = pRtlUnicodeStringToInteger(&uni, str2int[1].base, &value);
1430 "call failed: RtlUnicodeStringToInteger(\"12\", %d, [out]) has result %x\n",
1431 str2int[1].base, result);
1432 if (result == STATUS_SUCCESS)
1433 ok(value == 12, "didn't return expected value (test b): expected: %d, got: %d\n", 12, value);
1434
1435 uni.Length = 2;
1436 result = pRtlUnicodeStringToInteger(&uni, str2int[1].base, &value);
1438 "call failed: RtlUnicodeStringToInteger(\"1\", %d, [out]) has result %x\n",
1439 str2int[1].base, result);
1440 ok(value == 1,
1441 "didn't return expected value (test c): expected: %d, got: %d\n",
1442 1, value);
1443 /* w2k: uni.Length = 0 returns value 11234567 instead of 0 */
1444 HeapFree(GetProcessHeap(), 0, wstr);
1445}
static WCHAR * AtoW(const char *p)
Definition: rtlstr.c:95

Referenced by START_TEST().

◆ test_RtlUnicodeToUTF8N()

static void test_RtlUnicodeToUTF8N ( void  )
static

Definition at line 2084 of file rtlstr.c.

2085{
2087 ULONG bytes_out;
2088 ULONG bytes_out_array[2];
2089 void * const invalid_pointer = (void *)0x8;
2090 char buffer[128];
2091 const WCHAR empty_string[] = { 0 };
2092 const WCHAR test_string[] = { 'A',0,'a','b','c','d','e','f','g',0 };
2093 const WCHAR special_string[] = { 'X',0x80,0xd800,0 };
2094 const unsigned char special_expected[] = { 'X',0xc2,0x80,0xef,0xbf,0xbd,0 };
2095 unsigned int input_len;
2096 const unsigned int test_count = sizeof(unicode_to_utf8) / sizeof(unicode_to_utf8[0]);
2097 unsigned int i;
2098
2099 if (!pRtlUnicodeToUTF8N)
2100 {
2101 skip("RtlUnicodeToUTF8N unavailable\n");
2102 return;
2103 }
2104
2105 /* show that bytes_out is really ULONG */
2106 memset(bytes_out_array, 0x55, sizeof(bytes_out_array));
2107 status = pRtlUnicodeToUTF8N(NULL, 0, bytes_out_array, empty_string, 0);
2108 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2109 ok(bytes_out_array[0] == 0x00000000, "Got 0x%x\n", bytes_out_array[0]);
2110 ok(bytes_out_array[1] == 0x55555555, "Got 0x%x\n", bytes_out_array[1]);
2111
2112 /* parameter checks */
2113 status = pRtlUnicodeToUTF8N(NULL, 0, NULL, NULL, 0);
2114 ok(status == STATUS_INVALID_PARAMETER_4, "status = 0x%x\n", status);
2115
2116 status = pRtlUnicodeToUTF8N(NULL, 0, NULL, empty_string, 0);
2117 ok(status == STATUS_INVALID_PARAMETER, "status = 0x%x\n", status);
2118
2119 bytes_out = 0x55555555;
2120 status = pRtlUnicodeToUTF8N(NULL, 0, &bytes_out, NULL, 0);
2121 ok(status == STATUS_INVALID_PARAMETER_4, "status = 0x%x\n", status);
2122 ok(bytes_out == 0x55555555, "bytes_out = 0x%x\n", bytes_out);
2123
2124 bytes_out = 0x55555555;
2125 status = pRtlUnicodeToUTF8N(NULL, 0, &bytes_out, invalid_pointer, 0);
2126 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2127 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2128
2129 bytes_out = 0x55555555;
2130 status = pRtlUnicodeToUTF8N(NULL, 0, &bytes_out, empty_string, 0);
2131 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2132 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2133
2134 bytes_out = 0x55555555;
2135 status = pRtlUnicodeToUTF8N(NULL, 0, &bytes_out, test_string, 0);
2136 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2137 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2138
2139 bytes_out = 0x55555555;
2140 status = pRtlUnicodeToUTF8N(NULL, 0, &bytes_out, empty_string, 1);
2141 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2142 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2143
2144 bytes_out = 0x55555555;
2145 status = pRtlUnicodeToUTF8N(invalid_pointer, 0, &bytes_out, empty_string, 1);
2146 ok(status == STATUS_INVALID_PARAMETER_5, "status = 0x%x\n", status);
2147 ok(bytes_out == 0x55555555, "bytes_out = 0x%x\n", bytes_out);
2148
2149 bytes_out = 0x55555555;
2150 status = pRtlUnicodeToUTF8N(invalid_pointer, 8, &bytes_out, empty_string, 1);
2151 ok(status == STATUS_INVALID_PARAMETER_5, "status = 0x%x\n", status);
2152 ok(bytes_out == 0x55555555, "bytes_out = 0x%x\n", bytes_out);
2153
2154 /* length output with special chars */
2155#define length_expect(in_chars, out_bytes, expect_status) \
2156 utf8_expect_(NULL, 0, out_bytes, \
2157 special_string, in_chars * sizeof(WCHAR), \
2158 expect_status, __LINE__)
2159
2165#undef length_expect
2166
2167 /* output truncation */
2168#define truncate_expect(buflen, out_bytes, expect_status) \
2169 utf8_expect_(special_expected, buflen, out_bytes, \
2170 special_string, sizeof(special_string), \
2171 expect_status, __LINE__)
2172
2181#undef truncate_expect
2182
2183 /* conversion behavior with varying input length */
2184 for (input_len = 0; input_len <= sizeof(test_string); input_len++) {
2185 /* no output buffer, just length */
2186 utf8_expect(NULL, 0, input_len / sizeof(WCHAR),
2187 test_string, input_len, STATUS_SUCCESS);
2188
2189 /* write output */
2190 bytes_out = 0x55555555;
2191 memset(buffer, 0x55, sizeof(buffer));
2192 status = pRtlUnicodeToUTF8N(
2193 buffer, sizeof(buffer), &bytes_out,
2194 test_string, input_len);
2195 if (input_len % sizeof(WCHAR) == 0) {
2197 "(len %u): status = 0x%x\n", input_len, status);
2198 ok(bytes_out == input_len / sizeof(WCHAR),
2199 "(len %u): bytes_out = 0x%x\n", input_len, bytes_out);
2200 for (i = 0; i < bytes_out; i++) {
2201 ok(buffer[i] == test_string[i],
2202 "(len %u): buffer[%d] = 0x%x, expected 0x%x\n",
2203 input_len, i, buffer[i], test_string[i]);
2204 }
2205 for (; i < sizeof(buffer); i++) {
2206 ok(buffer[i] == 0x55,
2207 "(len %u): buffer[%d] = 0x%x\n", input_len, i, buffer[i]);
2208 }
2209 } else {
2211 "(len %u): status = 0x%x\n", input_len, status);
2212 ok(bytes_out == 0x55555555,
2213 "(len %u): bytes_out = 0x%x\n", input_len, bytes_out);
2214 for (i = 0; i < sizeof(buffer); i++) {
2215 ok(buffer[i] == 0x55,
2216 "(len %u): buffer[%d] = 0x%x\n", input_len, i, buffer[i]);
2217 }
2218 }
2219 }
2220
2221 /* test cases for special characters */
2222 for (i = 0; i < test_count; i++) {
2223 bytes_out = 0x55555555;
2224 memset(buffer, 0x55, sizeof(buffer));
2225 status = pRtlUnicodeToUTF8N(
2226 buffer, sizeof(buffer), &bytes_out,
2227 unicode_to_utf8[i].unicode, lstrlenW(unicode_to_utf8[i].unicode) * sizeof(WCHAR));
2229 "(test %d): status is 0x%x, expected 0x%x\n",
2231 ok(bytes_out == strlen(unicode_to_utf8[i].expected),
2232 "(test %d): bytes_out is %u, expected %u\n",
2233 i, bytes_out, lstrlenA(unicode_to_utf8[i].expected));
2234 ok(!memcmp(buffer, unicode_to_utf8[i].expected, bytes_out),
2235 "(test %d): got \"%.*s\", expected \"%s\"\n",
2236 i, bytes_out, buffer, unicode_to_utf8[i].expected);
2237 ok(buffer[bytes_out] == 0x55,
2238 "(test %d): behind string: 0x%x\n", i, buffer[bytes_out]);
2239
2240 /* same test but include the null terminator */
2241 bytes_out = 0x55555555;
2242 memset(buffer, 0x55, sizeof(buffer));
2243 status = pRtlUnicodeToUTF8N(
2244 buffer, sizeof(buffer), &bytes_out,
2245 unicode_to_utf8[i].unicode, (lstrlenW(unicode_to_utf8[i].unicode) + 1) * sizeof(WCHAR));
2247 "(test %d): status is 0x%x, expected 0x%x\n",
2249 ok(bytes_out == strlen(unicode_to_utf8[i].expected) + 1,
2250 "(test %d): bytes_out is %u, expected %u\n",
2251 i, bytes_out, lstrlenA(unicode_to_utf8[i].expected) + 1);
2252 ok(!memcmp(buffer, unicode_to_utf8[i].expected, bytes_out),
2253 "(test %d): got \"%.*s\", expected \"%s\"\n",
2254 i, bytes_out, buffer, unicode_to_utf8[i].expected);
2255 ok(buffer[bytes_out] == 0x55,
2256 "(test %d): behind string: 0x%x\n", i, buffer[bytes_out]);
2257 }
2258}
#define skip(...)
Definition: atltest.h:64
#define lstrlenW
Definition: compat.h:750
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
BOOL expected
Definition: store.c:2063
UINT test_count
Definition: shader.c:5671
#define truncate_expect(buflen, out_bytes, expect_status)
static const struct unicode_to_utf8_test unicode_to_utf8[]
Definition: rtlstr.c:2017
#define utf8_expect(out_string, buflen, out_bytes, in_string, in_bytes, expect_status)
Definition: rtlstr.c:2081
#define length_expect(in_chars, out_bytes, expect_status)
#define STATUS_INVALID_PARAMETER_4
Definition: ntstatus.h:478
#define STATUS_SOME_NOT_MAPPED
Definition: ntstatus.h:86
#define STATUS_INVALID_PARAMETER_5
Definition: ntstatus.h:479
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
void test_string()
Definition: test_string.cpp:38

Referenced by START_TEST().

◆ test_RtlUpcaseUnicodeChar()

static void test_RtlUpcaseUnicodeChar ( void  )
static

Definition at line 582 of file rtlstr.c.

583{
584 int i;
585 WCHAR ch;
586 WCHAR upper_ch;
587 WCHAR expected_upper_ch;
588
589 for (i = 0; i <= 255; i++) {
590 ch = (WCHAR) i;
591 upper_ch = pRtlUpcaseUnicodeChar(ch);
592 if (ch >= 'a' && ch <= 'z') {
593 expected_upper_ch = ch - 'a' + 'A';
594 } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) {
595 expected_upper_ch = ch - 0x20;
596 } else if (ch == 0xff) {
597 expected_upper_ch = 0x178;
598 } else {
599 expected_upper_ch = ch;
600 }
601 ok(upper_ch == expected_upper_ch,
602 "RtlUpcaseUnicodeChar('%c'[=0x%x]) has result '%c'[=0x%x], expected: '%c'[=0x%x]\n",
603 ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch);
604 }
605}

Referenced by START_TEST().

◆ test_RtlUpcaseUnicodeString()

static void test_RtlUpcaseUnicodeString ( void  )
static

Definition at line 608 of file rtlstr.c.

609{
610 int i;
611 WCHAR ch;
612 WCHAR upper_ch;
613 WCHAR ascii_buf[257];
614 WCHAR result_buf[257];
615 WCHAR upper_buf[257];
616 UNICODE_STRING ascii_str;
617 UNICODE_STRING result_str;
618 UNICODE_STRING upper_str;
619
620 for (i = 0; i <= 255; i++) {
621 ch = (WCHAR) i;
622 if (ch >= 'a' && ch <= 'z') {
623 upper_ch = ch - 'a' + 'A';
624 } else if (ch >= 0xe0 && ch <= 0xfe && ch != 0xf7) {
625 upper_ch = ch - 0x20;
626 } else if (ch == 0xff) {
627 upper_ch = 0x178;
628 } else {
629 upper_ch = ch;
630 }
631 ascii_buf[i] = ch;
632 result_buf[i] = '\0';
633 upper_buf[i] = upper_ch;
634 }
635 ascii_buf[i] = '\0';
636 result_buf[i] = '\0';
637 upper_buf[i] = '\0';
638 ascii_str.Length = 512;
639 ascii_str.MaximumLength = 512;
640 ascii_str.Buffer = ascii_buf;
641 result_str.Length = 512;
642 result_str.MaximumLength = 512;
643 result_str.Buffer = result_buf;
644 upper_str.Length = 512;
645 upper_str.MaximumLength = 512;
646 upper_str.Buffer = upper_buf;
647
648 pRtlUpcaseUnicodeString(&result_str, &ascii_str, 0);
649 for (i = 0; i <= 255; i++) {
650 ok(result_str.Buffer[i] == upper_str.Buffer[i],
651 "RtlUpcaseUnicodeString works wrong: '%c'[=0x%x] is converted to '%c'[=0x%x], expected: '%c'[=0x%x]\n",
652 ascii_str.Buffer[i], ascii_str.Buffer[i],
653 result_str.Buffer[i], result_str.Buffer[i],
654 upper_str.Buffer[i], upper_str.Buffer[i]);
655 }
656}

Referenced by START_TEST().

◆ test_RtlUpperChar()

static void test_RtlUpperChar ( void  )
static

Definition at line 518 of file rtlstr.c.

519{
520 int ch;
521 int upper_ch;
522 int expected_upper_ch;
523 int byte_ch;
524
525 for (ch = -1; ch <= 1024; ch++) {
526 upper_ch = pRtlUpperChar(ch);
527 byte_ch = ch & 0xff;
528 if (byte_ch >= 'a' && byte_ch <= 'z') {
529 expected_upper_ch = (CHAR) (byte_ch - 'a' + 'A');
530 } else {
531 expected_upper_ch = (CHAR) byte_ch;
532 }
533 ok(upper_ch == expected_upper_ch,
534 "RtlUpperChar('%c'[=0x%x]) has result '%c'[=0x%x], expected '%c'[=0x%x]\n",
535 ch, ch, upper_ch, upper_ch, expected_upper_ch, expected_upper_ch);
536 }
537}
#define CHAR(Char)

Referenced by START_TEST().

◆ test_RtlUpperString()

static void test_RtlUpperString ( void  )
static

Definition at line 540 of file rtlstr.c.

541{
542 int i;
543 CHAR ch;
544 CHAR upper_ch;
545 char ascii_buf[257];
546 char result_buf[257];
547 char upper_buf[257];
548 STRING ascii_str;
549 STRING result_str;
550 STRING upper_str;
551
552 for (i = 0; i <= 255; i++) {
553 ch = (CHAR) i;
554 if (ch >= 'a' && ch <= 'z') {
555 upper_ch = ch - 'a' + 'A';
556 } else {
557 upper_ch = ch;
558 }
559 ascii_buf[i] = ch;
560 result_buf[i] = '\0';
561 upper_buf[i] = upper_ch;
562 }
563 ascii_buf[i] = '\0';
564 result_buf[i] = '\0';
565 upper_buf[i] = '\0';
566 ascii_str.Length = 256;
567 ascii_str.MaximumLength = 256;
568 ascii_str.Buffer = ascii_buf;
569 result_str.Length = 256;
570 result_str.MaximumLength = 256;
571 result_str.Buffer = result_buf;
572 upper_str.Length = 256;
573 upper_str.MaximumLength = 256;
574 upper_str.Buffer = upper_buf;
575
576 pRtlUpperString(&result_str, &ascii_str);
577 ok(memcmp(result_str.Buffer, upper_str.Buffer, 256) == 0,
578 "RtlUpperString does not work as expected\n");
579}

Referenced by START_TEST().

◆ test_RtlUTF8ToUnicodeN()

static void test_RtlUTF8ToUnicodeN ( void  )
static

Definition at line 2386 of file rtlstr.c.

2387{
2389 ULONG bytes_out;
2390 ULONG bytes_out_array[2];
2391 void * const invalid_pointer = (void *)0x8;
2392 WCHAR buffer[128];
2393 const char empty_string[] = "";
2394 const char test_string[] = "A\0abcdefg";
2395 const WCHAR test_stringW[] = {'A',0,'a','b','c','d','e','f','g',0 };
2396 const char special_string[] = { 'X',0xc2,0x80,0xF0,0x90,0x80,0x80,0 };
2397 const WCHAR special_expected[] = { 'X',0x80,0xd800,0xdc00,0 };
2398 unsigned int input_len;
2399 const unsigned int test_count = sizeof(utf8_to_unicode) / sizeof(utf8_to_unicode[0]);
2400 unsigned int i;
2401
2402 if (!pRtlUTF8ToUnicodeN)
2403 {
2404 skip("RtlUTF8ToUnicodeN unavailable\n");
2405 return;
2406 }
2407
2408 /* show that bytes_out is really ULONG */
2409 memset(bytes_out_array, 0x55, sizeof(bytes_out_array));
2410 status = pRtlUTF8ToUnicodeN(NULL, 0, bytes_out_array, empty_string, 0);
2411 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2412 ok(bytes_out_array[0] == 0x00000000, "Got 0x%x\n", bytes_out_array[0]);
2413 ok(bytes_out_array[1] == 0x55555555, "Got 0x%x\n", bytes_out_array[1]);
2414
2415 /* parameter checks */
2416 status = pRtlUTF8ToUnicodeN(NULL, 0, NULL, NULL, 0);
2417 ok(status == STATUS_INVALID_PARAMETER_4, "status = 0x%x\n", status);
2418
2419 status = pRtlUTF8ToUnicodeN(NULL, 0, NULL, empty_string, 0);
2420 ok(status == STATUS_INVALID_PARAMETER, "status = 0x%x\n", status);
2421
2422 bytes_out = 0x55555555;
2423 status = pRtlUTF8ToUnicodeN(NULL, 0, &bytes_out, NULL, 0);
2424 ok(status == STATUS_INVALID_PARAMETER_4, "status = 0x%x\n", status);
2425 ok(bytes_out == 0x55555555, "bytes_out = 0x%x\n", bytes_out);
2426
2427 bytes_out = 0x55555555;
2428 status = pRtlUTF8ToUnicodeN(NULL, 0, &bytes_out, invalid_pointer, 0);
2429 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2430 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2431
2432 bytes_out = 0x55555555;
2433 status = pRtlUTF8ToUnicodeN(NULL, 0, &bytes_out, empty_string, 0);
2434 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2435 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2436
2437 bytes_out = 0x55555555;
2438 status = pRtlUTF8ToUnicodeN(NULL, 0, &bytes_out, test_string, 0);
2439 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2440 ok(bytes_out == 0, "bytes_out = 0x%x\n", bytes_out);
2441
2442 bytes_out = 0x55555555;
2443 status = pRtlUTF8ToUnicodeN(NULL, 0, &bytes_out, empty_string, 1);
2444 ok(status == STATUS_SUCCESS, "status = 0x%x\n", status);
2445 ok(bytes_out == sizeof(WCHAR), "bytes_out = 0x%x\n", bytes_out);
2446
2447 /* length output with special chars */
2448#define length_expect(in_chars, out_chars, expect_status) \
2449 unicode_expect_(NULL, 0, out_chars, special_string, in_chars, \
2450 expect_status, __LINE__)
2451
2461#undef length_expect
2462
2463 /* output truncation */
2464#define truncate_expect(buflen, out_chars, expect_status) \
2465 unicode_expect_(special_expected, buflen, out_chars, \
2466 special_string, sizeof(special_string), \
2467 expect_status, __LINE__)
2468
2480#undef truncate_expect
2481
2482 /* conversion behavior with varying input length */
2483 for (input_len = 0; input_len <= sizeof(test_string); input_len++) {
2484 /* no output buffer, just length */
2485 unicode_expect(NULL, 0, input_len,
2486 test_string, input_len, STATUS_SUCCESS);
2487
2488 /* write output */
2489 unicode_expect(test_stringW, -1, input_len,
2490 test_string, input_len, STATUS_SUCCESS);
2491 }
2492
2493 /* test cases for special characters */
2494 for (i = 0; i < test_count; i++) {
2495 bytes_out = 0x55555555;
2496 memset(buffer, 0x55, sizeof(buffer));
2497 status = pRtlUTF8ToUnicodeN(
2498 buffer, sizeof(buffer), &bytes_out,
2499 utf8_to_unicode[i].utf8, strlen(utf8_to_unicode[i].utf8));
2501 "(test %d): status is 0x%x, expected 0x%x\n",
2503 ok(bytes_out == lstrlenW(utf8_to_unicode[i].expected) * sizeof(WCHAR),
2504 "(test %d): bytes_out is %u, expected %u\n",
2505 i, bytes_out, lstrlenW(utf8_to_unicode[i].expected) * (ULONG)sizeof(WCHAR));
2506 ok(!memcmp(buffer, utf8_to_unicode[i].expected, bytes_out),
2507 "(test %d): got %s, expected %s\n",
2509 ok(buffer[bytes_out] == 0x5555,
2510 "(test %d): behind string: 0x%x\n", i, buffer[bytes_out]);
2511
2512 /* same test but include the null terminator */
2513 bytes_out = 0x55555555;
2514 memset(buffer, 0x55, sizeof(buffer));
2515 status = pRtlUTF8ToUnicodeN(
2516 buffer, sizeof(buffer), &bytes_out,
2517 utf8_to_unicode[i].utf8, strlen(utf8_to_unicode[i].utf8) + 1);
2519 "(test %d): status is 0x%x, expected 0x%x\n",
2521 ok(bytes_out == (lstrlenW(utf8_to_unicode[i].expected) + 1) * sizeof(WCHAR),
2522 "(test %d): bytes_out is %u, expected %u\n",
2523 i, bytes_out, (lstrlenW(utf8_to_unicode[i].expected) + 1) * (ULONG)sizeof(WCHAR));
2524 ok(!memcmp(buffer, utf8_to_unicode[i].expected, bytes_out),
2525 "(test %d): got %s, expected %s\n",
2527 ok(buffer[bytes_out] == 0x5555,
2528 "(test %d): behind string: 0x%x\n", i, buffer[bytes_out]);
2529 }
2530}
const char * wine_dbgstr_wn(const WCHAR *str, int n)
Definition: compat.c:367
static const struct utf8_to_unicode_test utf8_to_unicode[]
Definition: rtlstr.c:2266
#define unicode_expect(out_string, buflen, out_chars, in_string, in_chars, expect_status)
Definition: rtlstr.c:2383

Referenced by START_TEST().

◆ unicode_expect_()

static void unicode_expect_ ( const WCHAR out_string,
ULONG  buflen,
ULONG  out_chars,
const char in_string,
ULONG  in_chars,
NTSTATUS  expect_status,
int  line 
)
static

Definition at line 2352 of file rtlstr.c.

2355{
2357 ULONG bytes_out;
2358 WCHAR buffer[128];
2359 unsigned int i;
2360
2361 if (buflen == (ULONG)-1)
2362 buflen = sizeof(buffer);
2363 bytes_out = 0x55555555;
2364 memset(buffer, 0x55, sizeof(buffer));
2365 status = pRtlUTF8ToUnicodeN(
2366 out_string ? buffer : NULL, buflen, &bytes_out,
2367 in_string, in_chars);
2368 ok_(__FILE__, line)(status == expect_status, "status = 0x%x\n", status);
2369 ok_(__FILE__, line)(bytes_out == out_chars * sizeof(WCHAR),
2370 "bytes_out = %u, expected %u\n", bytes_out, out_chars * (ULONG)sizeof(WCHAR));
2371 if (out_string)
2372 {
2373 for (i = 0; i < bytes_out / sizeof(WCHAR); i++)
2374 ok_(__FILE__, line)(buffer[i] == out_string[i],
2375 "buffer[%d] = 0x%x, expected 0x%x\n",
2376 i, buffer[i], out_string[i]);
2377 for (; i < sizeof(buffer) / sizeof(WCHAR); i++)
2378 ok_(__FILE__, line)(buffer[i] == 0x5555,
2379 "buffer[%d] = 0x%x, expected 0x5555\n",
2380 i, buffer[i]);
2381 }
2382}
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: parser.c:49

◆ utf8_expect_()

static void utf8_expect_ ( const unsigned char out_string,
ULONG  buflen,
ULONG  out_bytes,
const WCHAR in_string,
ULONG  in_bytes,
NTSTATUS  expect_status,
int  line 
)
static

Definition at line 2050 of file rtlstr.c.

2053{
2055 ULONG bytes_out;
2056 char buffer[128];
2057 unsigned char *buf = (unsigned char *)buffer;
2058 unsigned int i;
2059
2060 if (buflen == (ULONG)-1)
2061 buflen = sizeof(buffer);
2062 bytes_out = 0x55555555;
2063 memset(buffer, 0x55, sizeof(buffer));
2064 status = pRtlUnicodeToUTF8N(
2065 out_string ? buffer : NULL, buflen, &bytes_out,
2066 in_string, in_bytes);
2067 ok_(__FILE__, line)(status == expect_status, "status = 0x%x\n", status);
2068 ok_(__FILE__, line)(bytes_out == out_bytes, "bytes_out = %u\n", bytes_out);
2069 if (out_string)
2070 {
2071 for (i = 0; i < bytes_out; i++)
2072 ok_(__FILE__, line)(buf[i] == out_string[i],
2073 "buffer[%d] = 0x%x, expected 0x%x\n",
2074 i, buf[i], out_string[i]);
2075 for (; i < sizeof(buffer); i++)
2076 ok_(__FILE__, line)(buf[i] == 0x55,
2077 "buffer[%d] = 0x%x, expected 0x55\n",
2078 i, buf[i]);
2079 }
2080}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751

◆ VOID()

static VOID ( WINAPI pRtlCopyString)
static

◆ WCHAR()

static int *static WCHAR ( WINAPI pRtlUpcaseUnicodeChar)
static

Variable Documentation

◆ app_asc2str

const app_asc2str_t app_asc2str[]
static
Initial value:
= {
{ 5, 12, 15, "TestS01234abcde", "tring", 10, 12, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 11, 15, "TestS01234abcde", "tring", 10, 11, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 10, 15, "TestS01234abcde", "tring", 10, 10, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 9, 15, "TestS01234abcde", "tring", 5, 9, 15, "TestS01234abcde", STATUS_BUFFER_TOO_SMALL},
{ 5, 0, 15, "TestS01234abcde", "tring", 5, 0, 15, "TestS01234abcde", STATUS_BUFFER_TOO_SMALL},
{ 5, 14, 15, "TestS01234abcde", "tring", 10, 14, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 14, 15, "TestS01234abcde", NULL, 5, 14, 15, "TestS01234abcde", STATUS_SUCCESS},
{ 5, 14, 15, NULL, NULL, 5, 14, 15, NULL, STATUS_SUCCESS},
{ 5, 12, 15, "Tst\0S01234abcde", "tr\0i", 7, 12, 15, "Tst\0Str234abcde", STATUS_SUCCESS},
}

Definition at line 844 of file rtlstr.c.

Referenced by test_RtlAppendAsciizToString().

◆ app_str2str

const app_str2str_t app_str2str[]
static
Initial value:
= {
{ 5, 12, 15, "TestS01234abcde", 5, 5, 7, "tringZY", 10, 12, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 11, 15, "TestS01234abcde", 5, 5, 7, "tringZY", 10, 11, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 10, 15, "TestS01234abcde", 5, 5, 7, "tringZY", 10, 10, 15, "TestStringabcde", STATUS_SUCCESS},
{ 5, 9, 15, "TestS01234abcde", 5, 5, 7, "tringZY", 5, 9, 15, "TestS01234abcde", STATUS_BUFFER_TOO_SMALL},
{ 5, 0, 15, "TestS01234abcde", 0, 0, 7, "tringZY", 5, 0, 15, "TestS01234abcde", STATUS_SUCCESS},
{ 5, 14, 15, "TestS01234abcde", 0, 0, 7, "tringZY", 5, 14, 15, "TestS01234abcde", STATUS_SUCCESS},
{ 5, 14, 15, "TestS01234abcde", 0, 0, 7, NULL, 5, 14, 15, "TestS01234abcde", STATUS_SUCCESS},
{ 5, 14, 15, NULL, 0, 0, 7, NULL, 5, 14, 15, NULL, STATUS_SUCCESS},
{ 5, 12, 15, "Tst\0S01234abcde", 4, 4, 7, "tr\0iZY", 9, 12, 15, "Tst\0Str\0i4abcde", STATUS_SUCCESS},
}

Definition at line 914 of file rtlstr.c.

Referenced by test_RtlAppendStringToString().

◆ app_uni2str

const app_uni2str_t app_uni2str[]
static
Initial value:
= {
{ 4, 12, 14, "Fake0123abcdef", "Ustr\0", 8, 12, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 11, 14, "Fake0123abcdef", "Ustr\0", 8, 11, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 10, 14, "Fake0123abcdef", "Ustr\0", 8, 10, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 8, 14, "Fake0123abcdef", "Ustr\0", 8, 8, 14, "FakeUstrabcdef", STATUS_SUCCESS},
{ 4, 7, 14, "Fake0123abcdef", "Ustr\0", 4, 7, 14, "Fake0123abcdef", STATUS_BUFFER_TOO_SMALL},
{ 4, 0, 14, "Fake0123abcdef", "Ustr\0", 4, 0, 14, "Fake0123abcdef", STATUS_BUFFER_TOO_SMALL},
{ 4, 14, 14, "Fake0123abcdef", "Ustr\0", 8, 14, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 14, 14, "Fake0123abcdef", NULL, 4, 14, 14, "Fake0123abcdef", STATUS_SUCCESS},
{ 4, 14, 14, NULL, NULL, 4, 14, 14, NULL, STATUS_SUCCESS},
{ 4, 14, 14, "Fake0123abcdef", "U\0stri\0", 10, 14, 14, "FakeU\0stri\0\0ef", STATUS_SUCCESS},
{ 6, 14, 16, "Te\0\0stabcdefghij", "St\0\0ri", 8, 14, 16, "Te\0\0stSt\0\0efghij", STATUS_SUCCESS},
}

Definition at line 992 of file rtlstr.c.

Referenced by test_RtlAppendUnicodeToString().

◆ app_ustr2str

const app_ustr2str_t app_ustr2str[]
static
Initial value:
= {
{ 4, 12, 14, "Fake0123abcdef", 4, 6, 8, "UstrZYXW", 8, 12, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 11, 14, "Fake0123abcdef", 4, 6, 8, "UstrZYXW", 8, 11, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 10, 14, "Fake0123abcdef", 4, 6, 8, "UstrZYXW", 8, 10, 14, "FakeUstr\0\0cdef", STATUS_SUCCESS},
{ 4, 8, 14, "Fake0123abcdef", 4, 6, 8, "UstrZYXW", 8, 8, 14, "FakeUstrabcdef", STATUS_SUCCESS},
{ 4, 7, 14, "Fake0123abcdef", 4, 6, 8, "UstrZYXW", 4, 7, 14, "Fake0123abcdef", STATUS_BUFFER_TOO_SMALL},
{ 4, 0, 14, "Fake0123abcdef", 0, 0, 8, "UstrZYXW", 4, 0, 14, "Fake0123abcdef", STATUS_SUCCESS},
{ 4, 14, 14, "Fake0123abcdef", 0, 0, 8, "UstrZYXW", 4, 14, 14, "Fake0123abcdef", STATUS_SUCCESS},
{ 4, 14, 14, "Fake0123abcdef", 0, 0, 8, NULL, 4, 14, 14, "Fake0123abcdef", STATUS_SUCCESS},
{ 4, 14, 14, NULL, 0, 0, 8, NULL, 4, 14, 14, NULL, STATUS_SUCCESS},
{ 6, 14, 16, "Te\0\0stabcdefghij", 6, 8, 8, "St\0\0riZY", 12, 14, 16, "Te\0\0stSt\0\0ri\0\0ij", STATUS_SUCCESS},
}

Definition at line 1067 of file rtlstr.c.

Referenced by test_RtlAppendUnicodeStringToString().

◆ BOOLEAN

const STRING *static UNICODE_STRING *static GUID *static UNICODE_STRING *static INT *static BOOLEAN

Definition at line 38 of file rtlstr.c.

◆ dupl_ustr

const dupl_ustr_t dupl_ustr[]
static

Definition at line 335 of file rtlstr.c.

Referenced by test_RtlDuplicateUnicodeString().

◆ find_ch_in_ustr

const find_ch_in_ustr_t find_ch_in_ustr[]
static

Definition at line 1144 of file rtlstr.c.

Referenced by test_RtlFindCharInUnicodeString().

◆ hash_test

const struct hash_unicodestring_test hash_test[]
static
Initial value:
= {
{ {'T',0}, FALSE, 0x00000054 },
{ {'T','e','s','t',0}, FALSE, 0x766bb952 },
{ {'T','e','S','t',0}, FALSE, 0x764bb172 },
{ {'t','e','s','t',0}, FALSE, 0x4745d132 },
{ {'t','e','s','t',0}, TRUE, 0x6689c132 },
{ {'T','E','S','T',0}, TRUE, 0x6689c132 },
{ {'T','E','S','T',0}, FALSE, 0x6689c132 },
{ {'a','b','c','d','e','f',0}, FALSE, 0x971318c3 },
{ { 0 } }
}

Definition at line 1953 of file rtlstr.c.

Referenced by test_RtlHashUnicodeString().

◆ hntdll

HMODULE hntdll = 0
static

Definition at line 37 of file rtlstr.c.

Referenced by InitFunctionPtrs().

◆ int

int

Definition at line 63 of file rtlstr.c.

◆ INT

const STRING *static UNICODE_STRING *static GUID *static UNICODE_STRING *static INT

Definition at line 71 of file rtlstr.c.

◆ int2str

◆ LONG

Definition at line 61 of file rtlstr.c.

◆ LPCSTR

Definition at line 39 of file rtlstr.c.

◆ LPCWSTR

Definition at line 42 of file rtlstr.c.

◆ PCANSI_STRING

Definition at line 38 of file rtlstr.c.

◆ PCHAR

Definition at line 59 of file rtlstr.c.

Referenced by RtlInitLargeAnsiString().

◆ SIZE_T

Definition at line 45 of file rtlstr.c.

◆ str2int

const str2int_t str2int[]
static

Definition at line 1260 of file rtlstr.c.

Referenced by test_RtlCharToInteger(), and test_RtlUnicodeStringToInteger().

◆ szGuid

const WCHAR szGuid[]
static
Initial value:
= { '{','0','1','0','2','0','3','0','4','-',
'0','5','0','6','-' ,'0','7','0','8','-','0','9','0','A','-',
'0','B','0','C','0','D','0','E','0','F','0','A','}','\0' }

Definition at line 1892 of file rtlstr.c.

Referenced by ATL::CComBSTR::CComBSTR(), do_enum(), FindProviderIndex(), InitProbeListPage(), CShellLink::SetAdvertiseInfo(), test_RtlGUIDFromString(), and test_RtlStringFromGUID().

◆ szGuid2

const WCHAR szGuid2[]
static
Initial value:
= { '{','0','1','0','2','0','3','0','4','-',
'0','5','0','6','-' ,'0','7','0','8','-','0','9','0','A','-',
'0','B','0','C','0','D','0','E','0','F','0','A',']','\0' }

Definition at line 1895 of file rtlstr.c.

Referenced by test_RtlGUIDFromString().

◆ ULONG

Definition at line 43 of file rtlstr.c.

◆ unicode_to_utf8

const struct unicode_to_utf8_test unicode_to_utf8[]
static

Definition at line 2017 of file rtlstr.c.

Referenced by test_RtlUnicodeToUTF8N().

◆ ustr2astr

const ustr2astr_t ustr2astr[]
static
Initial value:
= {
{ 10, 12, 12, "------------", 0, 0, 0, "", TRUE, 0, 1, 1, "", STATUS_SUCCESS},
{ 10, 12, 12, "------------", 12, 12, 12, "abcdef", TRUE, 6, 7, 7, "abcdef", STATUS_SUCCESS},
{ 0, 2, 12, "------------", 12, 12, 12, "abcdef", TRUE, 6, 7, 7, "abcdef", STATUS_SUCCESS},
{ 10, 12, 12, NULL, 12, 12, 12, "abcdef", TRUE, 6, 7, 7, "abcdef", STATUS_SUCCESS},
{ 0, 0, 12, "------------", 12, 12, 12, "abcdef", FALSE, 6, 0, 0, "", STATUS_BUFFER_OVERFLOW},
{ 0, 1, 12, "------------", 12, 12, 12, "abcdef", FALSE, 0, 1, 1, "", STATUS_BUFFER_OVERFLOW},
{ 0, 2, 12, "------------", 12, 12, 12, "abcdef", FALSE, 1, 2, 2, "a", STATUS_BUFFER_OVERFLOW},
{ 0, 3, 12, "------------", 12, 12, 12, "abcdef", FALSE, 2, 3, 3, "ab", STATUS_BUFFER_OVERFLOW},
{ 0, 5, 12, "------------", 12, 12, 12, "abcdef", FALSE, 4, 5, 5, "abcd", STATUS_BUFFER_OVERFLOW},
{ 8, 5, 12, "------------", 12, 12, 12, "abcdef", FALSE, 4, 5, 5, "abcd", STATUS_BUFFER_OVERFLOW},
{ 8, 6, 12, "------------", 12, 12, 12, "abcdef", FALSE, 5, 6, 6, "abcde", STATUS_BUFFER_OVERFLOW},
{ 8, 7, 12, "------------", 12, 12, 12, "abcdef", FALSE, 6, 7, 7, "abcdef", STATUS_SUCCESS},
{ 8, 7, 12, "------------", 0, 12, 12, NULL, FALSE, 0, 7, 0, "", STATUS_SUCCESS},
}

Definition at line 760 of file rtlstr.c.

Referenced by test_RtlUnicodeStringToAnsiString().

◆ utf8_to_unicode

const struct utf8_to_unicode_test utf8_to_unicode[]
static

Definition at line 2266 of file rtlstr.c.

Referenced by test_RtlUTF8ToUnicodeN().