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
3b2b23d8
Commit
3b2b23d8
authored
Jan 06, 2011
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jan 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: COM cleanup for thread.c.
parent
65941a66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
thread.c
dlls/shlwapi/tests/thread.c
+14
-7
No files found.
dlls/shlwapi/tests/thread.c
View file @
3b2b23d8
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include <stdarg.h>
#include <stdarg.h>
#define COBJMACROS
#define COBJMACROS
#define CONST_VTABLE
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winbase.h"
#include "winerror.h"
#include "winerror.h"
...
@@ -37,13 +39,18 @@ static DWORD AddRef_called;
...
@@ -37,13 +39,18 @@ static DWORD AddRef_called;
typedef
struct
typedef
struct
{
{
const
IUnknownVtbl
*
lpVtbl
;
IUnknown
IUnknown_iface
;
LONG
*
ref
;
LONG
*
ref
;
}
threadref
;
}
threadref
;
static
inline
threadref
*
impl_from_IUnknown
(
IUnknown
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
threadref
,
IUnknown_iface
);
}
static
HRESULT
WINAPI
threadref_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
threadref_QueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
{
threadref
*
This
=
(
threadref
*
)
iface
;
threadref
*
This
=
impl_from_IUnknown
(
iface
)
;
trace
(
"unexpected QueryInterface(%p, %p, %p) called
\n
"
,
This
,
riid
,
ppvObj
);
trace
(
"unexpected QueryInterface(%p, %p, %p) called
\n
"
,
This
,
riid
,
ppvObj
);
*
ppvObj
=
NULL
;
*
ppvObj
=
NULL
;
...
@@ -52,7 +59,7 @@ static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPV
...
@@ -52,7 +59,7 @@ static HRESULT WINAPI threadref_QueryInterface(IUnknown *iface, REFIID riid, LPV
static
ULONG
WINAPI
threadref_AddRef
(
IUnknown
*
iface
)
static
ULONG
WINAPI
threadref_AddRef
(
IUnknown
*
iface
)
{
{
threadref
*
This
=
(
threadref
*
)
iface
;
threadref
*
This
=
impl_from_IUnknown
(
iface
)
;
AddRef_called
++
;
AddRef_called
++
;
return
InterlockedIncrement
(
This
->
ref
);
return
InterlockedIncrement
(
This
->
ref
);
...
@@ -60,7 +67,7 @@ static ULONG WINAPI threadref_AddRef(IUnknown *iface)
...
@@ -60,7 +67,7 @@ static ULONG WINAPI threadref_AddRef(IUnknown *iface)
static
ULONG
WINAPI
threadref_Release
(
IUnknown
*
iface
)
static
ULONG
WINAPI
threadref_Release
(
IUnknown
*
iface
)
{
{
threadref
*
This
=
(
threadref
*
)
iface
;
threadref
*
This
=
impl_from_IUnknown
(
iface
)
;
trace
(
"unexpected Release(%p) called
\n
"
,
This
);
trace
(
"unexpected Release(%p) called
\n
"
,
This
);
return
InterlockedDecrement
(
This
->
ref
);
return
InterlockedDecrement
(
This
->
ref
);
...
@@ -76,7 +83,7 @@ static const IUnknownVtbl threadref_vt =
...
@@ -76,7 +83,7 @@ static const IUnknownVtbl threadref_vt =
static
void
init_threadref
(
threadref
*
iface
,
LONG
*
refcount
)
static
void
init_threadref
(
threadref
*
iface
,
LONG
*
refcount
)
{
{
iface
->
lpVtbl
=
&
threadref_vt
;
iface
->
IUnknown_iface
.
lpVtbl
=
&
threadref_vt
;
iface
->
ref
=
refcount
;
iface
->
ref
=
refcount
;
}
}
...
@@ -209,7 +216,7 @@ static void test_SHSetThreadRef(void)
...
@@ -209,7 +216,7 @@ static void test_SHSetThreadRef(void)
init_threadref
(
&
ref
,
&
refcount
);
init_threadref
(
&
ref
,
&
refcount
);
AddRef_called
=
0
;
AddRef_called
=
0
;
refcount
=
1
;
refcount
=
1
;
hr
=
pSHSetThreadRef
(
(
IUnknown
*
)
&
ref
);
hr
=
pSHSetThreadRef
(
&
ref
.
IUnknown_iface
);
ok
(
(
hr
==
S_OK
)
&&
(
refcount
==
1
)
&&
(
!
AddRef_called
),
ok
(
(
hr
==
S_OK
)
&&
(
refcount
==
1
)
&&
(
!
AddRef_called
),
"got 0x%x with %d, %d (expected S_OK with 1, 0)
\n
"
,
"got 0x%x with %d, %d (expected S_OK with 1, 0)
\n
"
,
hr
,
refcount
,
AddRef_called
);
hr
,
refcount
,
AddRef_called
);
...
@@ -219,7 +226,7 @@ static void test_SHSetThreadRef(void)
...
@@ -219,7 +226,7 @@ static void test_SHSetThreadRef(void)
refcount
=
1
;
refcount
=
1
;
punk
=
NULL
;
punk
=
NULL
;
hr
=
pSHGetThreadRef
(
&
punk
);
hr
=
pSHGetThreadRef
(
&
punk
);
ok
(
(
hr
==
S_OK
)
&&
(
punk
==
(
IUnknown
*
)
&
ref
)
&&
(
refcount
==
2
)
&&
(
AddRef_called
==
1
),
ok
(
(
hr
==
S_OK
)
&&
(
punk
==
&
ref
.
IUnknown_iface
)
&&
(
refcount
==
2
)
&&
(
AddRef_called
==
1
),
"got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)
\n
"
,
"got 0x%x and %p with %d, %d (expected S_OK and %p with 2, 1)
\n
"
,
hr
,
punk
,
refcount
,
AddRef_called
,
&
ref
);
hr
,
punk
,
refcount
,
AddRef_called
,
&
ref
);
...
...
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