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
903fb72b
Commit
903fb72b
authored
Jun 25, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Jun 25, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Add a STUBLESS_FREE phase for freeing the allocated memory in the server function.
parent
a1dca20d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
5 deletions
+39
-5
ndr_stubless.c
dlls/rpcrt4/ndr_stubless.c
+39
-5
No files found.
dlls/rpcrt4/ndr_stubless.c
View file @
903fb72b
...
...
@@ -121,6 +121,7 @@ static inline unsigned long call_memory_sizer(PMIDL_STUB_MESSAGE pStubMsg, PFORM
#define STUBLESS_CALCSIZE 3
#define STUBLESS_GETBUFFER 4
#define STUBLESS_MARSHAL 5
#define STUBLESS_FREE 6
/* From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/parameter_descriptors.asp */
typedef
struct
_NDR_PROC_HEADER
...
...
@@ -1258,7 +1259,7 @@ LONG WINAPI NdrStubCall2(
* 4. STUBLESS_GETBUFFER - allocate [out] buffer
* 5. STUBLESS_MARHSAL - marshal [out] params to buffer
*/
for
(
phase
=
STUBLESS_UNMARSHAL
;
phase
<=
STUBLESS_
MARSHAL
;
phase
++
)
for
(
phase
=
STUBLESS_UNMARSHAL
;
phase
<=
STUBLESS_
FREE
;
phase
++
)
{
TRACE
(
"phase = %d
\n
"
,
phase
);
switch
(
phase
)
...
...
@@ -1316,6 +1317,7 @@ LONG WINAPI NdrStubCall2(
case
STUBLESS_MARSHAL
:
case
STUBLESS_UNMARSHAL
:
case
STUBLESS_CALCSIZE
:
case
STUBLESS_FREE
:
current_offset
=
parameter_start_offset
;
current_stack_offset
=
0
;
...
...
@@ -1357,6 +1359,10 @@ LONG WINAPI NdrStubCall2(
call_marshaller
(
&
stubMsg
,
pArg
,
pTypeFormat
);
}
break
;
case
STUBLESS_FREE
:
if
(
pParam
->
param_attributes
.
ServerAllocSize
)
HeapFree
(
GetProcessHeap
(),
0
,
*
(
void
**
)
pArg
);
break
;
case
STUBLESS_UNMARSHAL
:
if
(
pParam
->
param_attributes
.
ServerAllocSize
)
*
(
void
**
)
pArg
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
...
...
@@ -1408,12 +1414,29 @@ LONG WINAPI NdrStubCall2(
if
(
pParam
->
param_attributes
.
IsByValue
)
call_marshaller
(
&
stubMsg
,
pArg
,
pTypeFormat
);
else
{
call_marshaller
(
&
stubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
stubMsg
.
pfnFree
(
*
(
void
**
)
pArg
);
}
}
/* FIXME: call call_freer here for IN types */
break
;
case
STUBLESS_FREE
:
if
(
pParam
->
param_attributes
.
MustFree
)
{
if
(
pParam
->
param_attributes
.
IsByValue
)
call_freer
(
&
stubMsg
,
pArg
,
pTypeFormat
);
else
call_freer
(
&
stubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
}
if
(
pParam
->
param_attributes
.
IsOut
&&
!
pParam
->
param_attributes
.
IsIn
&&
!
pParam
->
param_attributes
.
IsByValue
&&
!
pParam
->
param_attributes
.
ServerAllocSize
)
{
stubMsg
.
pfnFree
(
*
(
void
**
)
pArg
);
}
if
(
pParam
->
param_attributes
.
ServerAllocSize
)
HeapFree
(
GetProcessHeap
(),
0
,
*
(
void
**
)
pArg
);
/* FIXME: call call_freer here for IN types with MustFree set */
break
;
case
STUBLESS_UNMARSHAL
:
if
(
pParam
->
param_attributes
.
ServerAllocSize
)
...
...
@@ -1489,6 +1512,10 @@ LONG WINAPI NdrStubCall2(
if
(
pParam
->
param_direction
==
RPC_FC_RETURN_PARAM_BASETYPE
)
call_marshaller
(
&
stubMsg
,
pArg
,
pTypeFormat
);
break
;
case
STUBLESS_FREE
:
if
(
pParam
->
param_direction
==
RPC_FC_IN_PARAM_BASETYPE
)
call_freer
(
&
stubMsg
,
pArg
,
pTypeFormat
);
break
;
case
STUBLESS_UNMARSHAL
:
if
(
pParam
->
param_direction
==
RPC_FC_IN_PARAM_BASETYPE
)
call_unmarshaller
(
&
stubMsg
,
&
pArg
,
pTypeFormat
,
0
);
...
...
@@ -1524,6 +1551,13 @@ LONG WINAPI NdrStubCall2(
pParam
->
param_direction
==
RPC_FC_RETURN_PARAM
)
call_marshaller
(
&
stubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
break
;
case
STUBLESS_FREE
:
if
(
pParam
->
param_direction
==
RPC_FC_IN_OUT_PARAM
||
pParam
->
param_direction
==
RPC_FC_IN_PARAM
)
call_freer
(
&
stubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
else
if
(
pParam
->
param_direction
==
RPC_FC_OUT_PARAM
)
stubMsg
.
pfnFree
(
*
(
void
**
)
pArg
);
break
;
case
STUBLESS_UNMARSHAL
:
if
(
pParam
->
param_direction
==
RPC_FC_IN_OUT_PARAM
||
pParam
->
param_direction
==
RPC_FC_IN_PARAM
)
...
...
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