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
cadc3984
Commit
cadc3984
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: Add tests for CreateStub and fix up CStdStubBuffer_Construct to match.
parent
6a0fccd3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
6 deletions
+75
-6
cstub.c
dlls/rpcrt4/cstub.c
+11
-4
cstub.c
dlls/rpcrt4/tests/cstub.c
+64
-2
No files found.
dlls/rpcrt4/cstub.c
View file @
cadc3984
...
...
@@ -54,7 +54,8 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
LPRPCSTUBBUFFER
*
ppStub
)
{
CStdStubBuffer
*
This
;
IUnknown
*
pvServer
;
HRESULT
r
;
TRACE
(
"(%p,%p,%p,%p) %s
\n
"
,
pUnkServer
,
vtbl
,
pPSFactory
,
ppStub
,
name
);
TRACE
(
"iid=%s
\n
"
,
debugstr_guid
(
vtbl
->
header
.
piid
));
TRACE
(
"vtbl=%p
\n
"
,
&
vtbl
->
Vtbl
);
...
...
@@ -64,16 +65,22 @@ HRESULT WINAPI CStdStubBuffer_Construct(REFIID riid,
return
RPC_E_UNEXPECTED
;
}
r
=
IUnknown_QueryInterface
(
pUnkServer
,
riid
,
(
void
**
)
&
pvServer
);
if
(
FAILED
(
r
))
return
r
;
This
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
CStdStubBuffer
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
!
This
)
{
IUnknown_Release
(
pvServer
);
return
E_OUTOFMEMORY
;
}
This
->
lpVtbl
=
&
vtbl
->
Vtbl
;
This
->
RefCount
=
1
;
This
->
pvServerObject
=
p
Unk
Server
;
This
->
pvServerObject
=
p
v
Server
;
This
->
pPSFactory
=
pPSFactory
;
*
ppStub
=
(
LPRPCSTUBBUFFER
)
This
;
IUnknown_AddRef
(
This
->
pvServerObject
);
IPSFactoryBuffer_AddRef
(
pPSFactory
);
return
S_OK
;
}
...
...
dlls/rpcrt4/tests/cstub.c
View file @
cadc3984
...
...
@@ -21,6 +21,7 @@
#include <stdarg.h>
#define PROXY_DELEGATION
#define COBJMACROS
#include "wine/test.h"
#include <windef.h>
...
...
@@ -426,7 +427,7 @@ const ProxyFileInfo *proxy_file_list[] = {
};
static
void
test_NdrDllGetClassObject
(
void
)
static
IPSFactoryBuffer
*
test_NdrDllGetClassObject
(
void
)
{
IPSFactoryBuffer
*
ppsf
=
NULL
;
const
CLSID
PSDispatch
=
{
0x20420
,
0
,
0
,
{
0xc0
,
0
,
0
,
0
,
0
,
0
,
0
,
0x46
}};
...
...
@@ -524,6 +525,7 @@ todo_wine {
#undef VTBL_TEST_ZERO
ok
(
PSFactoryBuffer
.
RefCount
==
1
,
"ref count %ld
\n
"
,
PSFactoryBuffer
.
RefCount
);
return
ppsf
;
}
static
int
base_buffer_invoke_called
;
...
...
@@ -570,12 +572,72 @@ todo_wine {
}
static
IRpcStubBuffer
*
create_stub
(
IPSFactoryBuffer
*
ppsf
,
REFIID
iid
,
IUnknown
*
obj
,
HRESULT
expected_result
)
{
IRpcStubBuffer
*
pstub
=
NULL
;
HRESULT
r
;
r
=
IPSFactoryBuffer_CreateStub
(
ppsf
,
iid
,
obj
,
&
pstub
);
ok
(
r
==
expected_result
,
"CreateStub returned %08lx expected %08lx
\n
"
,
r
,
expected_result
);
return
pstub
;
}
static
HRESULT
WINAPI
create_stub_test_QI
(
IUnknown
*
This
,
REFIID
iid
,
void
**
ppv
)
{
ok
(
IsEqualIID
(
iid
,
&
IID_if1
),
"incorrect iid
\n
"
);
*
ppv
=
(
void
*
)
0xdeadbeef
;
return
S_OK
;
}
static
IUnknownVtbl
create_stub_test_vtbl
=
{
create_stub_test_QI
,
NULL
,
NULL
};
static
HRESULT
WINAPI
create_stub_test_fail_QI
(
IUnknown
*
This
,
REFIID
iid
,
void
**
ppv
)
{
ok
(
IsEqualIID
(
iid
,
&
IID_if1
),
"incorrect iid
\n
"
);
*
ppv
=
NULL
;
return
E_NOINTERFACE
;
}
static
IUnknownVtbl
create_stub_test_fail_vtbl
=
{
create_stub_test_fail_QI
,
NULL
,
NULL
};
static
void
test_CreateStub
(
IPSFactoryBuffer
*
ppsf
)
{
IUnknownVtbl
*
vtbl
=
&
create_stub_test_vtbl
;
IUnknown
*
obj
=
(
IUnknown
*
)
&
vtbl
;
IRpcStubBuffer
*
pstub
=
create_stub
(
ppsf
,
&
IID_if1
,
obj
,
S_OK
);
CStdStubBuffer
*
cstd_stub
=
(
CStdStubBuffer
*
)
pstub
;
CInterfaceStubHeader
*
header
=
((
CInterfaceStubHeader
*
)
cstd_stub
->
lpVtbl
)
-
1
;
ok
(
IsEqualIID
(
header
->
piid
,
&
IID_if1
),
"header iid differs
\n
"
);
ok
(
cstd_stub
->
RefCount
==
1
,
"ref count %ld
\n
"
,
cstd_stub
->
RefCount
);
/* 0xdeadbeef returned from create_stub_test_QI */
ok
(
cstd_stub
->
pvServerObject
==
(
void
*
)
0xdeadbeef
,
"pvServerObject %p"
,
cstd_stub
->
pvServerObject
);
ok
(
cstd_stub
->
pPSFactory
==
ppsf
,
"pPSFactory %p
\n
"
,
cstd_stub
->
pPSFactory
);
vtbl
=
&
create_stub_test_fail_vtbl
;
pstub
=
create_stub
(
ppsf
,
&
IID_if1
,
obj
,
E_NOINTERFACE
);
}
START_TEST
(
cstub
)
{
IPSFactoryBuffer
*
ppsf
;
OleInitialize
(
NULL
);
test_NdrDllGetClassObject
();
ppsf
=
test_NdrDllGetClassObject
();
test_NdrStubForwardingFunction
();
test_CreateStub
(
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