Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
cadc3984
Commit
cadc3984
authored
18 years ago
by
Huw Davies
Committed by
Alexandre Julliard
18 years ago
Browse files
Options
Downloads
Patches
Plain Diff
rpcrt4: Add tests for CreateStub and fix up CStdStubBuffer_Construct to match.
parent
6a0fccd3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/rpcrt4/cstub.c
+11
-4
11 additions, 4 deletions
dlls/rpcrt4/cstub.c
dlls/rpcrt4/tests/cstub.c
+64
-2
64 additions, 2 deletions
dlls/rpcrt4/tests/cstub.c
with
75 additions
and
6 deletions
dlls/rpcrt4/cstub.c
+
11
−
4
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
;
}
...
...
This diff is collapsed.
Click to expand it.
dlls/rpcrt4/tests/cstub.c
+
64
−
2
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
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment