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
452491bd
Commit
452491bd
authored
Jan 12, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Jan 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Document CoSetState & CoGetState.
- Rewrite them to only retrieve TLS info once. - Remove trailing whitespace in COM_CurrentInfo.
parent
2891bc53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
14 deletions
+43
-14
compobj.c
dlls/ole32/compobj.c
+41
-12
compobj_private.h
dlls/ole32/compobj_private.h
+2
-2
No files found.
dlls/ole32/compobj.c
View file @
452491bd
...
@@ -2034,40 +2034,69 @@ HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) {
...
@@ -2034,40 +2034,69 @@ HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) {
/***********************************************************************
/***********************************************************************
* CoGetState [OLE32.@]
* CoGetState [OLE32.@]
*
*
* NOTES: might be incomplete
* Retrieves the thread state object previously stored by CoSetState().
*
* PARAMS
* ppv [I] Address where pointer to object will be stored.
*
* RETURNS
* Success: S_OK.
* Failure: E_OUTOFMEMORY.
*
* NOTES
* Crashes on all invalid ppv addresses, including NULL.
* If the function returns a non-NULL object then the caller must release its
* reference on the object when the object is no longer required.
*
* SEE ALSO
* CoSetState().
*/
*/
HRESULT
WINAPI
CoGetState
(
IUnknown
**
ppv
)
HRESULT
WINAPI
CoGetState
(
IUnknown
**
ppv
)
{
{
HRESULT
hr
=
E_FAIL
;
struct
oletls
*
info
=
COM_CurrentInfo
();
if
(
!
info
)
return
E_OUTOFMEMORY
;
*
ppv
=
NULL
;
*
ppv
=
NULL
;
if
(
COM_CurrentInfo
()
->
state
)
if
(
info
->
state
)
{
{
IUnknown_AddRef
(
COM_CurrentInfo
()
->
state
);
IUnknown_AddRef
(
info
->
state
);
*
ppv
=
COM_CurrentInfo
()
->
state
;
*
ppv
=
info
->
state
;
TRACE
(
"apt->state=%p
\n
"
,
COM_CurrentInfo
()
->
state
);
TRACE
(
"apt->state=%p
\n
"
,
info
->
state
);
hr
=
S_OK
;
}
}
return
hr
;
return
S_OK
;
}
}
/***********************************************************************
/***********************************************************************
* CoSetState [OLE32.@]
* CoSetState [OLE32.@]
*
*
* Sets the thread state object.
*
* PARAMS
* pv [I] Pointer to state object to be stored.
*
* NOTES
* The system keeps a reference on the object while the object stored.
*
* RETURNS
* Success: S_OK.
* Failure: E_OUTOFMEMORY.
*/
*/
HRESULT
WINAPI
CoSetState
(
IUnknown
*
pv
)
HRESULT
WINAPI
CoSetState
(
IUnknown
*
pv
)
{
{
struct
oletls
*
info
=
COM_CurrentInfo
();
if
(
!
info
)
return
E_OUTOFMEMORY
;
if
(
pv
)
IUnknown_AddRef
(
pv
);
if
(
pv
)
IUnknown_AddRef
(
pv
);
if
(
COM_CurrentInfo
()
->
state
)
if
(
info
->
state
)
{
{
TRACE
(
"-- release %p now
\n
"
,
COM_CurrentInfo
()
->
state
);
TRACE
(
"-- release %p now
\n
"
,
info
->
state
);
IUnknown_Release
(
COM_CurrentInfo
()
->
state
);
IUnknown_Release
(
info
->
state
);
}
}
COM_CurrentInfo
()
->
state
=
pv
;
info
->
state
=
pv
;
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/ole32/compobj_private.h
View file @
452491bd
...
@@ -227,9 +227,9 @@ struct oletls
...
@@ -227,9 +227,9 @@ struct oletls
/* will create if necessary */
/* will create if necessary */
static
inline
struct
oletls
*
COM_CurrentInfo
(
void
)
static
inline
struct
oletls
*
COM_CurrentInfo
(
void
)
{
{
if
(
!
NtCurrentTeb
()
->
ReservedForOle
)
if
(
!
NtCurrentTeb
()
->
ReservedForOle
)
NtCurrentTeb
()
->
ReservedForOle
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
oletls
));
NtCurrentTeb
()
->
ReservedForOle
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
struct
oletls
));
return
NtCurrentTeb
()
->
ReservedForOle
;
return
NtCurrentTeb
()
->
ReservedForOle
;
}
}
...
...
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