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
4447f221
Commit
4447f221
authored
Jul 28, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Use a single structure for all parameter types in new format descriptors.
parent
29575d2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
115 deletions
+69
-115
ndr_stubless.c
dlls/rpcrt4/ndr_stubless.c
+58
-93
ndr_stubless.h
dlls/rpcrt4/ndr_stubless.h
+11
-22
No files found.
dlls/rpcrt4/ndr_stubless.c
View file @
4447f221
...
...
@@ -288,41 +288,31 @@ static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
int
phase
,
unsigned
char
*
args
,
void
**
fpu_args
,
unsigned
short
number_of_params
,
unsigned
char
*
pRetVal
)
{
/* current format string offset */
int
current_offset
=
0
;
/* current stack offset */
unsigned
short
current_stack_offset
=
0
;
/* counter */
unsigned
short
i
;
const
NDR_PARAM_OIF
*
params
=
(
const
NDR_PARAM_OIF
*
)
pFormat
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
number_of_params
;
i
++
)
{
const
NDR_PARAM_OIF_BASETYPE
*
pParam
=
(
const
NDR_PARAM_OIF_BASETYPE
*
)
&
pFormat
[
current_offset
];
unsigned
char
*
pArg
;
current_stack_offset
=
pParam
->
stack_offset
;
pArg
=
ARG_FROM_OFFSET
(
args
,
current_stack_offset
);
unsigned
char
*
pArg
=
args
+
params
[
i
].
stack_offset
;
TRACE
(
"param[%d]: new format
\n
"
,
i
);
TRACE
(
"
\t
param_attributes:"
);
dump_RPC_FC_PROC_PF
(
p
Param
->
param_attributes
);
TRACE
(
"
\n
"
);
TRACE
(
"
\t
stack_offset: 0x%x
\n
"
,
current_
stack_offset
);
TRACE
(
"
\t
param_attributes:"
);
dump_RPC_FC_PROC_PF
(
p
arams
[
i
].
attr
);
TRACE
(
"
\n
"
);
TRACE
(
"
\t
stack_offset: 0x%x
\n
"
,
params
[
i
].
stack_offset
);
TRACE
(
"
\t
memory addr (before): %p
\n
"
,
pArg
);
if
(
p
Param
->
param_attributes
.
IsBasetype
)
if
(
p
arams
[
i
].
attr
.
IsBasetype
)
{
const
unsigned
char
*
pTypeFormat
=
&
pParam
->
type_format_char
;
const
unsigned
char
*
pTypeFormat
=
&
params
[
i
].
u
.
type_format_char
;
#ifdef __x86_64__
/* floats are passed as doubles through varargs functions */
float
f
;
if
(
*
pTypeFormat
==
RPC_FC_FLOAT
&&
!
p
Param
->
param_attributes
.
IsSimpleRef
&&
!
fpu_args
)
if
(
*
pTypeFormat
==
RPC_FC_FLOAT
&&
!
p
arams
[
i
].
attr
.
IsSimpleRef
&&
!
fpu_args
)
{
f
=
*
(
double
*
)
pArg
;
pArg
=
(
unsigned
char
*
)
&
f
;
}
#endif
if
(
p
Param
->
param_attributes
.
IsSimpleRef
)
if
(
p
arams
[
i
].
attr
.
IsSimpleRef
)
{
pArg
=
*
(
unsigned
char
**
)
pArg
;
if
(
!
pArg
)
RpcRaiseException
(
RPC_X_NULL_REF_POINTER
);
...
...
@@ -333,37 +323,32 @@ static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
switch
(
phase
)
{
case
PROXY_CALCSIZE
:
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
call_buffer_sizer
(
pStubMsg
,
pArg
,
pTypeFormat
);
break
;
case
PROXY_MARSHAL
:
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
call_marshaller
(
pStubMsg
,
pArg
,
pTypeFormat
);
break
;
case
PROXY_UNMARSHAL
:
if
(
p
Param
->
param_attributes
.
IsOut
)
if
(
p
arams
[
i
].
attr
.
IsOut
)
{
if
(
p
Param
->
param_attributes
.
IsReturn
)
pArg
=
pRetVal
;
if
(
p
arams
[
i
].
attr
.
IsReturn
)
pArg
=
pRetVal
;
call_unmarshaller
(
pStubMsg
,
&
pArg
,
pTypeFormat
,
0
);
}
break
;
default:
RpcRaiseException
(
RPC_S_INTERNAL_ERROR
);
}
current_offset
+=
sizeof
(
NDR_PARAM_OIF_BASETYPE
);
}
else
{
const
NDR_PARAM_OIF_OTHER
*
pParamOther
=
(
const
NDR_PARAM_OIF_OTHER
*
)
&
pFormat
[
current_offset
];
const
unsigned
char
*
pTypeFormat
=
&
(
pStubMsg
->
StubDesc
->
pFormatTypes
[
p
ParamOther
->
type_offset
]);
&
(
pStubMsg
->
StubDesc
->
pFormatTypes
[
p
arams
[
i
].
u
.
type_offset
]);
/* if a simple ref pointer then we have to do the
* check for the pointer being non-NULL. */
if
(
p
Param
->
param_attributes
.
IsSimpleRef
)
if
(
p
arams
[
i
].
attr
.
IsSimpleRef
)
{
if
(
!*
(
unsigned
char
**
)
pArg
)
RpcRaiseException
(
RPC_X_NULL_REF_POINTER
);
...
...
@@ -374,28 +359,28 @@ static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
switch
(
phase
)
{
case
PROXY_CALCSIZE
:
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_buffer_sizer
(
pStubMsg
,
pArg
,
pTypeFormat
);
else
call_buffer_sizer
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
}
break
;
case
PROXY_MARSHAL
:
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_marshaller
(
pStubMsg
,
pArg
,
pTypeFormat
);
else
call_marshaller
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
}
break
;
case
PROXY_UNMARSHAL
:
if
(
p
Param
->
param_attributes
.
IsOut
)
if
(
p
arams
[
i
].
attr
.
IsOut
)
{
if
(
p
Param
->
param_attributes
.
IsReturn
)
pArg
=
pRetVal
;
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsReturn
)
pArg
=
pRetVal
;
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_unmarshaller
(
pStubMsg
,
&
pArg
,
pTypeFormat
,
0
);
else
call_unmarshaller
(
pStubMsg
,
(
unsigned
char
**
)
pArg
,
pTypeFormat
,
0
);
...
...
@@ -404,8 +389,6 @@ static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
default:
RpcRaiseException
(
RPC_S_INTERNAL_ERROR
);
}
current_offset
+=
sizeof
(
NDR_PARAM_OIF_OTHER
);
}
TRACE
(
"
\t
memory addr (after): %p
\n
"
,
pArg
);
}
...
...
@@ -1137,70 +1120,59 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
unsigned
char
*
args
,
unsigned
short
number_of_params
)
{
/* counter */
unsigned
short
i
;
/* current format string offset */
int
current_offset
=
0
;
/* current stack offset */
unsigned
short
current_stack_offset
=
0
;
/* location to put retval into */
const
NDR_PARAM_OIF
*
params
=
(
const
NDR_PARAM_OIF
*
)
pFormat
;
unsigned
int
i
;
LONG_PTR
*
retval_ptr
=
NULL
;
for
(
i
=
0
;
i
<
number_of_params
;
i
++
)
{
const
NDR_PARAM_OIF_BASETYPE
*
pParam
=
(
const
NDR_PARAM_OIF_BASETYPE
*
)
&
pFormat
[
current_offset
];
unsigned
char
*
pArg
;
current_stack_offset
=
pParam
->
stack_offset
;
pArg
=
args
+
current_stack_offset
;
unsigned
char
*
pArg
=
args
+
params
[
i
].
stack_offset
;
TRACE
(
"param[%d]: new format
\n
"
,
i
);
TRACE
(
"
\t
param_attributes:"
);
dump_RPC_FC_PROC_PF
(
p
Param
->
param_attributes
);
TRACE
(
"
\n
"
);
TRACE
(
"
\t
stack_offset: 0x%x
\n
"
,
current_
stack_offset
);
TRACE
(
"
\t
param_attributes:"
);
dump_RPC_FC_PROC_PF
(
p
arams
[
i
].
attr
);
TRACE
(
"
\n
"
);
TRACE
(
"
\t
stack_offset: 0x%x
\n
"
,
params
[
i
].
stack_offset
);
TRACE
(
"
\t
memory addr (before): %p -> %p
\n
"
,
pArg
,
*
(
unsigned
char
**
)
pArg
);
if
(
p
Param
->
param_attributes
.
IsBasetype
)
if
(
p
arams
[
i
].
attr
.
IsBasetype
)
{
const
unsigned
char
*
pTypeFormat
=
&
pParam
->
type_format_char
;
const
unsigned
char
*
pTypeFormat
=
&
params
[
i
].
u
.
type_format_char
;
TRACE
(
"
\t
base type: 0x%02x
\n
"
,
*
pTypeFormat
);
switch
(
phase
)
{
case
STUBLESS_MARSHAL
:
if
(
p
Param
->
param_attributes
.
IsOut
||
pParam
->
param_attributes
.
IsReturn
)
if
(
p
arams
[
i
].
attr
.
IsOut
||
params
[
i
].
attr
.
IsReturn
)
{
if
(
p
Param
->
param_attributes
.
IsSimpleRef
)
if
(
p
arams
[
i
].
attr
.
IsSimpleRef
)
call_marshaller
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
else
call_marshaller
(
pStubMsg
,
pArg
,
pTypeFormat
);
}
break
;
case
STUBLESS_FREE
:
if
(
p
Param
->
param_attributes
.
ServerAllocSize
)
if
(
p
arams
[
i
].
attr
.
ServerAllocSize
)
HeapFree
(
GetProcessHeap
(),
0
,
*
(
void
**
)
pArg
);
break
;
case
STUBLESS_INITOUT
:
break
;
case
STUBLESS_UNMARSHAL
:
if
(
p
Param
->
param_attributes
.
ServerAllocSize
)
if
(
p
arams
[
i
].
attr
.
ServerAllocSize
)
*
(
void
**
)
pArg
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
p
Param
->
param_attributes
.
ServerAllocSize
*
8
);
p
arams
[
i
].
attr
.
ServerAllocSize
*
8
);
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
{
if
(
p
Param
->
param_attributes
.
IsSimpleRef
)
if
(
p
arams
[
i
].
attr
.
IsSimpleRef
)
call_unmarshaller
(
pStubMsg
,
(
unsigned
char
**
)
pArg
,
pTypeFormat
,
0
);
else
call_unmarshaller
(
pStubMsg
,
&
pArg
,
pTypeFormat
,
0
);
}
break
;
case
STUBLESS_CALCSIZE
:
if
(
p
Param
->
param_attributes
.
IsOut
||
pParam
->
param_attributes
.
IsReturn
)
if
(
p
arams
[
i
].
attr
.
IsOut
||
params
[
i
].
attr
.
IsReturn
)
{
if
(
p
Param
->
param_attributes
.
IsSimpleRef
)
if
(
p
arams
[
i
].
attr
.
IsSimpleRef
)
call_buffer_sizer
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
else
call_buffer_sizer
(
pStubMsg
,
pArg
,
pTypeFormat
);
...
...
@@ -1209,45 +1181,40 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
default
:
RpcRaiseException
(
RPC_S_INTERNAL_ERROR
);
}
current_offset
+=
sizeof
(
NDR_PARAM_OIF_BASETYPE
);
}
else
{
const
NDR_PARAM_OIF_OTHER
*
pParamOther
=
(
const
NDR_PARAM_OIF_OTHER
*
)
&
pFormat
[
current_offset
];
const
unsigned
char
*
pTypeFormat
=
&
(
pStubMsg
->
StubDesc
->
pFormatTypes
[
p
ParamOther
->
type_offset
]);
&
(
pStubMsg
->
StubDesc
->
pFormatTypes
[
p
arams
[
i
].
u
.
type_offset
]);
TRACE
(
"
\t
complex type 0x%02x
\n
"
,
*
pTypeFormat
);
switch
(
phase
)
{
case
STUBLESS_MARSHAL
:
if
(
p
Param
->
param_attributes
.
IsOut
||
pParam
->
param_attributes
.
IsReturn
)
if
(
p
arams
[
i
].
attr
.
IsOut
||
params
[
i
].
attr
.
IsReturn
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_marshaller
(
pStubMsg
,
pArg
,
pTypeFormat
);
else
call_marshaller
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
}
break
;
case
STUBLESS_FREE
:
if
(
p
Param
->
param_attributes
.
MustFree
)
if
(
p
arams
[
i
].
attr
.
MustFree
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_freer
(
pStubMsg
,
pArg
,
pTypeFormat
);
else
call_freer
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
}
else
if
(
p
Param
->
param_attributes
.
ServerAllocSize
)
else
if
(
p
arams
[
i
].
attr
.
ServerAllocSize
)
{
HeapFree
(
GetProcessHeap
(),
0
,
*
(
void
**
)
pArg
);
}
else
if
(
p
Param
->
param_attributes
.
IsOut
&&
!
p
Param
->
param_attributes
.
IsIn
&&
!
p
Param
->
param_attributes
.
IsByValue
)
else
if
(
p
arams
[
i
].
attr
.
IsOut
&&
!
p
arams
[
i
].
attr
.
IsIn
&&
!
p
arams
[
i
].
attr
.
IsByValue
)
{
if
(
*
pTypeFormat
!=
RPC_FC_BIND_CONTEXT
)
pStubMsg
->
pfnFree
(
*
(
void
**
)
pArg
);
...
...
@@ -1255,10 +1222,10 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
break
;
case
STUBLESS_INITOUT
:
if
(
!
p
Param
->
param_attributes
.
IsIn
&&
p
Param
->
param_attributes
.
IsOut
&&
!
p
Param
->
param_attributes
.
ServerAllocSize
&&
!
p
Param
->
param_attributes
.
IsByValue
)
if
(
!
p
arams
[
i
].
attr
.
IsIn
&&
p
arams
[
i
].
attr
.
IsOut
&&
!
p
arams
[
i
].
attr
.
ServerAllocSize
&&
!
p
arams
[
i
].
attr
.
IsByValue
)
{
if
(
*
pTypeFormat
==
RPC_FC_BIND_CONTEXT
)
{
...
...
@@ -1279,22 +1246,22 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
}
break
;
case
STUBLESS_UNMARSHAL
:
if
(
p
Param
->
param_attributes
.
ServerAllocSize
)
if
(
p
arams
[
i
].
attr
.
ServerAllocSize
)
*
(
void
**
)
pArg
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
p
Param
->
param_attributes
.
ServerAllocSize
*
8
);
p
arams
[
i
].
attr
.
ServerAllocSize
*
8
);
if
(
p
Param
->
param_attributes
.
IsIn
)
if
(
p
arams
[
i
].
attr
.
IsIn
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_unmarshaller
(
pStubMsg
,
&
pArg
,
pTypeFormat
,
0
);
else
call_unmarshaller
(
pStubMsg
,
(
unsigned
char
**
)
pArg
,
pTypeFormat
,
0
);
}
break
;
case
STUBLESS_CALCSIZE
:
if
(
p
Param
->
param_attributes
.
IsOut
||
pParam
->
param_attributes
.
IsReturn
)
if
(
p
arams
[
i
].
attr
.
IsOut
||
params
[
i
].
attr
.
IsReturn
)
{
if
(
p
Param
->
param_attributes
.
IsByValue
)
if
(
p
arams
[
i
].
attr
.
IsByValue
)
call_buffer_sizer
(
pStubMsg
,
pArg
,
pTypeFormat
);
else
call_buffer_sizer
(
pStubMsg
,
*
(
unsigned
char
**
)
pArg
,
pTypeFormat
);
...
...
@@ -1303,13 +1270,11 @@ static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg,
default
:
RpcRaiseException
(
RPC_S_INTERNAL_ERROR
);
}
current_offset
+=
sizeof
(
NDR_PARAM_OIF_OTHER
);
}
TRACE
(
"
\t
memory addr (after): %p -> %p
\n
"
,
pArg
,
*
(
unsigned
char
**
)
pArg
);
/* make a note of the address of the return value parameter for later */
if
(
p
Param
->
param_attributes
.
IsReturn
)
retval_ptr
=
(
LONG_PTR
*
)
pArg
;
if
(
p
arams
[
i
].
attr
.
IsReturn
)
retval_ptr
=
(
LONG_PTR
*
)
pArg
;
}
return
retval_ptr
;
...
...
dlls/rpcrt4/ndr_stubless.h
View file @
4447f221
...
...
@@ -141,31 +141,20 @@ typedef struct _NDR_PARAM_OI_OTHER
unsigned
short
type_offset
;
}
NDR_PARAM_OI_OTHER
;
typedef
struct
_NDR_PARAM_OIF_BASETYPE
typedef
struct
{
PARAM_ATTRIBUTES
param_attributes
;
PARAM_ATTRIBUTES
attr
;
/* the offset on the calling stack where the parameter is located */
unsigned
short
stack_offset
;
/* see NDR_PARAM_OI_BASETYPE::type_format_char */
unsigned
char
type_format_char
;
/* always FC_PAD */
unsigned
char
unused
;
}
NDR_PARAM_OIF_BASETYPE
;
typedef
struct
_NDR_PARAM_OIF_OTHER
{
PARAM_ATTRIBUTES
param_attributes
;
/* see NDR_PARAM_OIF_BASETYPE::stack_offset */
unsigned
short
stack_offset
;
/* offset into the provided type format string where the type for this
* parameter starts */
unsigned
short
type_offset
;
}
NDR_PARAM_OIF_OTHER
;
union
{
/* see NDR_PARAM_OI_BASETYPE::type_format_char */
unsigned
char
type_format_char
;
/* offset into the provided type format string where the type for this
* parameter starts */
unsigned
short
type_offset
;
}
u
;
}
NDR_PARAM_OIF
;
/* explicit handle description for FC_BIND_PRIMITIVE type */
typedef
struct
_NDR_EHD_PRIMITIVE
...
...
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