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
d53b711f
Commit
d53b711f
authored
Aug 17, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
netprofm: Added semi-stub Advise and Unadvise implementation.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9d32c2d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
5 deletions
+121
-5
list.c
dlls/netprofm/list.c
+49
-5
list.c
dlls/netprofm/tests/list.c
+72
-0
No files found.
dlls/netprofm/list.c
View file @
d53b711f
...
...
@@ -91,6 +91,15 @@ struct connection_point
IConnectionPointContainer
*
container
;
LONG
refs
;
IID
iid
;
struct
list
sinks
;
DWORD
cookie
;
};
struct
sink_entry
{
struct
list
entry
;
DWORD
cookie
;
IUnknown
*
unk
;
};
static
inline
struct
list_manager
*
impl_from_IConnectionPointContainer
(
IConnectionPointContainer
*
iface
)
...
...
@@ -189,12 +198,33 @@ static HRESULT WINAPI connection_point_Advise(
DWORD
*
cookie
)
{
struct
connection_point
*
cp
=
impl_from_IConnectionPoint
(
iface
);
FIXME
(
"%p, %p, %p - stub
\n
"
,
cp
,
sink
,
cookie
);
struct
sink_entry
*
sink_entry
;
IUnknown
*
unk
;
HRESULT
hr
;
FIXME
(
"%p, %p, %p - semi-stub
\n
"
,
cp
,
sink
,
cookie
);
if
(
!
sink
||
!
cookie
)
return
E_POINTER
;
return
CONNECT_E_CANNOTCONNECT
;
hr
=
IUnknown_QueryInterface
(
sink
,
&
cp
->
iid
,
(
void
**
)
&
unk
);
if
(
FAILED
(
hr
))
{
WARN
(
"iface %s not implemented by sink
\n
"
,
debugstr_guid
(
&
cp
->
iid
)
);
return
CO_E_FAILEDTOOPENTHREADTOKEN
;
}
sink_entry
=
heap_alloc
(
sizeof
(
*
sink_entry
)
);
if
(
!
sink_entry
)
{
IUnknown_Release
(
unk
);
return
E_OUTOFMEMORY
;
}
sink_entry
->
unk
=
unk
;
*
cookie
=
sink_entry
->
cookie
=
++
cp
->
cookie
;
list_add_tail
(
&
cp
->
sinks
,
&
sink_entry
->
entry
);
return
S_OK
;
}
static
HRESULT
WINAPI
connection_point_Unadvise
(
...
...
@@ -202,9 +232,21 @@ static HRESULT WINAPI connection_point_Unadvise(
DWORD
cookie
)
{
struct
connection_point
*
cp
=
impl_from_IConnectionPoint
(
iface
);
FIXME
(
"%p, %d - stub
\n
"
,
cp
,
cookie
);
struct
sink_entry
*
iter
;
TRACE
(
"%p, %d
\n
"
,
cp
,
cookie
);
LIST_FOR_EACH_ENTRY
(
iter
,
&
cp
->
sinks
,
struct
sink_entry
,
entry
)
{
if
(
iter
->
cookie
!=
cookie
)
continue
;
list_remove
(
&
iter
->
entry
);
IUnknown_Release
(
iter
->
unk
);
heap_free
(
iter
);
return
S_OK
;
}
return
E_POINTER
;
WARN
(
"invalid cookie
\n
"
);
return
OLE_E_NOCONNECTION
;
}
static
HRESULT
WINAPI
connection_point_EnumConnections
(
...
...
@@ -241,8 +283,10 @@ static HRESULT connection_point_create(
cp
->
IConnectionPoint_iface
.
lpVtbl
=
&
connection_point_vtbl
;
cp
->
container
=
container
;
cp
->
refs
=
1
;
cp
->
cookie
=
0
;
cp
->
iid
=
*
riid
;
list_init
(
&
cp
->
sinks
);
memcpy
(
&
cp
->
iid
,
riid
,
sizeof
(
*
riid
)
);
IConnectionPointContainer_AddRef
(
container
);
*
obj
=
&
cp
->
IConnectionPoint_iface
;
...
...
dlls/netprofm/tests/list.c
View file @
d53b711f
...
...
@@ -157,6 +157,64 @@ static void test_INetworkConnection( INetworkConnection *conn )
}
}
static
HRESULT
WINAPI
Unknown_QueryInterface
(
INetworkListManagerEvents
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
))
{
*
ppv
=
iface
;
return
S_OK
;
}
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
static
HRESULT
WINAPI
NetworkListManagerEvents_QueryInterface
(
INetworkListManagerEvents
*
iface
,
REFIID
riid
,
void
**
ppv
)
{
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_INetworkListManagerEvents
))
{
*
ppv
=
iface
;
return
S_OK
;
}
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
NetworkListManagerEvents_AddRef
(
INetworkListManagerEvents
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
NetworkListManagerEvents_Release
(
INetworkListManagerEvents
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
NetworkListManagerEvents_ConnectivityChanged
(
INetworkListManagerEvents
*
iface
,
NLM_CONNECTIVITY
newConnectivity
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
const
INetworkListManagerEventsVtbl
mgr_sink_vtbl
=
{
NetworkListManagerEvents_QueryInterface
,
NetworkListManagerEvents_AddRef
,
NetworkListManagerEvents_Release
,
NetworkListManagerEvents_ConnectivityChanged
};
static
INetworkListManagerEvents
mgr_sink
=
{
&
mgr_sink_vtbl
};
static
const
INetworkListManagerEventsVtbl
mgr_sink_unk_vtbl
=
{
Unknown_QueryInterface
,
NetworkListManagerEvents_AddRef
,
NetworkListManagerEvents_Release
,
NetworkListManagerEvents_ConnectivityChanged
};
static
INetworkListManagerEvents
mgr_sink_unk
=
{
&
mgr_sink_unk_vtbl
};
static
void
test_INetworkListManager
(
void
)
{
IConnectionPointContainer
*
cpc
,
*
cpc2
;
...
...
@@ -169,6 +227,7 @@ static void test_INetworkListManager( void )
INetwork
*
network
;
IEnumNetworkConnections
*
conn_iter
;
INetworkConnection
*
conn
;
DWORD
cookie
;
HRESULT
hr
;
ULONG
ref1
,
ref2
;
IID
iid
;
...
...
@@ -247,6 +306,19 @@ static void test_INetworkListManager( void )
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
memcmp
(
&
iid
,
&
IID_INetworkListManagerEvents
,
sizeof
(
iid
)
),
"Expected iid to be IID_INetworkListManagerEvents
\n
"
);
hr
=
IConnectionPoint_Advise
(
pt
,
(
IUnknown
*
)
&
mgr_sink_unk
,
&
cookie
);
ok
(
hr
==
CO_E_FAILEDTOOPENTHREADTOKEN
,
"Advise failed: %08x
\n
"
,
hr
);
hr
=
IConnectionPoint_Advise
(
pt
,
(
IUnknown
*
)
&
mgr_sink
,
&
cookie
);
ok
(
hr
==
S_OK
,
"Advise failed: %08x
\n
"
,
hr
);
hr
=
IConnectionPoint_Unadvise
(
pt
,
0xdeadbeef
);
ok
(
hr
==
OLE_E_NOCONNECTION
||
hr
==
CO_E_FAILEDTOIMPERSONATE
,
"Unadvise failed: %08x
\n
"
,
hr
);
hr
=
IConnectionPoint_Unadvise
(
pt
,
cookie
);
ok
(
hr
==
S_OK
,
"Unadvise failed: %08x
\n
"
,
hr
);
IConnectionPoint_Release
(
pt
);
hr
=
IConnectionPointContainer_FindConnectionPoint
(
cpc
,
&
IID_INetworkCostManagerEvents
,
&
pt
);
...
...
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