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
6b6aff83
Commit
6b6aff83
authored
Nov 21, 2023
by
Haoyang Chen
Committed by
Alexandre Julliard
Dec 04, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4/tests: Test explicit_handle.
parent
9a4de1b7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
0 deletions
+120
-0
Makefile.in
dlls/rpcrt4/tests/Makefile.in
+1
-0
explicit_handle.idl
dlls/rpcrt4/tests/explicit_handle.idl
+32
-0
server.c
dlls/rpcrt4/tests/server.c
+87
-0
No files found.
dlls/rpcrt4/tests/Makefile.in
View file @
6b6aff83
...
...
@@ -9,6 +9,7 @@ server_interp_EXTRAIDLFLAGS = -Oicf --prefix-client=interp_
SOURCES
=
\
cstub.c
\
cstub.idl
\
explicit_handle.idl
\
generated.c
\
ndr_marshall.c
\
rpc.c
\
...
...
dlls/rpcrt4/tests/explicit_handle.idl
0 → 100644
View file @
6b6aff83
/*
*
Copyright
2023
Haoyang
Chen
*
*
This
library
is
free
software
; you can redistribute it and/or
*
modify
it
under
the
terms
of
the
GNU
Lesser
General
Public
*
License
as
published
by
the
Free
Software
Foundation
; either
*
version
2.1
of
the
License
,
or
(
at
your
option
)
any
later
version
.
*
*
This
library
is
distributed
in
the
hope
that
it
will
be
useful
,
*
but
WITHOUT
ANY
WARRANTY
; without even the implied warranty of
*
MERCHANTABILITY
or
FITNESS
FOR
A
PARTICULAR
PURPOSE
.
See
the
GNU
*
Lesser
General
Public
License
for
more
details
.
*
*
You
should
have
received
a
copy
of
the
GNU
Lesser
General
Public
*
License
along
with
this
library
; if not, write to the Free Software
*
Foundation
,
Inc
.
,
51
Franklin
St
,
Fifth
Floor
,
Boston
,
MA
02110
-
1301
,
USA
*/
#
pragma
makedep
client
#
pragma
makedep
server
[
uuid
(
00000000
-
4114
-
0704
-
2301
-
000000000002
),
explicit_handle
]
interface
RPCExplicitHandle
{
int
add
(
[
in
]
handle_t
hBinding
,
[
in
]
int
a
,
[
in
]
int
b
)
;
int
getNum
(
[
in
]
int
a
,
[
in
]
handle_t
hBinding
)
;
void
Shutdown
(
[
in
]
handle_t
hBinding
)
;
}
dlls/rpcrt4/tests/server.c
View file @
6b6aff83
...
...
@@ -30,6 +30,7 @@
#define SKIP_TYPE_DECLS
#include "server_interp.h"
#include "server_defines.h"
#include "explicit_handle.h"
#include <stddef.h>
#include <stdio.h>
...
...
@@ -1202,6 +1203,30 @@ void __cdecl s_test_I_RpcBindingInqLocalClientPID(unsigned int protseq, RPC_BIND
winetest_pop_context
();
}
int
__cdecl
s_add
(
handle_t
binding
,
int
a
,
int
b
)
{
ok
(
binding
!=
NULL
,
"explicit handle is NULL
\n
"
);
return
a
+
b
;
}
int
__cdecl
s_getNum
(
int
a
,
handle_t
binding
)
{
ok
(
binding
!=
NULL
,
"explicit handle is NULL
\n
"
);
return
a
+
2
;
}
void
__cdecl
s_Shutdown
(
handle_t
binding
)
{
RPC_STATUS
status
;
ULONG
pid
=
0
;
ok
(
binding
!=
NULL
,
"explicit handle is NULL
\n
"
);
status
=
I_RpcBindingInqLocalClientPID
(
binding
,
&
pid
);
ok
(
status
==
RPC_S_OK
,
"Got unexpected %ld.
\n
"
,
status
);
ok
(
pid
==
client_info
.
dwProcessId
,
"Got unexpected pid: %ld client pid: %ld.
\n
"
,
pid
,
client_info
.
dwProcessId
);
ok
(
SetEvent
(
stop_event
),
"SetEvent
\n
"
);
}
void
__RPC_USER
ctx_handle_t_rundown
(
ctx_handle_t
ctx_handle
)
{
ok
(
ctx_handle
==
(
ctx_handle_t
)
0xdeadbeef
,
"Unexpected ctx_handle %p
\n
"
,
ctx_handle
);
...
...
@@ -2034,6 +2059,7 @@ client(const char *test)
static
unsigned
char
port
[]
=
PORT
;
static
unsigned
char
pipe
[]
=
PIPE
;
static
unsigned
char
guid
[]
=
"00000000-4114-0704-2301-000000000000"
;
static
unsigned
char
explicit_handle_guid
[]
=
"00000000-4114-0704-2301-000000000002"
;
unsigned
char
*
binding
;
...
...
@@ -2138,6 +2164,21 @@ client(const char *test)
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
ok
(
RPC_S_OK
==
RpcBindingFree
(
&
IInterpServer_IfHandle
),
"RpcBindingFree
\n
"
);
}
else
if
(
strcmp
(
test
,
"explicit_handle"
)
==
0
)
{
IMixedServer_IfHandle
=
NULL
;
ok
(
RPC_S_OK
==
RpcStringBindingComposeA
(
NULL
,
ncalrpc
,
NULL
,
explicit_handle_guid
,
NULL
,
&
binding
),
"RpcStringBindingCompose
\n
"
);
ok
(
RPC_S_OK
==
RpcBindingFromStringBindingA
(
binding
,
&
IMixedServer_IfHandle
),
"RpcBindingFromStringBinding
\n
"
);
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_OK
);
ok
(
add
(
IMixedServer_IfHandle
,
2
,
3
)
==
5
,
"RPC add
\n
"
);
ok
(
getNum
(
7
,
IMixedServer_IfHandle
)
==
9
,
"RPC getNum
\n
"
);
Shutdown
(
IMixedServer_IfHandle
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
ok
(
RPC_S_OK
==
RpcBindingFree
(
&
IMixedServer_IfHandle
),
"RpcBindingFree
\n
"
);
}
}
static
void
...
...
@@ -2149,6 +2190,7 @@ server(void)
static
unsigned
char
pipe
[]
=
PIPE
;
static
unsigned
char
ncalrpc
[]
=
"ncalrpc"
;
static
unsigned
char
guid
[]
=
"00000000-4114-0704-2301-000000000000"
;
static
unsigned
char
explicit_handle_guid
[]
=
"00000000-4114-0704-2301-000000000002"
;
RPC_STATUS
status
,
iptcp_status
,
np_status
,
ncalrpc_status
;
DWORD
ret
;
...
...
@@ -2247,6 +2289,51 @@ server(void)
ok
(
status
==
RPC_S_OK
,
"RpcServerUnregisterIf() failed: %lu
\n
"
,
status
);
}
/* explicit handle */
stop_event
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
stop_event
!=
NULL
,
"CreateEvent failed with error %ld
\n
"
,
GetLastError
());
ncalrpc_status
=
RpcServerUseProtseqEpA
(
ncalrpc
,
0
,
explicit_handle_guid
,
NULL
);
if
(
ncalrpc_status
==
RPC_S_PROTSEQ_NOT_SUPPORTED
)
skip
(
"Protocol sequence ncacn_np is not supported
\n
"
);
else
ok
(
ncalrpc_status
==
RPC_S_OK
,
"RpcServerUseProtseqEp(ncacn_np) failed with status %ld
\n
"
,
ncalrpc_status
);
if
(
pRpcServerRegisterIfEx
)
{
trace
(
"Using RpcServerRegisterIfEx
\n
"
);
status
=
pRpcServerRegisterIfEx
(
s_RPCExplicitHandle_v0_0_s_ifspec
,
NULL
,
NULL
,
RPC_IF_ALLOW_CALLBACKS_WITH_NO_AUTH
,
RPC_C_LISTEN_MAX_CALLS_DEFAULT
,
NULL
);
ok
(
status
==
RPC_S_OK
,
"RpcServerRegisterIfEx failed with status %ld
\n
"
,
status
);
test_is_server_listening
(
NULL
,
RPC_S_NOT_LISTENING
);
status
=
RpcServerListen
(
1
,
RPC_C_LISTEN_MAX_CALLS_DEFAULT
,
TRUE
);
ok
(
status
==
RPC_S_OK
,
"RpcServerListen failed with status %ld
\n
"
,
status
);
}
else
{
status
=
RpcServerRegisterIf
(
s_RPCExplicitHandle_v0_0_s_ifspec
,
NULL
,
NULL
);
ok
(
status
==
RPC_S_OK
,
"RpcServerRegisterIf failed with status %ld
\n
"
,
status
);
status
=
RpcServerListen
(
1
,
RPC_C_LISTEN_MAX_CALLS_DEFAULT
,
TRUE
);
ok
(
status
==
RPC_S_OK
,
"RpcServerListen failed with status %ld
\n
"
,
status
);
}
test_is_server_listening
(
NULL
,
RPC_S_OK
);
run_client
(
"explicit_handle"
);
ret
=
WaitForSingleObject
(
stop_event
,
1000
);
ok
(
WAIT_OBJECT_0
==
ret
,
"WaitForSingleObject
\n
"
);
if
(
pRpcServerRegisterIfEx
)
{
status
=
RpcServerUnregisterIf
(
s_RPCExplicitHandle_v0_0_s_ifspec
,
NULL
,
TRUE
);
ok
(
status
==
RPC_S_OK
,
"RpcServerUnregisterIf() failed: %lu
\n
"
,
status
);
}
CloseHandle
(
stop_event
);
stop_event
=
NULL
;
CoUninitialize
();
}
...
...
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