2 * Unit tests for Windows String functions
4 * Copyright (c) 2014 Martin Storsjo
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "winstring.h"
28 #include "wine/test.h"
30 static HRESULT (WINAPI
*pWindowsConcatString
)(HSTRING
, HSTRING
, HSTRING
*);
31 static HRESULT (WINAPI
*pWindowsCreateString
)(LPCWSTR
, UINT32
, HSTRING
*);
32 static HRESULT (WINAPI
*pWindowsCreateStringReference
)(LPCWSTR
, UINT32
, HSTRING_HEADER
*, HSTRING
*);
33 static HRESULT (WINAPI
*pWindowsDeleteString
)(HSTRING
);
34 static HRESULT (WINAPI
*pWindowsDeleteStringBuffer
)(HSTRING_BUFFER
);
35 static HRESULT (WINAPI
*pWindowsDuplicateString
)(HSTRING
, HSTRING
*);
36 static UINT32 (WINAPI
*pWindowsGetStringLen
)(HSTRING
);
37 static LPCWSTR (WINAPI
*pWindowsGetStringRawBuffer
)(HSTRING
, UINT32
*);
38 static BOOL (WINAPI
*pWindowsIsStringEmpty
)(HSTRING
);
39 static HRESULT (WINAPI
*pWindowsPreallocateStringBuffer
)(UINT32
, WCHAR
**, HSTRING_BUFFER
*);
40 static HRESULT (WINAPI
*pWindowsPromoteStringBuffer
)(HSTRING_BUFFER
, HSTRING
*);
41 static HRESULT (WINAPI
*pWindowsStringHasEmbeddedNull
)(HSTRING
, BOOL
*);
42 static HRESULT (WINAPI
*pWindowsSubstring
)(HSTRING
, UINT32
, HSTRING
*);
43 static HRESULT (WINAPI
*pWindowsSubstringWithSpecifiedLength
)(HSTRING
, UINT32
, UINT32
, HSTRING
*);
45 #define SET(x) p##x = (void*)GetProcAddress(hmod, #x)
47 static BOOL
init_functions(void)
49 HMODULE hmod
= LoadLibraryA("combase.dll");
52 win_skip("Failed to load combase.dll, skipping tests\n");
55 SET(WindowsConcatString
);
56 SET(WindowsCreateString
);
57 SET(WindowsCreateStringReference
);
58 SET(WindowsDeleteString
);
59 SET(WindowsDeleteStringBuffer
);
60 SET(WindowsDuplicateString
);
61 SET(WindowsGetStringLen
);
62 SET(WindowsGetStringRawBuffer
);
63 SET(WindowsIsStringEmpty
);
64 SET(WindowsPreallocateStringBuffer
);
65 SET(WindowsPromoteStringBuffer
);
66 SET(WindowsStringHasEmbeddedNull
);
67 SET(WindowsSubstring
);
68 SET(WindowsSubstringWithSpecifiedLength
);
75 #define check_string(str, content, length, has_null) _check_string(__LINE__, str, content, length, has_null)
76 static void _check_string(int line
, HSTRING str
, LPCWSTR content
, UINT32 length
, BOOL has_null
)
79 BOOL empty
= length
== 0;
83 ok_(__FILE__
, line
)(pWindowsIsStringEmpty(str
) == empty
, "WindowsIsStringEmpty failed\n");
84 ok_(__FILE__
, line
)(pWindowsStringHasEmbeddedNull(str
, &out_null
) == S_OK
, "pWindowsStringHasEmbeddedNull failed\n");
85 ok_(__FILE__
, line
)(out_null
== has_null
, "WindowsStringHasEmbeddedNull failed\n");
86 ok_(__FILE__
, line
)(pWindowsGetStringLen(str
) == length
, "WindowsGetStringLen failed\n");
87 ptr
= pWindowsGetStringRawBuffer(str
, &out_length
);
88 /* WindowsGetStringRawBuffer should return a non-null, null terminated empty string
89 * even if str is NULL. */
90 ok_(__FILE__
, line
)(ptr
!= NULL
, "WindowsGetStringRawBuffer returned null\n");
91 ok_(__FILE__
, line
)(out_length
== length
, "WindowsGetStringRawBuffer returned incorrect length\n");
92 ptr
= pWindowsGetStringRawBuffer(str
, NULL
);
93 ok_(__FILE__
, line
)(ptr
!= NULL
, "WindowsGetStringRawBuffer returned null\n");
94 ok_(__FILE__
, line
)(ptr
[length
] == '\0', "WindowsGetStringRawBuffer doesn't return a null terminated buffer\n");
95 ok_(__FILE__
, line
)(memcmp(ptr
, content
, sizeof(*content
) * length
) == 0, "Incorrect string content\n");
98 static const WCHAR input_string
[] = { 'a', 'b', 'c', 'd', 'e', 'f', '\0', '\0' };
99 static const WCHAR input_string1
[] = { 'a', 'b', 'c', '\0' };
100 static const WCHAR input_string2
[] = { 'd', 'e', 'f', '\0' };
101 static const WCHAR input_empty_string
[] = { '\0' };
102 static const WCHAR input_embed_null
[] = { 'a', '\0', 'c', '\0', 'e', 'f', '\0' };
103 static const WCHAR output_substring
[] = { 'c', 'd', 'e', 'f', '\0' };
105 static void test_create_delete(void)
108 HSTRING_HEADER header
;
110 /* Test normal creation of a string */
111 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
112 check_string(str
, input_string
, 6, FALSE
);
113 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
114 /* Test error handling in WindowsCreateString */
115 ok(pWindowsCreateString(input_string
, 6, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
116 ok(pWindowsCreateString(NULL
, 6, &str
) == E_POINTER
, "Incorrect error handling\n");
118 /* Test handling of a NULL string */
119 ok(pWindowsDeleteString(NULL
) == S_OK
, "Failed to delete null string\n");
121 /* Test creation of a string reference */
122 ok(pWindowsCreateStringReference(input_string
, 6, &header
, &str
) == S_OK
, "Failed to create string ref\n");
123 check_string(str
, input_string
, 6, FALSE
);
124 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string ref\n");
126 /* Test error handling in WindowsCreateStringReference */
127 /* Strings to CreateStringReference must be null terminated with the correct
128 * length. According to MSDN this should be E_INVALIDARG, but it returns
129 * 0x80000017 in practice. */
130 ok(FAILED(pWindowsCreateStringReference(input_string
, 5, &header
, &str
)), "Incorrect error handling\n");
131 /* If the input string is non-null, it must be null-terminated even if the
133 ok(FAILED(pWindowsCreateStringReference(input_string
, 0, &header
, &str
)), "Incorrect error handling\n");
134 ok(pWindowsCreateStringReference(input_string
, 6, NULL
, &str
) == E_INVALIDARG
, "Incorrect error handling\n");
135 ok(pWindowsCreateStringReference(input_string
, 6, &header
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
136 ok(pWindowsCreateStringReference(NULL
, 6, &header
, &str
) == E_POINTER
, "Incorrect error handling\n");
138 /* Test creating a string without a null-termination at the specified length */
139 ok(pWindowsCreateString(input_string
, 3, &str
) == S_OK
, "Failed to create string\n");
140 check_string(str
, input_string
, 3, FALSE
);
141 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
143 /* Test an empty string */
144 ok(pWindowsCreateString(input_empty_string
, 0, &str
) == S_OK
, "Failed to create string\n");
145 ok(str
== NULL
, "Empty string not a null string\n");
146 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
148 ok(pWindowsCreateString(input_string
, 0, &str
) == S_OK
, "Failed to create string\n");
149 ok(str
== NULL
, "Empty string not a null string\n");
150 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
152 ok(pWindowsCreateStringReference(input_empty_string
, 0, &header
, &str
) == S_OK
, "Failed to create string\n");
153 ok(str
== NULL
, "Empty string not a null string\n");
154 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
156 ok(pWindowsCreateString(NULL
, 0, &str
) == S_OK
, "Failed to create string\n");
157 ok(str
== NULL
, "Empty string not a null string\n");
158 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
160 ok(pWindowsCreateStringReference(NULL
, 0, &header
, &str
) == S_OK
, "Failed to create string\n");
161 ok(str
== NULL
, "Empty string not a null string\n");
162 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
165 static void test_duplicate(void)
168 HSTRING_HEADER header
;
169 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
170 ok(pWindowsDuplicateString(str
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
171 ok(pWindowsDuplicateString(str
, &str2
) == S_OK
, "Failed to duplicate string\n");
172 ok(str
== str2
, "Duplicated string created new string\n");
173 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
174 ok(pWindowsDeleteString(str2
) == S_OK
, "Failed to delete string\n");
176 ok(pWindowsCreateStringReference(input_string
, 6, &header
, &str
) == S_OK
, "Failed to create string ref\n");
177 ok(pWindowsDuplicateString(str
, &str2
) == S_OK
, "Failed to duplicate string\n");
178 ok(str
!= str2
, "Duplicated string ref didn't create new string\n");
179 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
180 ok(pWindowsDeleteString(str2
) == S_OK
, "Failed to delete string ref\n");
182 ok(pWindowsDuplicateString(NULL
, &str2
) == S_OK
, "Failed to duplicate NULL string\n");
183 ok(str2
== NULL
, "Duplicated string created new string\n");
184 ok(pWindowsDeleteString(str2
) == S_OK
, "Failed to delete string\n");
187 static void test_access(void)
190 HSTRING_HEADER header
;
192 /* Test handling of a NULL string */
193 check_string(NULL
, NULL
, 0, FALSE
);
195 /* Test strings with embedded null chars */
196 ok(pWindowsCreateString(input_embed_null
, 6, &str
) == S_OK
, "Failed to create string\n");
197 check_string(str
, input_embed_null
, 6, TRUE
);
198 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
200 ok(pWindowsCreateStringReference(input_embed_null
, 6, &header
, &str
) == S_OK
, "Failed to create string ref\n");
201 check_string(str
, input_embed_null
, 6, TRUE
);
202 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string ref\n");
204 /* Test normal creation of a string with trailing null */
205 ok(pWindowsCreateString(input_string
, 7, &str
) == S_OK
, "Failed to create string\n");
206 check_string(str
, input_string
, 7, TRUE
);
207 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
209 ok(pWindowsCreateStringReference(input_string
, 7, &header
, &str
) == S_OK
, "Failed to create string ref\n");
210 check_string(str
, input_string
, 7, TRUE
);
211 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string ref\n");
214 static void test_string_buffer(void)
216 /* Initialize ptr to NULL to make sure it actually is set in the first
218 HSTRING_BUFFER buf
= NULL
;
222 /* Test creation of an empty buffer */
223 ok(pWindowsPreallocateStringBuffer(0, &ptr
, &buf
) == S_OK
, "Failed to preallocate string buffer\n");
224 ok(buf
== NULL
, "Empty string buffer isn't a null string\n");
225 ok(ptr
!= NULL
, "Empty string didn't return a buffer pointer\n");
226 ok(pWindowsPromoteStringBuffer(buf
, &str
) == S_OK
, "Failed to promote string buffer\n");
227 ok(str
== NULL
, "Empty string isn't a null string\n");
228 check_string(str
, input_empty_string
, 0, FALSE
);
229 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
231 ok(pWindowsDeleteStringBuffer(NULL
) == S_OK
, "Failed to delete null string buffer\n");
233 /* Test creation and deletion of string buffers */
234 ok(pWindowsPreallocateStringBuffer(6, &ptr
, &buf
) == S_OK
, "Failed to preallocate string buffer\n");
235 ok(pWindowsDeleteStringBuffer(buf
) == S_OK
, "Failed to delete string buffer\n");
237 /* Test creation and promotion of string buffers */
238 ok(pWindowsPreallocateStringBuffer(6, &ptr
, &buf
) == S_OK
, "Failed to preallocate string buffer\n");
239 ok(ptr
[6] == '\0', "Preallocated string buffer didn't have null termination\n");
240 memcpy(ptr
, input_string
, 6 * sizeof(*input_string
));
241 ok(pWindowsPromoteStringBuffer(buf
, NULL
) == E_POINTER
, "Incorrect error handling\n");
242 ok(pWindowsPromoteStringBuffer(buf
, &str
) == S_OK
, "Failed to promote string buffer\n");
243 check_string(str
, input_string
, 6, FALSE
);
244 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
246 /* Test error handling in preallocation */
247 ok(pWindowsPreallocateStringBuffer(6, NULL
, &buf
) == E_POINTER
, "Incorrect error handling\n");
248 ok(pWindowsPreallocateStringBuffer(6, &ptr
, NULL
) == E_POINTER
, "Incorrect error handling\n");
250 ok(pWindowsPreallocateStringBuffer(6, &ptr
, &buf
) == S_OK
, "Failed to preallocate string buffer\n");
251 ptr
[6] = 'a'; /* Overwrite the buffer's null termination, promotion should fail */
252 ok(pWindowsPromoteStringBuffer(buf
, &str
) == E_INVALIDARG
, "Incorrect error handling\n");
253 ok(pWindowsDeleteStringBuffer(buf
) == S_OK
, "Failed to delete string buffer\n");
255 /* Test strings with trailing null chars */
256 ok(pWindowsPreallocateStringBuffer(7, &ptr
, &buf
) == S_OK
, "Failed to preallocate string buffer\n");
257 memcpy(ptr
, input_string
, 7 * sizeof(*input_string
));
258 ok(pWindowsPromoteStringBuffer(buf
, &str
) == S_OK
, "Failed to promote string buffer\n");
259 check_string(str
, input_string
, 7, TRUE
);
260 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
263 static void test_substring(void)
266 HSTRING_HEADER header
;
268 /* Test substring of string buffers */
269 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
270 ok(pWindowsSubstring(str
, 2, &substr
) == S_OK
, "Failed to create substring\n");
271 check_string(substr
, output_substring
, 4, FALSE
);
272 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
273 ok(pWindowsSubstringWithSpecifiedLength(str
, 2, 3, &substr
) == S_OK
, "Failed to create substring\n");
274 check_string(substr
, output_substring
, 3, FALSE
);
275 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
276 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
278 /* Test duplication of string using substring */
279 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
280 ok(pWindowsSubstring(str
, 0, &substr
) == S_OK
, "Failed to create substring\n");
281 ok(str
!= substr
, "Duplicated string didn't create new string\n");
282 check_string(substr
, input_string
, 6, FALSE
);
283 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
284 ok(pWindowsSubstringWithSpecifiedLength(str
, 0, 6, &substr
) == S_OK
, "Failed to create substring\n");
285 ok(str
!= substr
, "Duplicated string didn't create new string\n");
286 check_string(substr
, input_string
, 6, FALSE
);
287 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
288 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
290 /* Test substring of string reference */
291 ok(pWindowsCreateStringReference(input_string
, 6, &header
, &str
) == S_OK
, "Failed to create string ref\n");
292 ok(pWindowsSubstring(str
, 2, &substr
) == S_OK
, "Failed to create substring of string ref\n");
293 check_string(substr
, output_substring
, 4, FALSE
);
294 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
295 ok(pWindowsSubstringWithSpecifiedLength(str
, 2, 3, &substr
) == S_OK
, "Failed to create substring of string ref\n");
296 check_string(substr
, output_substring
, 3, FALSE
);
297 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
298 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string ref\n");
300 /* Test duplication of string reference using substring */
301 ok(pWindowsCreateStringReference(input_string
, 6, &header
, &str
) == S_OK
, "Failed to create string ref\n");
302 ok(pWindowsSubstring(str
, 0, &substr
) == S_OK
, "Failed to create substring of string ref\n");
303 ok(str
!= substr
, "Duplicated string ref didn't create new string\n");
304 check_string(substr
, input_string
, 6, FALSE
);
305 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
306 ok(pWindowsSubstringWithSpecifiedLength(str
, 0, 6, &substr
) == S_OK
, "Failed to create substring of string ref\n");
307 ok(str
!= substr
, "Duplicated string ref didn't create new string\n");
308 check_string(substr
, input_string
, 6, FALSE
);
309 ok(pWindowsDeleteString(substr
) == S_OK
, "Failed to delete string\n");
310 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string ref\n");
312 /* Test get substring of empty string */
313 ok(pWindowsSubstring(NULL
, 0, &substr
) == S_OK
, "Failed to duplicate NULL string\n");
314 ok(substr
== NULL
, "Substring created new string\n");
315 ok(pWindowsSubstringWithSpecifiedLength(NULL
, 0, 0, &substr
) == S_OK
, "Failed to duplicate NULL string\n");
316 ok(substr
== NULL
, "Substring created new string\n");
318 /* Test get empty substring of string */
319 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
320 ok(pWindowsSubstring(str
, 6, &substr
) == S_OK
, "Failed to create substring\n");
321 ok(substr
== NULL
, "Substring created new string\n");
322 ok(pWindowsSubstringWithSpecifiedLength(str
, 6, 0, &substr
) == S_OK
, "Failed to create substring\n");
323 ok(substr
== NULL
, "Substring created new string\n");
324 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
326 /* Test handling of using too high start index or length */
327 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
328 ok(pWindowsSubstring(str
, 7, &substr
) == E_BOUNDS
, "Incorrect error handling\n");
329 ok(pWindowsSubstringWithSpecifiedLength(str
, 7, 0, &substr
) == E_BOUNDS
, "Incorrect error handling\n");
330 ok(pWindowsSubstringWithSpecifiedLength(str
, 6, 1, &substr
) == E_BOUNDS
, "Incorrect error handling\n");
331 ok(pWindowsSubstringWithSpecifiedLength(str
, 7, ~0U, &substr
) == E_BOUNDS
, "Incorrect error handling\n");
332 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
334 /* Test handling of a NULL string */
335 ok(pWindowsCreateString(input_string
, 6, &str
) == S_OK
, "Failed to create string\n");
336 ok(pWindowsSubstring(str
, 7, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
337 ok(pWindowsSubstringWithSpecifiedLength(str
, 7, 0, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
338 ok(pWindowsDeleteString(str
) == S_OK
, "Failed to delete string\n");
341 static void test_concat(void)
343 HSTRING str1
, str2
, concat
;
344 HSTRING_HEADER header1
, header2
;
346 /* Test concatenation of string buffers */
347 ok(pWindowsCreateString(input_string1
, 3, &str1
) == S_OK
, "Failed to create string\n");
348 ok(pWindowsCreateString(input_string2
, 3, &str2
) == S_OK
, "Failed to create string\n");
350 ok(pWindowsConcatString(str1
, NULL
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
351 ok(pWindowsConcatString(str1
, NULL
, &concat
) == S_OK
, "Failed to concatenate string\n");
352 ok(str1
== concat
, "Concatenate created new string\n");
353 check_string(concat
, input_string1
, 3, FALSE
);
354 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
356 ok(pWindowsConcatString(NULL
, str2
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
357 ok(pWindowsConcatString(NULL
, str2
, &concat
) == S_OK
, "Failed to concatenate string\n");
358 ok(str2
== concat
, "Concatenate created new string\n");
359 check_string(concat
, input_string2
, 3, FALSE
);
360 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
362 ok(pWindowsConcatString(str1
, str2
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
363 ok(pWindowsConcatString(str1
, str2
, &concat
) == S_OK
, "Failed to concatenate string\n");
364 check_string(concat
, input_string
, 6, FALSE
);
365 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
367 ok(pWindowsDeleteString(str2
) == S_OK
, "Failed to delete string\n");
368 ok(pWindowsDeleteString(str1
) == S_OK
, "Failed to delete string\n");
370 /* Test concatenation of string references */
371 ok(pWindowsCreateStringReference(input_string1
, 3, &header1
, &str1
) == S_OK
, "Failed to create string ref\n");
372 ok(pWindowsCreateStringReference(input_string2
, 3, &header2
, &str2
) == S_OK
, "Failed to create string ref\n");
374 ok(pWindowsConcatString(str1
, NULL
, &concat
) == S_OK
, "Failed to concatenate string\n");
375 ok(str1
!= concat
, "Concatenate string ref didn't create new string\n");
376 check_string(concat
, input_string1
, 3, FALSE
);
377 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
379 ok(pWindowsConcatString(NULL
, str2
, &concat
) == S_OK
, "Failed to concatenate string\n");
380 ok(str2
!= concat
, "Concatenate string ref didn't create new string\n");
381 check_string(concat
, input_string2
, 3, FALSE
);
382 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
384 ok(pWindowsConcatString(str1
, str2
, &concat
) == S_OK
, "Failed to concatenate string\n");
385 check_string(concat
, input_string
, 6, FALSE
);
386 ok(pWindowsDeleteString(concat
) == S_OK
, "Failed to delete string\n");
388 ok(pWindowsDeleteString(str2
) == S_OK
, "Failed to delete string ref\n");
389 ok(pWindowsDeleteString(str1
) == S_OK
, "Failed to delete string ref\n");
391 /* Test concatenation of two empty strings */
392 ok(pWindowsConcatString(NULL
, NULL
, NULL
) == E_INVALIDARG
, "Incorrect error handling\n");
393 ok(pWindowsConcatString(NULL
, NULL
, &concat
) == S_OK
, "Failed to concatenate string\n");
394 ok(concat
== NULL
, "Concatenate created new string\n");
399 if (!init_functions())
401 test_create_delete();
404 test_string_buffer();