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
62cd56ce
Commit
62cd56ce
authored
Jan 05, 2011
by
Huw Davies
Committed by
Alexandre Julliard
Jan 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Store the ole advise sinks in a STATDATA array.
parent
6ac2cb3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
95 deletions
+36
-95
oleobj.c
dlls/ole32/oleobj.c
+36
-95
No files found.
dlls/ole32/oleobj.c
View file @
62cd56ce
...
...
@@ -243,8 +243,8 @@ typedef struct
LONG
ref
;
DWORD
maxSink
s
;
IAdviseSink
**
arrayOfSink
s
;
DWORD
max_con
s
;
STATDATA
*
connection
s
;
}
OleAdviseHolderImpl
;
static
inline
OleAdviseHolderImpl
*
impl_from_IOleAdviseHolder
(
IOleAdviseHolder
*
iface
)
...
...
@@ -255,28 +255,19 @@ static inline OleAdviseHolderImpl *impl_from_IOleAdviseHolder(IOleAdviseHolder *
/**************************************************************************
* OleAdviseHolderImpl_Destructor
*/
static
void
OleAdviseHolderImpl_Destructor
(
OleAdviseHolderImpl
*
ptrToDestroy
)
static
void
OleAdviseHolderImpl_Destructor
(
OleAdviseHolderImpl
*
This
)
{
DWORD
index
;
TRACE
(
"%p
\n
"
,
ptrToDestroy
);
DWORD
index
;
TRACE
(
"%p
\n
"
,
This
);
for
(
index
=
0
;
index
<
ptrToDestroy
->
maxSinks
;
index
++
)
{
if
(
ptrToDestroy
->
arrayOfSinks
[
index
]
!=
0
)
for
(
index
=
0
;
index
<
This
->
max_cons
;
index
++
)
{
IAdviseSink_Release
(
ptrToDestroy
->
arrayOfSinks
[
index
]);
ptrToDestroy
->
arrayOfSinks
[
index
]
=
NULL
;
if
(
This
->
connections
[
index
].
pAdvSink
!=
NULL
)
release_statdata
(
This
->
connections
+
index
)
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
ptrToDestroy
->
arrayOfSinks
);
HeapFree
(
GetProcessHeap
(),
0
,
ptrToDestroy
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
connections
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
/**************************************************************************
...
...
@@ -344,6 +335,8 @@ static HRESULT WINAPI OleAdviseHolderImpl_Advise(IOleAdviseHolder *iface,
{
DWORD
index
;
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
STATDATA
new_conn
;
static
const
FORMATETC
empty_fmtetc
=
{
0
,
NULL
,
0
,
-
1
,
0
};
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
pAdvise
,
pdwConnection
);
...
...
@@ -352,38 +345,27 @@ static HRESULT WINAPI OleAdviseHolderImpl_Advise(IOleAdviseHolder *iface,
*
pdwConnection
=
0
;
for
(
index
=
0
;
index
<
This
->
max
Sink
s
;
index
++
)
for
(
index
=
0
;
index
<
This
->
max
_con
s
;
index
++
)
{
if
(
This
->
arrayOfSinks
[
index
]
==
NULL
)
if
(
This
->
connections
[
index
].
pAdvSink
==
NULL
)
break
;
}
if
(
index
==
This
->
max
Sink
s
)
if
(
index
==
This
->
max
_con
s
)
{
DWORD
i
;
This
->
maxSinks
+=
INITIAL_SINKS
;
This
->
arrayOfSinks
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
This
->
arrayOfSinks
,
This
->
maxSinks
*
sizeof
(
IAdviseSink
*
));
for
(
i
=
index
;
i
<
This
->
maxSinks
;
i
++
)
This
->
arrayOfSinks
[
i
]
=
0
;
This
->
max_cons
+=
INITIAL_SINKS
;
This
->
connections
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
connections
,
This
->
max_cons
*
sizeof
(
*
This
->
connections
));
}
This
->
arrayOfSinks
[
index
]
=
pAdvise
;
new_conn
.
pAdvSink
=
pAdvise
;
new_conn
.
advf
=
0
;
new_conn
.
formatetc
=
empty_fmtetc
;
new_conn
.
dwConnection
=
index
+
1
;
/* 0 is not a valid cookie, so increment the index */
if
(
This
->
arrayOfSinks
[
index
]
!=
NULL
)
IAdviseSink_AddRef
(
This
->
arrayOfSinks
[
index
]);
copy_statdata
(
This
->
connections
+
index
,
&
new_conn
);
/*
* Return the index as the cookie.
* Since 0 is not a valid cookie, we will increment by
* 1 the index in the table.
*/
*
pdwConnection
=
index
+
1
;
*
pdwConnection
=
new_conn
.
dwConnection
;
return
S_OK
;
}
...
...
@@ -395,30 +377,17 @@ static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(IOleAdviseHolder *iface,
DWORD
dwConnection
)
{
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
DWORD
index
;
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
dwConnection
);
/*
* So we don't return 0 as a cookie, the index was
* incremented by 1 in OleAdviseHolderImpl_Advise
* we have to compensate.
*/
dwConnection
--
;
/*
* Check for invalid cookies.
*/
if
(
dwConnection
>=
This
->
maxSinks
)
return
OLE_E_NOCONNECTION
;
/* The connection number is 1 more than the index, see OleAdviseHolder_Advise */
index
=
dwConnection
-
1
;
if
(
This
->
arrayOfSinks
[
dwConnection
]
==
NULL
)
return
OLE_E_NOCONNECTION
;
if
(
index
>=
This
->
max_cons
||
This
->
connections
[
index
].
pAdvSink
==
NULL
)
return
OLE_E_NOCONNECTION
;
/*
* Release the sink and mark the spot in the list as free.
*/
IAdviseSink_Release
(
This
->
arrayOfSinks
[
dwConnection
]);
This
->
arrayOfSinks
[
dwConnection
]
=
NULL
;
release_statdata
(
This
->
connections
+
index
);
return
S_OK
;
}
...
...
@@ -426,40 +395,17 @@ static HRESULT WINAPI OleAdviseHolderImpl_Unadvise(IOleAdviseHolder *iface,
/******************************************************************************
* OleAdviseHolderImpl_EnumAdvise
*/
static
HRESULT
WINAPI
OleAdviseHolderImpl_EnumAdvise
(
IOleAdviseHolder
*
iface
,
IEnumSTATDATA
**
ppenumA
dvise
)
static
HRESULT
WINAPI
OleAdviseHolderImpl_EnumAdvise
(
IOleAdviseHolder
*
iface
,
IEnumSTATDATA
**
enum_a
dvise
)
{
OleAdviseHolderImpl
*
This
=
impl_from_IOleAdviseHolder
(
iface
);
IUnknown
*
unk
;
DWORD
i
,
count
;
STATDATA
*
data
;
static
const
FORMATETC
empty_fmtetc
=
{
0
,
NULL
,
0
,
-
1
,
0
};
HRESULT
hr
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
ppenumAdvise
);
*
ppenumAdvise
=
NULL
;
/* Build an array of STATDATA structures */
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
maxSinks
*
sizeof
(
*
data
));
if
(
!
data
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
,
count
=
0
;
i
<
This
->
maxSinks
;
i
++
)
{
if
(
This
->
arrayOfSinks
[
i
])
{
data
[
count
].
formatetc
=
empty_fmtetc
;
data
[
count
].
advf
=
0
;
data
[
count
].
pAdvSink
=
This
->
arrayOfSinks
[
i
];
/* The constructor will take a ref. */
data
[
count
].
dwConnection
=
i
;
count
++
;
}
}
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
enum_advise
);
IOleAdviseHolder_QueryInterface
(
iface
,
&
IID_IUnknown
,
(
void
**
)
&
unk
);
hr
=
EnumSTATDATA_Construct
(
unk
,
0
,
count
,
data
,
ppenumA
dvise
);
hr
=
EnumSTATDATA_Construct
(
unk
,
0
,
This
->
max_cons
,
This
->
connections
,
enum_a
dvise
);
IUnknown_Release
(
unk
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
return
hr
;
}
...
...
@@ -564,19 +510,14 @@ static const IOleAdviseHolderVtbl oahvt =
static
IOleAdviseHolder
*
OleAdviseHolderImpl_Constructor
(
void
)
{
OleAdviseHolderImpl
*
lpoah
;
DWORD
index
;
lpoah
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
OleAdviseHolderImpl
));
lpoah
->
IOleAdviseHolder_iface
.
lpVtbl
=
&
oahvt
;
lpoah
->
ref
=
1
;
lpoah
->
maxSinks
=
INITIAL_SINKS
;
lpoah
->
arrayOfSinks
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lpoah
->
maxSinks
*
sizeof
(
IAdviseSink
*
));
for
(
index
=
0
;
index
<
lpoah
->
maxSinks
;
index
++
)
lpoah
->
arrayOfSinks
[
index
]
=
0
;
lpoah
->
max_cons
=
INITIAL_SINKS
;
lpoah
->
connections
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
lpoah
->
max_cons
*
sizeof
(
*
lpoah
->
connections
));
TRACE
(
"returning %p
\n
"
,
&
lpoah
->
IOleAdviseHolder_iface
);
return
&
lpoah
->
IOleAdviseHolder_iface
;
...
...
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