Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
141c182e
Commit
141c182e
authored
Apr 14, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combase/tests: Link directly to combase.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0bf71745
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
208 additions
and
297 deletions
+208
-297
Makefile.in
dlls/combase/tests/Makefile.in
+1
-0
roapi.c
dlls/combase/tests/roapi.c
+10
-49
string.c
dlls/combase/tests/string.c
+195
-248
roapi.h
include/roapi.h
+2
-0
No files found.
dlls/combase/tests/Makefile.in
View file @
141c182e
TESTDLL
=
combase.dll
TESTDLL
=
combase.dll
IMPORTS
=
combase
C_SRCS
=
\
C_SRCS
=
\
roapi.c
\
roapi.c
\
...
...
dlls/combase/tests/roapi.c
View file @
141c182e
...
@@ -26,38 +26,8 @@
...
@@ -26,38 +26,8 @@
#include "initguid.h"
#include "initguid.h"
#include "roapi.h"
#include "roapi.h"
#include "wine/test.h"
#include "wine/test.h"
static
HRESULT
(
WINAPI
*
pRoActivateInstance
)(
HSTRING
,
IInspectable
**
);
static
HRESULT
(
WINAPI
*
pRoInitialize
)(
RO_INIT_TYPE
);
static
void
(
WINAPI
*
pRoUninitialize
)(
void
);
static
HRESULT
(
WINAPI
*
pRoGetActivationFactory
)(
HSTRING
,
REFIID
,
void
**
);
static
HRESULT
(
WINAPI
*
pWindowsCreateString
)(
LPCWSTR
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsDeleteString
)(
HSTRING
);
#define SET(x) p##x = (void*)GetProcAddress(hmod, #x)
static
BOOL
init_functions
(
void
)
{
HMODULE
hmod
=
LoadLibraryA
(
"combase.dll"
);
if
(
!
hmod
)
{
win_skip
(
"Failed to load combase.dll, skipping tests
\n
"
);
return
FALSE
;
}
SET
(
RoActivateInstance
);
SET
(
RoInitialize
);
SET
(
RoUninitialize
);
SET
(
RoGetActivationFactory
);
SET
(
WindowsCreateString
);
SET
(
WindowsDeleteString
);
return
TRUE
;
}
static
void
test_ActivationFactories
(
void
)
static
void
test_ActivationFactories
(
void
)
{
{
HRESULT
hr
;
HRESULT
hr
;
...
@@ -65,47 +35,38 @@ static void test_ActivationFactories(void)
...
@@ -65,47 +35,38 @@ static void test_ActivationFactories(void)
IActivationFactory
*
factory
=
NULL
;
IActivationFactory
*
factory
=
NULL
;
IInspectable
*
inspect
=
NULL
;
IInspectable
*
inspect
=
NULL
;
if
(
!
pRoGetActivationFactory
||
!
pRoActivateInstance
)
hr
=
WindowsCreateString
(
L"Windows.Data.Xml.Dom.XmlDocument"
,
{
win_skip
(
"RoGetActivationFactory not available
\n
"
);
return
;
}
hr
=
pWindowsCreateString
(
L"Windows.Data.Xml.Dom.XmlDocument"
,
ARRAY_SIZE
(
L"Windows.Data.Xml.Dom.XmlDocument"
)
-
1
,
&
str
);
ARRAY_SIZE
(
L"Windows.Data.Xml.Dom.XmlDocument"
)
-
1
,
&
str
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
p
WindowsCreateString
(
L"Does.Not.Exist"
,
ARRAY_SIZE
(
L"Does.Not.Exist"
)
-
1
,
&
str2
);
hr
=
WindowsCreateString
(
L"Does.Not.Exist"
,
ARRAY_SIZE
(
L"Does.Not.Exist"
)
-
1
,
&
str2
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
p
RoInitialize
(
RO_INIT_MULTITHREADED
);
hr
=
RoInitialize
(
RO_INIT_MULTITHREADED
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
hr
=
p
RoGetActivationFactory
(
str2
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
hr
=
RoGetActivationFactory
(
str2
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
ok
(
hr
==
REGDB_E_CLASSNOTREG
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
REGDB_E_CLASSNOTREG
,
"got %08x
\n
"
,
hr
);
hr
=
p
RoGetActivationFactory
(
str
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
hr
=
RoGetActivationFactory
(
str
,
&
IID_IActivationFactory
,
(
void
**
)
&
factory
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
factory
)
if
(
factory
)
IActivationFactory_Release
(
factory
);
IActivationFactory_Release
(
factory
);
hr
=
p
RoActivateInstance
(
str2
,
&
inspect
);
hr
=
RoActivateInstance
(
str2
,
&
inspect
);
ok
(
hr
==
REGDB_E_CLASSNOTREG
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
REGDB_E_CLASSNOTREG
,
"got %08x
\n
"
,
hr
);
hr
=
p
RoActivateInstance
(
str
,
&
inspect
);
hr
=
RoActivateInstance
(
str
,
&
inspect
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
todo_wine
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
if
(
inspect
)
if
(
inspect
)
IInspectable_Release
(
inspect
);
IInspectable_Release
(
inspect
);
p
WindowsDeleteString
(
str2
);
WindowsDeleteString
(
str2
);
p
WindowsDeleteString
(
str
);
WindowsDeleteString
(
str
);
p
RoUninitialize
();
RoUninitialize
();
}
}
START_TEST
(
roapi
)
START_TEST
(
roapi
)
{
{
if
(
!
init_functions
())
return
;
test_ActivationFactories
();
test_ActivationFactories
();
}
}
dlls/combase/tests/string.c
View file @
141c182e
...
@@ -27,57 +27,6 @@
...
@@ -27,57 +27,6 @@
#include "wine/test.h"
#include "wine/test.h"
static
HRESULT
(
WINAPI
*
pWindowsCompareStringOrdinal
)(
HSTRING
,
HSTRING
,
INT32
*
);
static
HRESULT
(
WINAPI
*
pWindowsConcatString
)(
HSTRING
,
HSTRING
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsCreateString
)(
LPCWSTR
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsCreateStringReference
)(
LPCWSTR
,
UINT32
,
HSTRING_HEADER
*
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsDeleteString
)(
HSTRING
);
static
HRESULT
(
WINAPI
*
pWindowsDeleteStringBuffer
)(
HSTRING_BUFFER
);
static
HRESULT
(
WINAPI
*
pWindowsDuplicateString
)(
HSTRING
,
HSTRING
*
);
static
UINT32
(
WINAPI
*
pWindowsGetStringLen
)(
HSTRING
);
static
LPCWSTR
(
WINAPI
*
pWindowsGetStringRawBuffer
)(
HSTRING
,
UINT32
*
);
static
BOOL
(
WINAPI
*
pWindowsIsStringEmpty
)(
HSTRING
);
static
HRESULT
(
WINAPI
*
pWindowsPreallocateStringBuffer
)(
UINT32
,
WCHAR
**
,
HSTRING_BUFFER
*
);
static
HRESULT
(
WINAPI
*
pWindowsPromoteStringBuffer
)(
HSTRING_BUFFER
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsStringHasEmbeddedNull
)(
HSTRING
,
BOOL
*
);
static
HRESULT
(
WINAPI
*
pWindowsSubstring
)(
HSTRING
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsSubstringWithSpecifiedLength
)(
HSTRING
,
UINT32
,
UINT32
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsTrimStringEnd
)(
HSTRING
,
HSTRING
,
HSTRING
*
);
static
HRESULT
(
WINAPI
*
pWindowsTrimStringStart
)(
HSTRING
,
HSTRING
,
HSTRING
*
);
#define SET(x) p##x = (void*)GetProcAddress(hmod, #x)
static
BOOL
init_functions
(
void
)
{
HMODULE
hmod
=
LoadLibraryA
(
"combase.dll"
);
if
(
!
hmod
)
{
win_skip
(
"Failed to load combase.dll, skipping tests
\n
"
);
return
FALSE
;
}
SET
(
WindowsCompareStringOrdinal
);
SET
(
WindowsConcatString
);
SET
(
WindowsCreateString
);
SET
(
WindowsCreateStringReference
);
SET
(
WindowsDeleteString
);
SET
(
WindowsDeleteStringBuffer
);
SET
(
WindowsDuplicateString
);
SET
(
WindowsGetStringLen
);
SET
(
WindowsGetStringRawBuffer
);
SET
(
WindowsIsStringEmpty
);
SET
(
WindowsPreallocateStringBuffer
);
SET
(
WindowsPromoteStringBuffer
);
SET
(
WindowsStringHasEmbeddedNull
);
SET
(
WindowsSubstring
);
SET
(
WindowsSubstringWithSpecifiedLength
);
SET
(
WindowsTrimStringEnd
);
SET
(
WindowsTrimStringStart
);
return
TRUE
;
}
#undef SET
#define check_string(str, content, length, has_null) _check_string(__LINE__, str, content, length, has_null)
#define check_string(str, content, length, has_null) _check_string(__LINE__, str, content, length, has_null)
static
void
_check_string
(
int
line
,
HSTRING
str
,
LPCWSTR
content
,
UINT32
length
,
BOOL
has_null
)
static
void
_check_string
(
int
line
,
HSTRING
str
,
LPCWSTR
content
,
UINT32
length
,
BOOL
has_null
)
{
{
...
@@ -86,16 +35,16 @@ static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length,
...
@@ -86,16 +35,16 @@ static void _check_string(int line, HSTRING str, LPCWSTR content, UINT32 length,
UINT32
out_length
;
UINT32
out_length
;
LPCWSTR
ptr
;
LPCWSTR
ptr
;
ok_
(
__FILE__
,
line
)(
p
WindowsIsStringEmpty
(
str
)
==
empty
,
"WindowsIsStringEmpty failed
\n
"
);
ok_
(
__FILE__
,
line
)(
WindowsIsStringEmpty
(
str
)
==
empty
,
"WindowsIsStringEmpty failed
\n
"
);
ok_
(
__FILE__
,
line
)(
pWindowsStringHasEmbeddedNull
(
str
,
&
out_null
)
==
S_OK
,
"p
WindowsStringHasEmbeddedNull failed
\n
"
);
ok_
(
__FILE__
,
line
)(
WindowsStringHasEmbeddedNull
(
str
,
&
out_null
)
==
S_OK
,
"
WindowsStringHasEmbeddedNull failed
\n
"
);
ok_
(
__FILE__
,
line
)(
out_null
==
has_null
,
"WindowsStringHasEmbeddedNull failed
\n
"
);
ok_
(
__FILE__
,
line
)(
out_null
==
has_null
,
"WindowsStringHasEmbeddedNull failed
\n
"
);
ok_
(
__FILE__
,
line
)(
p
WindowsGetStringLen
(
str
)
==
length
,
"WindowsGetStringLen failed
\n
"
);
ok_
(
__FILE__
,
line
)(
WindowsGetStringLen
(
str
)
==
length
,
"WindowsGetStringLen failed
\n
"
);
ptr
=
p
WindowsGetStringRawBuffer
(
str
,
&
out_length
);
ptr
=
WindowsGetStringRawBuffer
(
str
,
&
out_length
);
/* WindowsGetStringRawBuffer should return a non-null, null terminated empty string
/* WindowsGetStringRawBuffer should return a non-null, null terminated empty string
* even if str is NULL. */
* even if str is NULL. */
ok_
(
__FILE__
,
line
)(
ptr
!=
NULL
,
"WindowsGetStringRawBuffer returned null
\n
"
);
ok_
(
__FILE__
,
line
)(
ptr
!=
NULL
,
"WindowsGetStringRawBuffer returned null
\n
"
);
ok_
(
__FILE__
,
line
)(
out_length
==
length
,
"WindowsGetStringRawBuffer returned incorrect length
\n
"
);
ok_
(
__FILE__
,
line
)(
out_length
==
length
,
"WindowsGetStringRawBuffer returned incorrect length
\n
"
);
ptr
=
p
WindowsGetStringRawBuffer
(
str
,
NULL
);
ptr
=
WindowsGetStringRawBuffer
(
str
,
NULL
);
ok_
(
__FILE__
,
line
)(
ptr
!=
NULL
,
"WindowsGetStringRawBuffer returned null
\n
"
);
ok_
(
__FILE__
,
line
)(
ptr
!=
NULL
,
"WindowsGetStringRawBuffer returned null
\n
"
);
ok_
(
__FILE__
,
line
)(
ptr
[
length
]
==
'\0'
,
"WindowsGetStringRawBuffer doesn't return a null terminated buffer
\n
"
);
ok_
(
__FILE__
,
line
)(
ptr
[
length
]
==
'\0'
,
"WindowsGetStringRawBuffer doesn't return a null terminated buffer
\n
"
);
ok_
(
__FILE__
,
line
)(
memcmp
(
ptr
,
content
,
sizeof
(
*
content
)
*
length
)
==
0
,
"Incorrect string content
\n
"
);
ok_
(
__FILE__
,
line
)(
memcmp
(
ptr
,
content
,
sizeof
(
*
content
)
*
length
)
==
0
,
"Incorrect string content
\n
"
);
...
@@ -113,80 +62,80 @@ static void test_create_delete(void)
...
@@ -113,80 +62,80 @@ static void test_create_delete(void)
HSTRING_HEADER
header
;
HSTRING_HEADER
header
;
/* Test normal creation of a string */
/* Test normal creation of a string */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test error handling in WindowsCreateString */
/* Test error handling in WindowsCreateString */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsCreateString
(
NULL
,
6
,
&
str
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCreateString
(
NULL
,
6
,
&
str
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
/* Test handling of a NULL string */
/* Test handling of a NULL string */
ok
(
p
WindowsDeleteString
(
NULL
)
==
S_OK
,
"Failed to delete null string
\n
"
);
ok
(
WindowsDeleteString
(
NULL
)
==
S_OK
,
"Failed to delete null string
\n
"
);
/* Test creation of a string reference */
/* Test creation of a string reference */
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test error handling in WindowsCreateStringReference */
/* Test error handling in WindowsCreateStringReference */
/* Strings to CreateStringReference must be null terminated with the correct
/* Strings to CreateStringReference must be null terminated with the correct
* length. According to MSDN this should be E_INVALIDARG, but it returns
* length. According to MSDN this should be E_INVALIDARG, but it returns
* 0x80000017 in practice. */
* 0x80000017 in practice. */
ok
(
FAILED
(
p
WindowsCreateStringReference
(
input_string
,
5
,
&
header
,
&
str
)),
"Incorrect error handling
\n
"
);
ok
(
FAILED
(
WindowsCreateStringReference
(
input_string
,
5
,
&
header
,
&
str
)),
"Incorrect error handling
\n
"
);
/* If the input string is non-null, it must be null-terminated even if the
/* If the input string is non-null, it must be null-terminated even if the
* length is zero. */
* length is zero. */
ok
(
FAILED
(
p
WindowsCreateStringReference
(
input_string
,
0
,
&
header
,
&
str
)),
"Incorrect error handling
\n
"
);
ok
(
FAILED
(
WindowsCreateStringReference
(
input_string
,
0
,
&
header
,
&
str
)),
"Incorrect error handling
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
NULL
,
&
str
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
NULL
,
&
str
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsCreateStringReference
(
NULL
,
6
,
&
header
,
&
str
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCreateStringReference
(
NULL
,
6
,
&
header
,
&
str
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
/* Test creating a string without a null-termination at the specified length */
/* Test creating a string without a null-termination at the specified length */
ok
(
p
WindowsCreateString
(
input_string
,
3
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
3
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
check_string
(
str
,
input_string
,
3
,
FALSE
);
check_string
(
str
,
input_string
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test an empty string */
/* Test an empty string */
ok
(
p
WindowsCreateString
(
L""
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
L""
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateString
(
input_string
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateStringReference
(
L""
,
0
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateStringReference
(
L""
,
0
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateString
(
NULL
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
NULL
,
0
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateStringReference
(
NULL
,
0
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateStringReference
(
NULL
,
0
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string not a null string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
}
}
static
void
test_duplicate
(
void
)
static
void
test_duplicate
(
void
)
{
{
HSTRING
str
,
str2
;
HSTRING
str
,
str2
;
HSTRING_HEADER
header
;
HSTRING_HEADER
header
;
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsDuplicateString
(
str
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsDuplicateString
(
str
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsDuplicateString
(
str
,
&
str2
)
==
S_OK
,
"Failed to duplicate string
\n
"
);
ok
(
WindowsDuplicateString
(
str
,
&
str2
)
==
S_OK
,
"Failed to duplicate string
\n
"
);
ok
(
str
==
str2
,
"Duplicated string created new string
\n
"
);
ok
(
str
==
str2
,
"Duplicated string created new string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsDuplicateString
(
str
,
&
str2
)
==
S_OK
,
"Failed to duplicate string
\n
"
);
ok
(
WindowsDuplicateString
(
str
,
&
str2
)
==
S_OK
,
"Failed to duplicate string
\n
"
);
ok
(
str
!=
str2
,
"Duplicated string ref didn't create new string
\n
"
);
ok
(
str
!=
str2
,
"Duplicated string ref didn't create new string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
p
WindowsDuplicateString
(
NULL
,
&
str2
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
WindowsDuplicateString
(
NULL
,
&
str2
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
str2
==
NULL
,
"Duplicated string created new string
\n
"
);
ok
(
str2
==
NULL
,
"Duplicated string created new string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
}
}
static
void
test_access
(
void
)
static
void
test_access
(
void
)
...
@@ -198,22 +147,22 @@ static void test_access(void)
...
@@ -198,22 +147,22 @@ static void test_access(void)
check_string
(
NULL
,
NULL
,
0
,
FALSE
);
check_string
(
NULL
,
NULL
,
0
,
FALSE
);
/* Test strings with embedded null chars */
/* Test strings with embedded null chars */
ok
(
p
WindowsCreateString
(
input_embed_null
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_embed_null
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
check_string
(
str
,
input_embed_null
,
6
,
TRUE
);
check_string
(
str
,
input_embed_null
,
6
,
TRUE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_embed_null
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_embed_null
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
check_string
(
str
,
input_embed_null
,
6
,
TRUE
);
check_string
(
str
,
input_embed_null
,
6
,
TRUE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test normal creation of a string with trailing null */
/* Test normal creation of a string with trailing null */
ok
(
p
WindowsCreateString
(
input_string
,
7
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
7
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string
,
7
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
7
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
}
}
static
void
test_string_buffer
(
void
)
static
void
test_string_buffer
(
void
)
...
@@ -225,43 +174,43 @@ static void test_string_buffer(void)
...
@@ -225,43 +174,43 @@ static void test_string_buffer(void)
HSTRING
str
;
HSTRING
str
;
/* Test creation of an empty buffer */
/* Test creation of an empty buffer */
ok
(
p
WindowsPreallocateStringBuffer
(
0
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
0
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
ptr
!=
NULL
,
"Empty string didn't return a buffer pointer
\n
"
);
ok
(
ptr
!=
NULL
,
"Empty string didn't return a buffer pointer
\n
"
);
ok
(
p
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
ok
(
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
ok
(
str
==
NULL
,
"Empty string isn't a null string
\n
"
);
ok
(
str
==
NULL
,
"Empty string isn't a null string
\n
"
);
check_string
(
str
,
L""
,
0
,
FALSE
);
check_string
(
str
,
L""
,
0
,
FALSE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteStringBuffer
(
NULL
)
==
S_OK
,
"Failed to delete null string buffer
\n
"
);
ok
(
WindowsDeleteStringBuffer
(
NULL
)
==
S_OK
,
"Failed to delete null string buffer
\n
"
);
/* Test creation and deletion of string buffers */
/* Test creation and deletion of string buffers */
ok
(
p
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
p
WindowsDeleteStringBuffer
(
buf
)
==
S_OK
,
"Failed to delete string buffer
\n
"
);
ok
(
WindowsDeleteStringBuffer
(
buf
)
==
S_OK
,
"Failed to delete string buffer
\n
"
);
/* Test creation and promotion of string buffers */
/* Test creation and promotion of string buffers */
ok
(
p
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
ptr
[
6
]
==
'\0'
,
"Preallocated string buffer didn't have null termination
\n
"
);
ok
(
ptr
[
6
]
==
'\0'
,
"Preallocated string buffer didn't have null termination
\n
"
);
memcpy
(
ptr
,
input_string
,
6
*
sizeof
(
*
input_string
));
memcpy
(
ptr
,
input_string
,
6
*
sizeof
(
*
input_string
));
ok
(
p
WindowsPromoteStringBuffer
(
buf
,
NULL
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
WindowsPromoteStringBuffer
(
buf
,
NULL
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
ok
(
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
check_string
(
str
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test error handling in preallocation */
/* Test error handling in preallocation */
ok
(
p
WindowsPreallocateStringBuffer
(
6
,
NULL
,
&
buf
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
6
,
NULL
,
&
buf
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
NULL
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
NULL
)
==
E_POINTER
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
6
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ptr
[
6
]
=
'a'
;
/* Overwrite the buffer's null termination, promotion should fail */
ptr
[
6
]
=
'a'
;
/* Overwrite the buffer's null termination, promotion should fail */
ok
(
p
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsDeleteStringBuffer
(
buf
)
==
S_OK
,
"Failed to delete string buffer
\n
"
);
ok
(
WindowsDeleteStringBuffer
(
buf
)
==
S_OK
,
"Failed to delete string buffer
\n
"
);
/* Test strings with trailing null chars */
/* Test strings with trailing null chars */
ok
(
p
WindowsPreallocateStringBuffer
(
7
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
ok
(
WindowsPreallocateStringBuffer
(
7
,
&
ptr
,
&
buf
)
==
S_OK
,
"Failed to preallocate string buffer
\n
"
);
memcpy
(
ptr
,
input_string
,
7
*
sizeof
(
*
input_string
));
memcpy
(
ptr
,
input_string
,
7
*
sizeof
(
*
input_string
));
ok
(
p
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
ok
(
WindowsPromoteStringBuffer
(
buf
,
&
str
)
==
S_OK
,
"Failed to promote string buffer
\n
"
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
check_string
(
str
,
input_string
,
7
,
TRUE
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
}
}
static
void
test_substring
(
void
)
static
void
test_substring
(
void
)
...
@@ -270,76 +219,76 @@ static void test_substring(void)
...
@@ -270,76 +219,76 @@ static void test_substring(void)
HSTRING_HEADER
header
;
HSTRING_HEADER
header
;
/* Test substring of string buffers */
/* Test substring of string buffers */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test duplication of string using substring */
/* Test duplication of string using substring */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstring
(
str
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test substring of string reference */
/* Test substring of string reference */
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
WindowsSubstring
(
str
,
2
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
check_string
(
substr
,
output_substring
,
4
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
2
,
3
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
check_string
(
substr
,
output_substring
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test duplication of string reference using substring */
/* Test duplication of string reference using substring */
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header
,
&
str
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
WindowsSubstring
(
str
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
0
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring of string ref
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
ok
(
str
!=
substr
,
"Duplicated string ref didn't create new string
\n
"
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
check_string
(
substr
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
substr
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test get substring of empty string */
/* Test get substring of empty string */
ok
(
p
WindowsSubstring
(
NULL
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
WindowsSubstring
(
NULL
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
NULL
,
0
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
NULL
,
0
,
0
,
&
substr
)
==
S_OK
,
"Failed to duplicate NULL string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
/* Test get empty substring of string */
/* Test get empty substring of string */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstring
(
str
,
6
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
6
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
6
,
0
,
&
substr
)
==
S_OK
,
"Failed to create substring
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
substr
==
NULL
,
"Substring created new string
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test handling of using too high start index or length */
/* Test handling of using too high start index or length */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
7
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstring
(
str
,
7
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
6
,
1
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
6
,
1
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
~
0U
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
~
0U
,
&
substr
)
==
E_BOUNDS
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test handling of a NULL string */
/* Test handling of a NULL string */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsSubstring
(
str
,
7
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstring
(
str
,
7
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsSubstringWithSpecifiedLength
(
str
,
7
,
0
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str
)
==
S_OK
,
"Failed to delete string
\n
"
);
}
}
static
void
test_concat
(
void
)
static
void
test_concat
(
void
)
...
@@ -348,53 +297,53 @@ static void test_concat(void)
...
@@ -348,53 +297,53 @@ static void test_concat(void)
HSTRING_HEADER
header1
,
header2
;
HSTRING_HEADER
header1
,
header2
;
/* Test concatenation of string buffers */
/* Test concatenation of string buffers */
ok
(
p
WindowsCreateString
(
input_string1
,
3
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string1
,
3
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsConcatString
(
str1
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
str1
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
str1
==
concat
,
"Concatenate created new string
\n
"
);
ok
(
str1
==
concat
,
"Concatenate created new string
\n
"
);
check_string
(
concat
,
input_string1
,
3
,
FALSE
);
check_string
(
concat
,
input_string1
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsConcatString
(
NULL
,
str2
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsConcatString
(
NULL
,
str2
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsConcatString
(
NULL
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
NULL
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
str2
==
concat
,
"Concatenate created new string
\n
"
);
ok
(
str2
==
concat
,
"Concatenate created new string
\n
"
);
check_string
(
concat
,
input_string2
,
3
,
FALSE
);
check_string
(
concat
,
input_string2
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
str2
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsConcatString
(
str1
,
str2
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
str1
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
check_string
(
concat
,
input_string
,
6
,
FALSE
);
check_string
(
concat
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test concatenation of string references */
/* Test concatenation of string references */
ok
(
p
WindowsCreateStringReference
(
input_string1
,
3
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string1
,
3
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
str1
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
str1
!=
concat
,
"Concatenate string ref didn't create new string
\n
"
);
ok
(
str1
!=
concat
,
"Concatenate string ref didn't create new string
\n
"
);
check_string
(
concat
,
input_string1
,
3
,
FALSE
);
check_string
(
concat
,
input_string1
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsConcatString
(
NULL
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
NULL
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
str2
!=
concat
,
"Concatenate string ref didn't create new string
\n
"
);
ok
(
str2
!=
concat
,
"Concatenate string ref didn't create new string
\n
"
);
check_string
(
concat
,
input_string2
,
3
,
FALSE
);
check_string
(
concat
,
input_string2
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsConcatString
(
str1
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
str1
,
str2
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
check_string
(
concat
,
input_string
,
6
,
FALSE
);
check_string
(
concat
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
concat
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test concatenation of two empty strings */
/* Test concatenation of two empty strings */
ok
(
p
WindowsConcatString
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsConcatString
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsConcatString
(
NULL
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
WindowsConcatString
(
NULL
,
NULL
,
&
concat
)
==
S_OK
,
"Failed to concatenate string
\n
"
);
ok
(
concat
==
NULL
,
"Concatenate created new string
\n
"
);
ok
(
concat
==
NULL
,
"Concatenate created new string
\n
"
);
}
}
...
@@ -405,56 +354,56 @@ static void test_compare(void)
...
@@ -405,56 +354,56 @@ static void test_compare(void)
INT32
res
;
INT32
res
;
/* Test comparison of string buffers */
/* Test comparison of string buffers */
ok
(
p
WindowsCreateString
(
input_string1
,
3
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string1
,
3
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test comparison of string references */
/* Test comparison of string references */
ok
(
p
WindowsCreateStringReference
(
input_string1
,
3
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string1
,
3
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str1
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
str1
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
str2
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
res
==
1
,
"Expected 1, got %d
\n
"
,
res
);
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
str2
,
&
res
)
==
S_OK
,
"Failed to compare string
\n
"
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
res
==
-
1
,
"Expected -1, got %d
\n
"
,
res
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test comparison of two empty strings */
/* Test comparison of two empty strings */
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsCompareStringOrdinal
(
NULL
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare NULL string
\n
"
);
ok
(
WindowsCompareStringOrdinal
(
NULL
,
NULL
,
&
res
)
==
S_OK
,
"Failed to compare NULL string
\n
"
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
ok
(
res
==
0
,
"Expected 0, got %d
\n
"
,
res
);
}
}
...
@@ -464,76 +413,74 @@ static void test_trim(void)
...
@@ -464,76 +413,74 @@ static void test_trim(void)
HSTRING_HEADER
header1
,
header2
;
HSTRING_HEADER
header1
,
header2
;
/* Test trimming of string buffers */
/* Test trimming of string buffers */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsCreateString
(
input_string1
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string1
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
check_string
(
trimmed
,
input_string2
,
3
,
FALSE
);
check_string
(
trimmed
,
input_string2
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
trimmed
==
str1
,
"Trimmed string created new string
\n
"
);
ok
(
trimmed
==
str1
,
"Trimmed string created new string
\n
"
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string2
,
3
,
&
str2
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
trimmed
==
str1
,
"Trimmed string created new string
\n
"
);
ok
(
trimmed
==
str1
,
"Trimmed string created new string
\n
"
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
check_string
(
trimmed
,
input_string1
,
3
,
FALSE
);
check_string
(
trimmed
,
input_string1
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
/* Test trimming of string references */
/* Test trimming of string references */
ok
(
p
WindowsCreateStringReference
(
input_string
,
6
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string
,
6
,
&
header1
,
&
str1
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string1
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string1
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
check_string
(
trimmed
,
input_string2
,
3
,
FALSE
);
check_string
(
trimmed
,
input_string2
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
trimmed
!=
str1
,
"Trimmed string ref didn't create new string
\n
"
);
ok
(
trimmed
!=
str1
,
"Trimmed string ref didn't create new string
\n
"
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
p
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
WindowsCreateStringReference
(
input_string2
,
3
,
&
header2
,
&
str2
)
==
S_OK
,
"Failed to create string ref
\n
"
);
ok
(
p
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringStart
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
trimmed
!=
str1
,
"Trimmed string ref didn't create new string
\n
"
);
ok
(
trimmed
!=
str1
,
"Trimmed string ref didn't create new string
\n
"
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
check_string
(
trimmed
,
input_string
,
6
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
ok
(
WindowsTrimStringEnd
(
str1
,
str2
,
&
trimmed
)
==
S_OK
,
"Failed to trim string
\n
"
);
check_string
(
trimmed
,
input_string1
,
3
,
FALSE
);
check_string
(
trimmed
,
input_string1
,
3
,
FALSE
);
ok
(
p
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
trimmed
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
p
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str2
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string ref
\n
"
);
/* Test handling of NULL strings */
/* Test handling of NULL strings */
ok
(
p
WindowsCreateString
(
input_string
,
6
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
WindowsCreateString
(
input_string
,
6
,
&
str1
)
==
S_OK
,
"Failed to create string
\n
"
);
ok
(
p
WindowsTrimStringStart
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringStart
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringStart
(
NULL
,
str1
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringStart
(
NULL
,
str1
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringStart
(
NULL
,
NULL
,
&
trimmed
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringStart
(
NULL
,
NULL
,
&
trimmed
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringStart
(
NULL
,
str1
,
&
trimmed
)
==
S_OK
,
"Failed to trim empty string
\n
"
);
ok
(
WindowsTrimStringStart
(
NULL
,
str1
,
&
trimmed
)
==
S_OK
,
"Failed to trim empty string
\n
"
);
ok
(
trimmed
==
NULL
,
"Trimming created new string
\n
"
);
ok
(
trimmed
==
NULL
,
"Trimming created new string
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringEnd
(
NULL
,
NULL
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
NULL
,
str1
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringEnd
(
NULL
,
str1
,
NULL
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
NULL
,
NULL
,
&
trimmed
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
WindowsTrimStringEnd
(
NULL
,
NULL
,
&
trimmed
)
==
E_INVALIDARG
,
"Incorrect error handling
\n
"
);
ok
(
p
WindowsTrimStringEnd
(
NULL
,
str1
,
&
trimmed
)
==
S_OK
,
"Failed to trim empty string
\n
"
);
ok
(
WindowsTrimStringEnd
(
NULL
,
str1
,
&
trimmed
)
==
S_OK
,
"Failed to trim empty string
\n
"
);
ok
(
trimmed
==
NULL
,
"Trimming created new string
\n
"
);
ok
(
trimmed
==
NULL
,
"Trimming created new string
\n
"
);
ok
(
p
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
ok
(
WindowsDeleteString
(
str1
)
==
S_OK
,
"Failed to delete string
\n
"
);
}
}
START_TEST
(
string
)
START_TEST
(
string
)
{
{
if
(
!
init_functions
())
return
;
test_create_delete
();
test_create_delete
();
test_duplicate
();
test_duplicate
();
test_access
();
test_access
();
...
...
include/roapi.h
View file @
141c182e
...
@@ -42,6 +42,8 @@ typedef HRESULT (WINAPI *PFNGETACTIVATIONFACTORY)(HSTRING, IActivationFactory **
...
@@ -42,6 +42,8 @@ typedef HRESULT (WINAPI *PFNGETACTIVATIONFACTORY)(HSTRING, IActivationFactory **
extern
"C"
{
extern
"C"
{
#endif
#endif
HRESULT
WINAPI
RoActivateInstance
(
HSTRING
classid
,
IInspectable
**
instance
);
HRESULT
WINAPI
RoGetActivationFactory
(
HSTRING
classid
,
REFIID
iid
,
void
**
class_factory
);
HRESULT
WINAPI
RoInitialize
(
RO_INIT_TYPE
type
);
HRESULT
WINAPI
RoInitialize
(
RO_INIT_TYPE
type
);
void
WINAPI
RoUninitialize
(
void
);
void
WINAPI
RoUninitialize
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment