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
056dbb04
Commit
056dbb04
authored
May 23, 2022
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Jul 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4/tests: Add I_RpcBindingInqLocalClientPID() tests.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
parent
e613992c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
7 deletions
+101
-7
server.c
dlls/rpcrt4/tests/server.c
+99
-7
server.idl
dlls/rpcrt4/tests/server.idl
+2
-0
No files found.
dlls/rpcrt4/tests/server.c
View file @
056dbb04
...
...
@@ -40,10 +40,11 @@
#define INT_CODE 4198
static
const
char
*
progname
;
static
const
char
*
progname
,
*
client_test_name
;
static
BOOL
old_windows_version
;
static
HANDLE
stop_event
,
stop_wait_event
;
static
PROCESS_INFORMATION
client_info
;
static
void
(
WINAPI
*
pNDRSContextMarshall2
)(
RPC_BINDING_HANDLE
,
NDR_SCONTEXT
,
void
*
,
NDR_RUNDOWN
,
void
*
,
ULONG
);
static
NDR_SCONTEXT
(
WINAPI
*
pNDRSContextUnmarshall2
)(
RPC_BINDING_HANDLE
,
void
*
,
ULONG
,
void
*
,
ULONG
);
...
...
@@ -147,6 +148,7 @@ static int (__cdecl *sum_array_ptr)(int (*a)[2]);
static
ctx_handle_t
(
__cdecl
*
get_handle
)(
void
);
static
void
(
__cdecl
*
get_handle_by_ptr
)(
ctx_handle_t
*
r
);
static
void
(
__cdecl
*
test_handle
)(
ctx_handle_t
ctx_handle
);
static
void
(
__cdecl
*
test_I_RpcBindingInqLocalClientPID
)(
unsigned
int
protseq
,
RPC_BINDING_HANDLE
binding
);
#define SERVER_FUNCTIONS \
X(int_return) \
...
...
@@ -240,7 +242,8 @@ static void (__cdecl *test_handle)(ctx_handle_t ctx_handle);
X(sum_array_ptr) \
X(get_handle) \
X(get_handle_by_ptr) \
X(test_handle)
X(test_handle) \
X(test_I_RpcBindingInqLocalClientPID)
/* type check statements generated in header file */
fnprintf
*
p_printf
=
printf
;
...
...
@@ -1122,6 +1125,88 @@ void __cdecl s_test_handle(ctx_handle_t ctx_handle)
ok
(
ctx_handle
==
(
ctx_handle_t
)
0xdeadbeef
,
"Unexpected ctx_handle %p
\n
"
,
ctx_handle
);
}
struct
test_thread_params
{
unsigned
int
protseq
;
RPC_BINDING_HANDLE
binding
;
};
static
DWORD
CALLBACK
test_I_RpcBindingInqLocalClientPID_thread_func
(
void
*
args
)
{
struct
test_thread_params
*
params
=
(
struct
test_thread_params
*
)
args
;
RPC_STATUS
status
;
ULONG
pid
;
winetest_push_context
(
"%s"
,
client_test_name
);
status
=
I_RpcBindingInqLocalClientPID
(
NULL
,
&
pid
);
todo_wine
ok
(
status
==
RPC_S_NO_CALL_ACTIVE
,
"Got unexpected %ld.
\n
"
,
status
);
/* Other protocol sequences throw exceptions */
if
(
params
->
protseq
==
RPC_PROTSEQ_LRPC
)
{
status
=
I_RpcBindingInqLocalClientPID
(
params
->
binding
,
&
pid
);
todo_wine
ok
(
status
==
RPC_S_OK
,
"Got unexpected %ld.
\n
"
,
status
);
todo_wine
ok
(
pid
==
client_info
.
dwProcessId
,
"Got unexpected pid.
\n
"
);
}
winetest_pop_context
();
return
0
;
}
void
__cdecl
s_test_I_RpcBindingInqLocalClientPID
(
unsigned
int
protseq
,
RPC_BINDING_HANDLE
binding
)
{
struct
test_thread_params
params
;
RPC_STATUS
status
;
HANDLE
thread
;
ULONG
pid
;
winetest_push_context
(
"%s"
,
client_test_name
);
/* Crash on Windows */
if
(
0
)
{
status
=
I_RpcBindingInqLocalClientPID
(
NULL
,
NULL
);
ok
(
status
==
RPC_S_INVALID_ARG
,
"Got unexpected %ld.
\n
"
,
status
);
status
=
I_RpcBindingInqLocalClientPID
(
binding
,
NULL
);
ok
(
status
==
RPC_S_INVALID_ARG
,
"Got unexpected %ld.
\n
"
,
status
);
}
status
=
I_RpcBindingInqLocalClientPID
(
NULL
,
&
pid
);
if
(
protseq
==
RPC_PROTSEQ_LRPC
)
{
todo_wine
ok
(
status
==
RPC_S_OK
,
"Got unexpected %ld.
\n
"
,
status
);
todo_wine
ok
(
pid
==
client_info
.
dwProcessId
,
"Got unexpected pid.
\n
"
);
}
else
{
ok
(
status
==
RPC_S_INVALID_BINDING
,
"Got unexpected %ld.
\n
"
,
status
);
}
if
(
protseq
==
RPC_PROTSEQ_LRPC
)
/* Other protocol sequences throw exceptions */
{
status
=
I_RpcBindingInqLocalClientPID
(
binding
,
&
pid
);
todo_wine
ok
(
status
==
RPC_S_OK
,
"Got unexpected %ld.
\n
"
,
status
);
todo_wine
ok
(
pid
==
client_info
.
dwProcessId
,
"Got unexpected pid.
\n
"
);
}
params
.
protseq
=
protseq
;
params
.
binding
=
binding
;
thread
=
CreateThread
(
NULL
,
0
,
test_I_RpcBindingInqLocalClientPID_thread_func
,
&
params
,
0
,
NULL
);
WaitForSingleObject
(
thread
,
INFINITE
);
CloseHandle
(
thread
);
winetest_pop_context
();
}
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
);
...
...
@@ -1137,17 +1222,17 @@ static void
run_client
(
const
char
*
test
)
{
char
cmdline
[
MAX_PATH
];
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
memset
(
&
startup
,
0
,
sizeof
startup
);
startup
.
cb
=
sizeof
startup
;
client_test_name
=
test
;
make_cmdline
(
cmdline
,
test
);
ok
(
CreateProcessA
(
NULL
,
cmdline
,
NULL
,
NULL
,
FALSE
,
0L
,
NULL
,
NULL
,
&
startup
,
&
info
),
"CreateProcess
\n
"
);
wait_child_process
(
info
.
hProcess
);
ok
(
CloseHandle
(
info
.
hProcess
),
"CloseHandle
\n
"
);
ok
(
CloseHandle
(
info
.
hThread
),
"CloseHandle
\n
"
);
ok
(
CreateProcessA
(
NULL
,
cmdline
,
NULL
,
NULL
,
FALSE
,
0L
,
NULL
,
NULL
,
&
startup
,
&
client_
info
),
"CreateProcess
\n
"
);
wait_child_process
(
client_info
.
hProcess
);
ok
(
CloseHandle
(
client_
info
.
hProcess
),
"CloseHandle
\n
"
);
ok
(
CloseHandle
(
client_
info
.
hThread
),
"CloseHandle
\n
"
);
}
static
void
...
...
@@ -1964,6 +2049,7 @@ client(const char *test)
run_tests
();
authinfo_test
(
RPC_PROTSEQ_TCP
,
0
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_TCP
,
IMixedServer_IfHandle
);
test_is_server_listening2
(
IMixedServer_IfHandle
,
RPC_S_OK
,
RPC_S_ACCESS_DENIED
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
...
...
@@ -1976,6 +2062,7 @@ client(const char *test)
set_auth_info
(
IMixedServer_IfHandle
);
authinfo_test
(
RPC_PROTSEQ_TCP
,
1
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_TCP
,
IMixedServer_IfHandle
);
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_ACCESS_DENIED
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
...
...
@@ -1988,6 +2075,7 @@ client(const char *test)
run_tests
();
/* can cause RPC_X_BAD_STUB_DATA exception */
authinfo_test
(
RPC_PROTSEQ_LRPC
,
0
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_LRPC
,
IMixedServer_IfHandle
);
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_OK
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
...
...
@@ -2000,6 +2088,7 @@ client(const char *test)
run_tests
();
authinfo_test
(
RPC_PROTSEQ_LRPC
,
0
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_LRPC
,
IMixedServer_IfHandle
);
todo_wine
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_NOT_LISTENING
);
...
...
@@ -2016,6 +2105,7 @@ client(const char *test)
set_auth_info
(
IMixedServer_IfHandle
);
authinfo_test
(
RPC_PROTSEQ_LRPC
,
1
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_LRPC
,
IMixedServer_IfHandle
);
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_OK
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
...
...
@@ -2029,6 +2119,7 @@ client(const char *test)
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_OK
);
run_tests
();
authinfo_test
(
RPC_PROTSEQ_NMP
,
0
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_NMP
,
IMixedServer_IfHandle
);
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_OK
);
stop
();
test_is_server_listening
(
IMixedServer_IfHandle
,
RPC_S_NOT_LISTENING
);
...
...
@@ -2046,6 +2137,7 @@ client(const char *test)
test_is_server_listening
(
IInterpServer_IfHandle
,
RPC_S_OK
);
run_tests
();
authinfo_test
(
RPC_PROTSEQ_NMP
,
0
);
test_I_RpcBindingInqLocalClientPID
(
RPC_PROTSEQ_NMP
,
IInterpServer_IfHandle
);
test_is_server_listening
(
IInterpServer_IfHandle
,
RPC_S_OK
);
ok
(
RPC_S_OK
==
RpcStringFreeA
(
&
binding
),
"RpcStringFree
\n
"
);
...
...
dlls/rpcrt4/tests/server.idl
View file @
056dbb04
...
...
@@ -485,4 +485,6 @@ cpp_quote("#endif")
ctx_handle_t
get_handle
()
;
void
get_handle_by_ptr
(
[
out
]
ctx_handle_t
*
r
)
;
void
test_handle
(
ctx_handle_t
ctx_handle
)
;
void
test_I_RpcBindingInqLocalClientPID
(
[
in
]
unsigned
int
protseq
,
[
in
]
handle_t
binding
)
;
}
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