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
259879d1
Commit
259879d1
authored
Dec 15, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Dec 17, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Fix NdrConformantStringUnmarshall to use buffer memory if possible.
parent
b300189c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
5 deletions
+25
-5
ndr_marshall.c
dlls/rpcrt4/ndr_marshall.c
+24
-1
ndr_marshall.c
dlls/rpcrt4/tests/ndr_marshall.c
+1
-4
No files found.
dlls/rpcrt4/ndr_marshall.c
View file @
259879d1
...
@@ -826,6 +826,20 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
...
@@ -826,6 +826,20 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
ReadConformance
(
pStubMsg
,
NULL
);
ReadConformance
(
pStubMsg
,
NULL
);
ReadVariance
(
pStubMsg
,
NULL
,
pStubMsg
->
MaxCount
);
ReadVariance
(
pStubMsg
,
NULL
,
pStubMsg
->
MaxCount
);
if
(
pFormat
[
1
]
!=
RPC_FC_STRING_SIZED
&&
(
pStubMsg
->
MaxCount
!=
pStubMsg
->
ActualCount
))
{
ERR
(
"buffer size %d must equal memory size %ld for non-sized conformant strings
\n
"
,
pStubMsg
->
ActualCount
,
pStubMsg
->
MaxCount
);
RpcRaiseException
(
RPC_S_INVALID_BOUND
);
return
NULL
;
}
if
(
pStubMsg
->
Offset
)
{
ERR
(
"conformant strings can't have Offset (%d)
\n
"
,
pStubMsg
->
Offset
);
RpcRaiseException
(
RPC_S_INVALID_BOUND
);
return
NULL
;
}
if
(
*
pFormat
==
RPC_FC_C_CSTRING
)
esize
=
1
;
if
(
*
pFormat
==
RPC_FC_C_CSTRING
)
esize
=
1
;
else
if
(
*
pFormat
==
RPC_FC_C_WSTRING
)
esize
=
2
;
else
if
(
*
pFormat
==
RPC_FC_C_WSTRING
)
esize
=
2
;
else
{
else
{
...
@@ -864,8 +878,17 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
...
@@ -864,8 +878,17 @@ unsigned char *WINAPI NdrConformantStringUnmarshall( PMIDL_STUB_MESSAGE pStubMsg
return
NULL
;
return
NULL
;
}
}
if
(
fMustAlloc
||
!*
ppMemory
)
if
(
fMustAlloc
)
*
ppMemory
=
NdrAllocate
(
pStubMsg
,
memsize
);
else
{
if
(
!
pStubMsg
->
IsClient
&&
!*
ppMemory
&&
(
pStubMsg
->
MaxCount
==
pStubMsg
->
ActualCount
))
/* if the data in the RPC buffer is big enough, we just point straight
* into it */
*
ppMemory
=
pStubMsg
->
Buffer
;
else
if
(
!*
ppMemory
)
*
ppMemory
=
NdrAllocate
(
pStubMsg
,
memsize
);
*
ppMemory
=
NdrAllocate
(
pStubMsg
,
memsize
);
}
safe_copy_from_buffer
(
pStubMsg
,
*
ppMemory
,
bufsize
);
safe_copy_from_buffer
(
pStubMsg
,
*
ppMemory
,
bufsize
);
...
...
dlls/rpcrt4/tests/ndr_marshall.c
View file @
259879d1
...
@@ -1207,10 +1207,9 @@ todo_wine {
...
@@ -1207,10 +1207,9 @@ todo_wine {
mem
=
NULL
;
mem
=
NULL
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
NdrPointerUnmarshall
(
&
StubMsg
,
&
mem
,
fmtstr_conf_str
,
0
);
NdrPointerUnmarshall
(
&
StubMsg
,
&
mem
,
fmtstr_conf_str
,
0
);
todo_wine
{
ok
(
mem
==
StubMsg
.
BufferStart
+
12
,
"mem not pointing at buffer
\n
"
);
ok
(
mem
==
StubMsg
.
BufferStart
+
12
,
"mem not pointing at buffer
\n
"
);
ok
(
my_alloc_called
==
0
,
"alloc called %d
\n
"
,
my_alloc_called
);
ok
(
my_alloc_called
==
0
,
"alloc called %d
\n
"
,
my_alloc_called
);
}
my_alloc_called
=
0
;
my_alloc_called
=
0
;
mem
=
NULL
;
mem
=
NULL
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
...
@@ -1224,10 +1223,8 @@ todo_wine {
...
@@ -1224,10 +1223,8 @@ todo_wine {
mem
=
mem_orig
;
mem
=
mem_orig
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
StubMsg
.
Buffer
=
StubMsg
.
BufferStart
;
NdrPointerUnmarshall
(
&
StubMsg
,
&
mem
,
fmtstr_conf_str
,
0
);
NdrPointerUnmarshall
(
&
StubMsg
,
&
mem
,
fmtstr_conf_str
,
0
);
todo_wine
{
ok
(
mem
==
StubMsg
.
BufferStart
+
12
,
"mem not pointing at buffer
\n
"
);
ok
(
mem
==
StubMsg
.
BufferStart
+
12
,
"mem not pointing at buffer
\n
"
);
ok
(
my_alloc_called
==
0
,
"alloc called %d
\n
"
,
my_alloc_called
);
ok
(
my_alloc_called
==
0
,
"alloc called %d
\n
"
,
my_alloc_called
);
}
my_alloc_called
=
0
;
my_alloc_called
=
0
;
mem
=
mem_orig
;
mem
=
mem_orig
;
...
...
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