Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
03ecb16e
Commit
03ecb16e
authored
Feb 10, 2004
by
Jon Griffiths
Committed by
Alexandre Julliard
Feb 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test StrRetToBSTR.
parent
d015d3b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
Makefile.in
dlls/shlwapi/tests/Makefile.in
+1
-1
string.c
dlls/shlwapi/tests/string.c
+57
-0
No files found.
dlls/shlwapi/tests/Makefile.in
View file @
03ecb16e
...
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
shlwapi.dll
IMPORTS
=
shlwapi advapi32
IMPORTS
=
shlwapi advapi32
ole32 oleaut32
CTESTS
=
\
clist.c
\
...
...
dlls/shlwapi/tests/string.c
View file @
03ecb16e
...
...
@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <stdio.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "wine/test.h"
#include "winbase.h"
#include "winerror.h"
...
...
@@ -29,6 +31,13 @@
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
#include "shtypes.h"
static
inline
int
strcmpW
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
{
while
(
*
str1
&&
(
*
str1
==
*
str2
))
{
str1
++
;
str2
++
;
}
return
*
str1
-
*
str2
;
}
/* StrToInt/StrToIntEx results */
typedef
struct
tagStrToIntResult
...
...
@@ -537,8 +546,55 @@ void test_StrFromTimeIntervalA(void)
}
}
static
WCHAR
*
CoDupStrW
(
const
char
*
src
)
{
INT
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
NULL
,
0
);
WCHAR
*
szTemp
=
(
WCHAR
*
)
CoTaskMemAlloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
szTemp
,
len
);
return
szTemp
;
}
static
void
test_StrRetToBSTR
(
void
)
{
static
const
WCHAR
szTestW
[]
=
{
'T'
,
'e'
,
's'
,
't'
,
'\0'
};
ITEMIDLIST
iidl
[
10
];
BSTR
bstr
;
STRRET
strret
;
HRESULT
ret
;
strret
.
uType
=
STRRET_WSTR
;
strret
.
u
.
pOleStr
=
CoDupStrW
(
"Test"
);
bstr
=
0
;
ret
=
StrRetToBSTR
(
&
strret
,
NULL
,
&
bstr
);
ok
(
ret
==
S_OK
&&
bstr
&&
!
strcmpW
(
bstr
,
szTestW
),
"STRRET_WSTR: dup failed, ret=0x%08lx, bstr %p
\n
"
,
ret
,
bstr
);
if
(
bstr
)
SysFreeString
(
bstr
);
strret
.
uType
=
STRRET_CSTR
;
lstrcpyA
(
strret
.
u
.
cStr
,
"Test"
);
ret
=
StrRetToBSTR
(
&
strret
,
NULL
,
&
bstr
);
ok
(
ret
==
S_OK
&&
bstr
&&
!
strcmpW
(
bstr
,
szTestW
),
"STRRET_CSTR: dup failed, ret=0x%08lx, bstr %p
\n
"
,
ret
,
bstr
);
if
(
bstr
)
SysFreeString
(
bstr
);
strret
.
uType
=
STRRET_OFFSET
;
strret
.
u
.
uOffset
=
1
;
strcpy
((
char
*
)
&
iidl
,
" Test"
);
ret
=
StrRetToBSTR
(
&
strret
,
iidl
,
&
bstr
);
ok
(
ret
==
S_OK
&&
bstr
&&
!
strcmpW
(
bstr
,
szTestW
),
"STRRET_OFFSET: dup failed, ret=0x%08lx, bstr %p
\n
"
,
ret
,
bstr
);
if
(
bstr
)
SysFreeString
(
bstr
);
/* Native crashes if str is NULL */
}
START_TEST
(
string
)
{
CoInitialize
(
0
);
test_StrChrA
();
test_StrChrW
();
test_StrChrIA
();
...
...
@@ -555,4 +611,5 @@ START_TEST(string)
test_StrFormatKBSizeA
();
test_StrFormatKBSizeW
();
test_StrFromTimeIntervalA
();
test_StrRetToBSTR
();
}
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