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
9271efc0
Commit
9271efc0
authored
May 20, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Use a FINALLY block to clean up in do_ndr_client_call().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ae5f2a8f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
24 deletions
+54
-24
ndr_stubless.c
dlls/rpcrt4/ndr_stubless.c
+54
-24
No files found.
dlls/rpcrt4/ndr_stubless.c
View file @
9271efc0
...
...
@@ -657,6 +657,46 @@ PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
return
(
PFORMAT_STRING
)
args
;
}
struct
ndr_client_call_ctx
{
MIDL_STUB_MESSAGE
*
stub_msg
;
INTERPRETER_OPT_FLAGS
Oif_flags
;
INTERPRETER_OPT_FLAGS2
ext_flags
;
const
NDR_PROC_HEADER
*
proc_header
;
void
*
This
;
PFORMAT_STRING
handle_format
;
handle_t
hbinding
;
};
static
void
CALLBACK
ndr_client_call_finally
(
BOOL
normal
,
void
*
arg
)
{
struct
ndr_client_call_ctx
*
ctx
=
arg
;
if
(
ctx
->
ext_flags
.
HasNewCorrDesc
)
{
/* free extra correlation package */
NdrCorrelationFree
(
ctx
->
stub_msg
);
}
if
(
ctx
->
Oif_flags
.
HasPipes
)
{
/* NdrPipesDone(...) */
}
/* free the full pointer translation tables */
if
(
ctx
->
proc_header
->
Oi_flags
&
Oi_FULL_PTR_USED
)
NdrFullPointerXlatFree
(
ctx
->
stub_msg
->
FullPtrXlatTables
);
/* free marshalling buffer */
if
(
ctx
->
proc_header
->
Oi_flags
&
Oi_OBJECT_PROC
)
NdrProxyFreeBuffer
(
ctx
->
This
,
ctx
->
stub_msg
);
else
{
NdrFreeBuffer
(
ctx
->
stub_msg
);
client_free_handle
(
ctx
->
stub_msg
,
ctx
->
proc_header
,
ctx
->
handle_format
,
ctx
->
hbinding
);
}
}
/* Helper for ndr_client_call, to factor out the part that may or may not be
* guarded by a try/except block. */
static
LONG_PTR
do_ndr_client_call
(
const
MIDL_STUB_DESC
*
stub_desc
,
const
PFORMAT_STRING
format
,
...
...
@@ -664,6 +704,7 @@ static LONG_PTR do_ndr_client_call( const MIDL_STUB_DESC *stub_desc, const PFORM
unsigned
short
procedure_number
,
unsigned
short
stack_size
,
unsigned
int
number_of_params
,
INTERPRETER_OPT_FLAGS
Oif_flags
,
INTERPRETER_OPT_FLAGS2
ext_flags
,
const
NDR_PROC_HEADER
*
proc_header
)
{
struct
ndr_client_call_ctx
finally_ctx
;
RPC_MESSAGE
rpc_msg
;
handle_t
hbinding
=
NULL
;
/* the value to return to the client from the remote procedure */
...
...
@@ -683,7 +724,18 @@ static LONG_PTR do_ndr_client_call( const MIDL_STUB_DESC *stub_desc, const PFORM
This
=
stack_top
[
0
];
NdrProxyInitialize
(
This
,
&
rpc_msg
,
stub_msg
,
stub_desc
,
procedure_number
);
}
else
finally_ctx
.
stub_msg
=
stub_msg
;
finally_ctx
.
Oif_flags
=
Oif_flags
;
finally_ctx
.
ext_flags
=
ext_flags
;
finally_ctx
.
proc_header
=
proc_header
;
finally_ctx
.
This
=
This
;
finally_ctx
.
handle_format
=
handle_format
;
finally_ctx
.
hbinding
=
hbinding
;
__TRY
{
if
(
!
(
proc_header
->
Oi_flags
&
Oi_OBJECT_PROC
))
NdrClientInitializeNew
(
&
rpc_msg
,
stub_msg
,
stub_desc
,
procedure_number
);
stub_msg
->
StackTop
=
(
unsigned
char
*
)
stack_top
;
...
...
@@ -788,30 +840,8 @@ static LONG_PTR do_ndr_client_call( const MIDL_STUB_DESC *stub_desc, const PFORM
TRACE
(
"UNMARSHAL
\n
"
);
client_do_args
(
stub_msg
,
format
,
STUBLESS_UNMARSHAL
,
fpu_stack
,
number_of_params
,
(
unsigned
char
*
)
&
retval
);
if
(
ext_flags
.
HasNewCorrDesc
)
{
/* free extra correlation package */
NdrCorrelationFree
(
stub_msg
);
}
if
(
Oif_flags
.
HasPipes
)
{
/* NdrPipesDone(...) */
}
/* free the full pointer translation tables */
if
(
proc_header
->
Oi_flags
&
Oi_FULL_PTR_USED
)
NdrFullPointerXlatFree
(
stub_msg
->
FullPtrXlatTables
);
/* free marshalling buffer */
if
(
proc_header
->
Oi_flags
&
Oi_OBJECT_PROC
)
NdrProxyFreeBuffer
(
This
,
stub_msg
);
else
{
NdrFreeBuffer
(
stub_msg
);
client_free_handle
(
stub_msg
,
proc_header
,
handle_format
,
hbinding
);
}
__FINALLY_CTX
(
ndr_client_call_finally
,
&
finally_ctx
)
return
retval
;
}
...
...
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