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
f42f727f
Commit
f42f727f
authored
Aug 23, 2006
by
Huw Davies
Committed by
Alexandre Julliard
Aug 23, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Tests for CStdStubBuffer_Connect and fixes to make them pass.
parent
cadc3984
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
5 deletions
+87
-5
cstub.c
dlls/rpcrt4/cstub.c
+11
-4
cstub.c
dlls/rpcrt4/tests/cstub.c
+76
-1
No files found.
dlls/rpcrt4/cstub.c
View file @
f42f727f
...
...
@@ -134,10 +134,17 @@ ULONG WINAPI NdrCStdStubBuffer2_Release(LPRPCSTUBBUFFER iface,
HRESULT
WINAPI
CStdStubBuffer_Connect
(
LPRPCSTUBBUFFER
iface
,
LPUNKNOWN
lpUnkServer
)
{
CStdStubBuffer
*
This
=
(
CStdStubBuffer
*
)
iface
;
TRACE
(
"(%p)->Connect(%p)
\n
"
,
This
,
lpUnkServer
);
This
->
pvServerObject
=
lpUnkServer
;
return
S_OK
;
CStdStubBuffer
*
This
=
(
CStdStubBuffer
*
)
iface
;
HRESULT
r
;
IUnknown
*
new
=
NULL
;
TRACE
(
"(%p)->Connect(%p)
\n
"
,
This
,
lpUnkServer
);
r
=
IUnknown_QueryInterface
(
lpUnkServer
,
STUB_HEADER
(
This
).
piid
,
(
void
**
)
&
new
);
new
=
InterlockedExchangePointer
((
void
**
)
&
This
->
pvServerObject
,
new
);
if
(
new
)
IUnknown_Release
(
new
);
return
r
;
}
void
WINAPI
CStdStubBuffer_Disconnect
(
LPRPCSTUBBUFFER
iface
)
...
...
dlls/rpcrt4/tests/cstub.c
View file @
f42f727f
...
...
@@ -628,7 +628,81 @@ static void test_CreateStub(IPSFactoryBuffer *ppsf)
pstub
=
create_stub
(
ppsf
,
&
IID_if1
,
obj
,
E_NOINTERFACE
);
}
static
HRESULT
WINAPI
connect_test_orig_QI
(
IUnknown
*
This
,
REFIID
iid
,
void
**
ppv
)
{
ok
(
IsEqualIID
(
iid
,
&
IID_if1
),
"incorrect iid
\n
"
);
*
ppv
=
(
void
*
)
This
;
return
S_OK
;
}
static
int
connect_test_orig_release_called
;
static
ULONG
WINAPI
connect_test_orig_release
(
IUnknown
*
This
)
{
connect_test_orig_release_called
++
;
return
0
;
}
static
IUnknownVtbl
connect_test_orig_vtbl
=
{
connect_test_orig_QI
,
NULL
,
connect_test_orig_release
};
static
HRESULT
WINAPI
connect_test_new_QI
(
IUnknown
*
This
,
REFIID
iid
,
void
**
ppv
)
{
ok
(
IsEqualIID
(
iid
,
&
IID_if1
),
"incorrect iid
\n
"
);
*
ppv
=
(
void
*
)
0xcafebabe
;
return
S_OK
;
}
static
IUnknownVtbl
connect_test_new_vtbl
=
{
connect_test_new_QI
,
NULL
,
NULL
};
static
HRESULT
WINAPI
connect_test_new_fail_QI
(
IUnknown
*
This
,
REFIID
iid
,
void
**
ppv
)
{
ok
(
IsEqualIID
(
iid
,
&
IID_if1
),
"incorrect iid
\n
"
);
*
ppv
=
(
void
*
)
0xdeadbeef
;
return
E_NOINTERFACE
;
}
static
IUnknownVtbl
connect_test_new_fail_vtbl
=
{
connect_test_new_fail_QI
,
NULL
,
NULL
};
static
void
test_Connect
(
IPSFactoryBuffer
*
ppsf
)
{
IUnknownVtbl
*
orig_vtbl
=
&
connect_test_orig_vtbl
;
IUnknownVtbl
*
new_vtbl
=
&
connect_test_new_vtbl
;
IUnknownVtbl
*
new_fail_vtbl
=
&
connect_test_new_fail_vtbl
;
IUnknown
*
obj
=
(
IUnknown
*
)
&
orig_vtbl
;
IRpcStubBuffer
*
pstub
=
create_stub
(
ppsf
,
&
IID_if1
,
obj
,
S_OK
);
CStdStubBuffer
*
cstd_stub
=
(
CStdStubBuffer
*
)
pstub
;
HRESULT
r
;
obj
=
(
IUnknown
*
)
&
new_vtbl
;
r
=
IRpcStubBuffer_Connect
(
pstub
,
obj
);
ok
(
r
==
S_OK
,
"r %08lx
\n
"
,
r
);
ok
(
connect_test_orig_release_called
==
1
,
"release called %d
\n
"
,
connect_test_orig_release_called
);
ok
(
cstd_stub
->
pvServerObject
==
(
void
*
)
0xcafebabe
,
"pvServerObject %p
\n
"
,
cstd_stub
->
pvServerObject
);
cstd_stub
->
pvServerObject
=
(
IUnknown
*
)
&
orig_vtbl
;
obj
=
(
IUnknown
*
)
&
new_fail_vtbl
;
r
=
IRpcStubBuffer_Connect
(
pstub
,
obj
);
ok
(
r
==
E_NOINTERFACE
,
"r %08lx
\n
"
,
r
);
ok
(
cstd_stub
->
pvServerObject
==
(
void
*
)
0xdeadbeef
,
"pvServerObject %p
\n
"
,
cstd_stub
->
pvServerObject
);
ok
(
connect_test_orig_release_called
==
2
,
"release called %d
\n
"
,
connect_test_orig_release_called
);
}
START_TEST
(
cstub
)
{
IPSFactoryBuffer
*
ppsf
;
...
...
@@ -638,6 +712,7 @@ START_TEST( cstub )
ppsf
=
test_NdrDllGetClassObject
();
test_NdrStubForwardingFunction
();
test_CreateStub
(
ppsf
);
test_Connect
(
ppsf
);
OleUninitialize
();
}
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