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
c9ef063e
Commit
c9ef063e
authored
Jun 14, 2008
by
Rob Shearman
Committed by
Alexandre Julliard
Jun 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Fix ndr_marshall tests to cope with using pointer ids instead of using pointer values.
This fixes a number of test failures on XP SP3 and Win2003 upwards.
parent
36def4af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
19 deletions
+93
-19
ndr_marshall.c
dlls/rpcrt4/tests/ndr_marshall.c
+93
-19
No files found.
dlls/rpcrt4/tests/ndr_marshall.c
View file @
c9ef063e
...
...
@@ -97,6 +97,41 @@ static const RPC_SERVER_INTERFACE IFoo___RpcServerInterface =
};
static
RPC_IF_HANDLE
IFoo_v0_0_s_ifspec
=
(
RPC_IF_HANDLE
)
&
IFoo___RpcServerInterface
;
static
BOOL
use_pointer_ids
=
FALSE
;
static
void
determine_pointer_marshalling_style
(
void
)
{
RPC_MESSAGE
RpcMessage
;
MIDL_STUB_MESSAGE
StubMsg
;
MIDL_STUB_DESC
StubDesc
;
char
ch
=
0xde
;
static
const
unsigned
char
fmtstr_up_char
[]
=
{
0x12
,
0x8
,
/* FC_UP [simple_pointer] */
0x2
,
/* FC_CHAR */
0x5c
,
/* FC_PAD */
};
StubDesc
=
Object_StubDesc
;
StubDesc
.
pFormatTypes
=
NULL
;
NdrClientInitializeNew
(
&
RpcMessage
,
&
StubMsg
,
&
StubDesc
,
0
);
StubMsg
.
BufferLength
=
8
;
StubMsg
.
RpcMsg
->
Buffer
=
StubMsg
.
BufferStart
=
StubMsg
.
Buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
StubMsg
.
BufferLength
);
NdrPointerMarshall
(
&
StubMsg
,
(
unsigned
char
*
)
&
ch
,
fmtstr_up_char
);
ok
(
StubMsg
.
Buffer
==
StubMsg
.
BufferStart
+
5
,
"%p %p
\n
"
,
StubMsg
.
Buffer
,
StubMsg
.
BufferStart
);
use_pointer_ids
=
(
*
(
unsigned
int
*
)
StubMsg
.
BufferStart
!=
(
unsigned
int
)
&
ch
);
trace
(
"Pointer marshalling using %s
\n
"
,
use_pointer_ids
?
"pointer ids"
:
"pointer value"
);
HeapFree
(
GetProcessHeap
(),
0
,
StubMsg
.
BufferStart
);
}
static
void
test_ndr_simple_type
(
void
)
{
...
...
@@ -423,8 +458,11 @@ static void test_simple_types(void)
ch
=
0xa5
;
ch_ptr
=
&
ch
;
*
(
void
**
)
wiredata
=
ch_ptr
;
wiredata
[
sizeof
(
void
*
)]
=
ch
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
ch_ptr
;
wiredata
[
4
]
=
ch
;
test_pointer_marshal
(
fmtstr_up_char
,
ch_ptr
,
1
,
wiredata
,
5
,
NULL
,
0
,
"up_char"
);
test_pointer_marshal
(
fmtstr_up_byte
,
ch_ptr
,
1
,
wiredata
,
5
,
NULL
,
0
,
"up_byte"
);
...
...
@@ -437,21 +475,30 @@ static void test_simple_types(void)
test_pointer_marshal
(
fmtstr_rpup_char2
,
ch_ptr
,
1
,
wiredata
,
5
,
NULL
,
0
,
"rpup_char2"
);
s
=
0xa597
;
*
(
void
**
)
wiredata
=
&
s
;
*
(
unsigned
short
*
)(
wiredata
+
sizeof
(
void
*
))
=
s
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
s
;
*
(
unsigned
short
*
)(
wiredata
+
4
)
=
s
;
test_pointer_marshal
(
fmtstr_up_wchar
,
&
s
,
2
,
wiredata
,
6
,
NULL
,
0
,
"up_wchar"
);
test_pointer_marshal
(
fmtstr_up_short
,
&
s
,
2
,
wiredata
,
6
,
NULL
,
0
,
"up_short"
);
test_pointer_marshal
(
fmtstr_up_ushort
,
&
s
,
2
,
wiredata
,
6
,
NULL
,
0
,
"up_ushort"
);
i
=
0x7fff
;
*
(
void
**
)
wiredata
=
&
i
;
*
(
unsigned
short
*
)(
wiredata
+
sizeof
(
void
*
))
=
i
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
i
;
*
(
unsigned
short
*
)(
wiredata
+
4
)
=
i
;
test_pointer_marshal
(
fmtstr_up_enum16
,
&
i
,
2
,
wiredata
,
6
,
NULL
,
0
,
"up_enum16"
);
l
=
0xcafebabe
;
*
(
void
**
)
wiredata
=
&
l
;
*
(
unsigned
long
*
)(
wiredata
+
sizeof
(
void
*
))
=
l
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
l
;
*
(
unsigned
long
*
)(
wiredata
+
4
)
=
l
;
test_pointer_marshal
(
fmtstr_up_long
,
&
l
,
4
,
wiredata
,
8
,
NULL
,
0
,
"up_long"
);
test_pointer_marshal
(
fmtstr_up_ulong
,
&
l
,
4
,
wiredata
,
8
,
NULL
,
0
,
"up_ulong"
);
...
...
@@ -459,20 +506,29 @@ static void test_simple_types(void)
test_pointer_marshal
(
fmtstr_up_errorstatus
,
&
l
,
4
,
wiredata
,
8
,
NULL
,
0
,
"up_errorstatus"
);
ll
=
((
ULONGLONG
)
0xcafebabe
)
<<
32
|
0xdeadbeef
;
*
(
void
**
)
wiredata
=
&
ll
;
*
(
void
**
)(
wiredata
+
sizeof
(
void
*
))
=
NULL
;
*
(
ULONGLONG
*
)(
wiredata
+
2
*
sizeof
(
void
*
))
=
ll
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
ll
;
*
(
unsigned
int
**
)(
wiredata
+
4
)
=
0
;
*
(
ULONGLONG
*
)(
wiredata
+
8
)
=
ll
;
test_pointer_marshal
(
fmtstr_up_longlong
,
&
ll
,
8
,
wiredata
,
16
,
NULL
,
0
,
"up_longlong"
);
f
=
3
.
1415
f
;
*
(
void
**
)
wiredata
=
&
f
;
*
(
float
*
)(
wiredata
+
sizeof
(
void
*
))
=
f
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
f
;
*
(
float
*
)(
wiredata
+
4
)
=
f
;
test_pointer_marshal
(
fmtstr_up_float
,
&
f
,
4
,
wiredata
,
8
,
NULL
,
0
,
"up_float"
);
d
=
3
.
1415
;
*
(
void
**
)
wiredata
=
&
d
;
*
(
void
**
)(
wiredata
+
sizeof
(
void
*
))
=
NULL
;
*
(
double
*
)(
wiredata
+
2
*
sizeof
(
void
*
))
=
d
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
d
;
*
(
unsigned
int
*
)(
wiredata
+
4
)
=
0
;
*
(
double
*
)(
wiredata
+
8
)
=
d
;
test_pointer_marshal
(
fmtstr_up_double
,
&
d
,
8
,
wiredata
,
16
,
NULL
,
0
,
"up_double"
);
}
...
...
@@ -888,7 +944,10 @@ static void test_simple_struct(void)
memcpy
(
wiredata
,
&
s1
,
wiredatalen
);
test_simple_struct_marshal
(
fmtstr_simple_struct
+
4
,
&
s1
,
24
,
wiredata
,
24
,
NULL
,
0
,
"struct"
);
*
(
void
**
)
wiredata
=
&
s1
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
s1
;
memcpy
(
wiredata
+
4
,
&
s1
,
wiredatalen
);
if
(
0
)
{
...
...
@@ -905,12 +964,25 @@ static void test_simple_struct(void)
ps1
.
pl1
=
&
l
;
c
=
'a'
;
ps1
.
pc1
=
&
c
;
memcpy
(
wiredata
+
4
,
&
ps1
,
12
);
*
(
unsigned
int
*
)(
wiredata
+
4
)
=
0xdeadbeef
;
if
(
use_pointer_ids
)
{
*
(
unsigned
int
*
)(
wiredata
+
8
)
=
0x20000
;
*
(
unsigned
int
*
)(
wiredata
+
12
)
=
0x20004
;
}
else
{
*
(
unsigned
int
*
)(
wiredata
+
8
)
=
(
unsigned
int
)
&
l
;
*
(
unsigned
int
*
)(
wiredata
+
12
)
=
(
unsigned
int
)
&
c
;
}
memcpy
(
wiredata
+
16
,
&
l
,
4
);
memcpy
(
wiredata
+
20
,
&
c
,
1
);
test_simple_struct_marshal
(
fmtstr_pointer_struct
+
4
,
&
ps1
,
17
,
wiredata
+
4
,
17
,
ps1_cmp
,
2
,
"pointer_struct"
);
*
(
void
**
)
wiredata
=
&
ps1
;
if
(
use_pointer_ids
)
*
(
unsigned
int
*
)
wiredata
=
0x20000
;
else
*
(
unsigned
int
*
)
wiredata
=
(
unsigned
int
)
&
ps1
;
if
(
0
)
{
/* one of the unmarshallings crashes Wine */
...
...
@@ -1823,6 +1895,8 @@ static void test_NdrMapCommAndFaultStatus(void)
START_TEST
(
ndr_marshall
)
{
determine_pointer_marshalling_style
();
test_ndr_simple_type
();
test_simple_types
();
test_nontrivial_pointer_types
();
...
...
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