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
fc4a9e2e
Commit
fc4a9e2e
authored
Dec 22, 2009
by
Andrew Eikum
Committed by
Alexandre Julliard
Dec 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hlink: Add tests and fix error handling in IHlink::{Get, Set}StringReference.
parent
7fa3778d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
3 deletions
+113
-3
link.c
dlls/hlink/link.c
+18
-3
hlink.c
dlls/hlink/tests/hlink.c
+95
-0
No files found.
dlls/hlink/link.c
View file @
fc4a9e2e
...
...
@@ -245,6 +245,10 @@ static HRESULT WINAPI IHlink_fnSetStringReference(IHlink* iface,
TRACE
(
"(%p)->(%i %s %s)
\n
"
,
This
,
grfHLSETF
,
debugstr_w
(
pwzTarget
),
debugstr_w
(
pwzLocation
));
if
(
grfHLSETF
>
(
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
)
&&
grfHLSETF
<
-
(
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
))
return
grfHLSETF
;
if
(
grfHLSETF
&
HLINKSETF_TARGET
)
{
heap_free
(
This
->
Target
);
...
...
@@ -281,7 +285,20 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
{
HlinkImpl
*
This
=
(
HlinkImpl
*
)
iface
;
FIXME
(
"(%p) -> (%i %p %p)
\n
"
,
This
,
dwWhichRef
,
ppwzTarget
,
ppwzLocation
);
TRACE
(
"(%p) -> (%i %p %p)
\n
"
,
This
,
dwWhichRef
,
ppwzTarget
,
ppwzLocation
);
/* note: undocumented behavior with dwWhichRef == -1 */
if
(
dwWhichRef
!=
-
1
&&
dwWhichRef
&
~
(
HLINKGETREF_DEFAULT
|
HLINKGETREF_ABSOLUTE
|
HLINKGETREF_RELATIVE
))
{
if
(
ppwzTarget
)
*
ppwzTarget
=
NULL
;
if
(
ppwzLocation
)
*
ppwzLocation
=
NULL
;
return
E_INVALIDARG
;
}
if
(
dwWhichRef
!=
HLINKGETREF_DEFAULT
)
FIXME
(
"unhandled flags: 0x%x
\n
"
,
dwWhichRef
);
if
(
ppwzTarget
)
{
...
...
@@ -300,8 +317,6 @@ static HRESULT WINAPI IHlink_fnGetStringReference (IHlink* iface,
IBindCtx_Release
(
pbc
);
IMoniker_Release
(
mon
);
}
else
FIXME
(
"Unhandled case, no set Target and no moniker
\n
"
);
}
}
if
(
ppwzLocation
)
...
...
dlls/hlink/tests/hlink.c
View file @
fc4a9e2e
...
...
@@ -1121,6 +1121,100 @@ static void test_HlinkGetSetMonikerReference(void)
IMoniker_Release
(
dummy
);
}
static
void
test_HlinkGetSetStringReference
(
void
)
{
IHlink
*
link
;
static
const
WCHAR
one
[]
=
{
'1'
,
0
};
static
const
WCHAR
two
[]
=
{
'2'
,
0
};
static
const
WCHAR
three
[]
=
{
'3'
,
0
};
static
const
WCHAR
empty
[]
=
{
0
};
WCHAR
*
fnd_tgt
,
*
fnd_loc
;
HRESULT
hres
;
/* create a new hlink: target => NULL, location => one */
hres
=
HlinkCreateFromMoniker
(
NULL
,
one
,
empty
,
NULL
,
0
,
NULL
,
&
IID_IHlink
,
(
void
**
)
&
link
);
ok
(
hres
==
S_OK
,
"HlinkCreateFromMoniker failed: 0x%08x
\n
"
,
hres
);
/* test setting/getting location */
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
fnd_tgt
==
NULL
,
"Found target should have been NULL, was: %s
\n
"
,
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
one
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
one
),
wine_dbgstr_w
(
fnd_loc
));
hres
=
IHlink_SetStringReference
(
link
,
HLINKSETF_LOCATION
,
one
,
two
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
fnd_tgt
==
NULL
,
"Found target should have been NULL, was: %s
\n
"
,
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
two
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
two
),
wine_dbgstr_w
(
fnd_loc
));
hres
=
IHlink_SetStringReference
(
link
,
-
HLINKSETF_LOCATION
,
two
,
one
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
fnd_tgt
==
NULL
,
"Found target should have been NULL, was: %s
\n
"
,
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
one
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
one
),
wine_dbgstr_w
(
fnd_loc
));
/* test setting/getting target */
hres
=
IHlink_SetStringReference
(
link
,
HLINKSETF_TARGET
,
two
,
three
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
!
lstrcmpW
(
fnd_tgt
,
two
),
"Found target should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
two
),
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
one
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
one
),
wine_dbgstr_w
(
fnd_loc
));
hres
=
IHlink_SetStringReference
(
link
,
-
HLINKSETF_TARGET
,
three
,
two
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
!
lstrcmpW
(
fnd_tgt
,
three
),
"Found target should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
three
),
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
two
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
two
),
wine_dbgstr_w
(
fnd_loc
));
/* test setting/getting both */
hres
=
IHlink_SetStringReference
(
link
,
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
,
one
,
two
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
!
lstrcmpW
(
fnd_tgt
,
one
),
"Found target should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
one
),
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
two
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
two
),
wine_dbgstr_w
(
fnd_loc
));
hres
=
IHlink_SetStringReference
(
link
,
-
(
HLINKSETF_TARGET
|
HLINKSETF_LOCATION
),
three
,
one
);
ok
(
hres
==
S_OK
,
"IHlink_SetStringReference failed: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
HLINKGETREF_DEFAULT
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
S_OK
,
"IHlink_GetStringReference failed: 0x%08x
\n
"
,
hres
);
ok
(
!
lstrcmpW
(
fnd_tgt
,
three
),
"Found target should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
three
),
wine_dbgstr_w
(
fnd_tgt
));
ok
(
!
lstrcmpW
(
fnd_loc
,
two
),
"Found location should have been %s, was: %s
\n
"
,
wine_dbgstr_w
(
two
),
wine_dbgstr_w
(
fnd_loc
));
/* test invalid flags/params */
hres
=
IHlink_GetStringReference
(
link
,
4
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
E_INVALIDARG
,
"IHlink_GetStringReference should have failed "
"with E_INVALIDARG (0x%08x), instead: 0x%08x
\n
"
,
E_INVALIDARG
,
hres
);
ok
(
fnd_tgt
==
NULL
,
"Found target should have been NULL, was: %s
\n
"
,
wine_dbgstr_w
(
fnd_tgt
));
ok
(
fnd_loc
==
NULL
,
"Found location should have been NULL, was: %s
\n
"
,
wine_dbgstr_w
(
fnd_loc
));
hres
=
IHlink_GetStringReference
(
link
,
-
1
,
&
fnd_tgt
,
&
fnd_loc
);
todo_wine
ok
(
hres
==
E_FAIL
,
"IHlink_GetStringReference should have failed "
"with E_FAIL (0x%08x), instead: 0x%08x
\n
"
,
E_FAIL
,
hres
);
hres
=
IHlink_GetStringReference
(
link
,
-
2
,
&
fnd_tgt
,
&
fnd_loc
);
ok
(
hres
==
E_INVALIDARG
,
"IHlink_GetStringReference should have failed "
"with E_INVALIDARG (0x%08x), instead: 0x%08x
\n
"
,
E_INVALIDARG
,
hres
);
hres
=
IHlink_SetStringReference
(
link
,
4
,
NULL
,
NULL
);
ok
(
hres
==
4
,
"IHlink_SetStringReference should have failed with 0x4, instead: 0x%08x
\n
"
,
hres
);
hres
=
IHlink_SetStringReference
(
link
,
-
4
,
NULL
,
NULL
);
ok
(
hres
==
-
4
,
"IHlink_SetStringReference should have failed with 0xFFFFFFFC, instead: 0x%08x
\n
"
,
hres
);
IHlink_Release
(
link
);
}
START_TEST
(
hlink
)
{
CoInitialize
(
NULL
);
...
...
@@ -1133,6 +1227,7 @@ START_TEST(hlink)
test_HlinkParseDisplayName
();
test_HlinkResolveMonikerForData
();
test_HlinkGetSetMonikerReference
();
test_HlinkGetSetStringReference
();
CoUninitialize
();
}
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