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
86a0b1d2
Commit
86a0b1d2
authored
Dec 29, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Dec 31, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpcrt4: Implement NdrConformantStringMemorySize.
parent
274dc73b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
11 deletions
+46
-11
ndr_marshall.c
dlls/rpcrt4/ndr_marshall.c
+46
-11
No files found.
dlls/rpcrt4/ndr_marshall.c
View file @
86a0b1d2
...
...
@@ -790,29 +790,64 @@ void WINAPI NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
ULONG
WINAPI
NdrConformantStringMemorySize
(
PMIDL_STUB_MESSAGE
pStubMsg
,
PFORMAT_STRING
pFormat
)
{
ULONG
rslt
=
0
;
ULONG
bufsize
,
memsize
,
esize
,
i
;
FIXM
E
(
"(pStubMsg == ^%p, pFormat == ^%p)
\n
"
,
pStubMsg
,
pFormat
);
TRAC
E
(
"(pStubMsg == ^%p, pFormat == ^%p)
\n
"
,
pStubMsg
,
pFormat
);
assert
(
pStubMsg
&&
pFormat
);
ReadConformance
(
pStubMsg
,
NULL
);
ReadVariance
(
pStubMsg
,
NULL
,
pStubMsg
->
MaxCount
);
if
(
*
pFormat
==
RPC_FC_C_CSTRING
)
{
rslt
=
NDR_LOCAL_UINT32_READ
(
pStubMsg
->
Buffer
);
/* maxlen */
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
);
}
else
if
(
*
pFormat
==
RPC_FC_C_WSTRING
)
{
rslt
=
NDR_LOCAL_UINT32_READ
(
pStubMsg
->
Buffer
)
*
2
;
/* maxlen */
if
(
pStubMsg
->
Offset
)
{
ERR
(
"conformant strings can't have Offset (%d)
\n
"
,
pStubMsg
->
Offset
);
RpcRaiseException
(
RPC_S_INVALID_BOUND
);
}
if
(
*
pFormat
==
RPC_FC_C_CSTRING
)
esize
=
1
;
else
if
(
*
pFormat
==
RPC_FC_C_WSTRING
)
esize
=
2
;
else
{
ERR
(
"Unhandled string type: %#x
\n
"
,
*
pFormat
);
/* FIXME: raise an exception */
esize
=
0
;
}
memsize
=
safe_multiply
(
esize
,
pStubMsg
->
MaxCount
);
bufsize
=
safe_multiply
(
esize
,
pStubMsg
->
ActualCount
);
/* strings must always have null terminating bytes */
if
(
bufsize
<
esize
)
{
ERR
(
"invalid string length of %d
\n
"
,
pStubMsg
->
ActualCount
);
RpcRaiseException
(
RPC_S_INVALID_BOUND
);
}
if
(
pFormat
[
1
]
!=
RPC_FC_PAD
)
{
FIXME
(
"sized string format=%d
\n
"
,
pFormat
[
1
]);
/* verify the buffer is safe to access */
if
((
pStubMsg
->
Buffer
+
bufsize
<
pStubMsg
->
Buffer
)
||
(
pStubMsg
->
Buffer
+
bufsize
>
pStubMsg
->
BufferEnd
))
{
ERR
(
"bufsize 0x%x exceeded buffer end %p of buffer %p
\n
"
,
bufsize
,
pStubMsg
->
BufferEnd
,
pStubMsg
->
Buffer
);
RpcRaiseException
(
RPC_X_BAD_STUB_DATA
);
}
TRACE
(
" --> %u
\n
"
,
rslt
);
return
rslt
;
for
(
i
=
bufsize
-
esize
;
i
<
bufsize
;
i
++
)
if
(
pStubMsg
->
Buffer
[
i
]
!=
0
)
{
ERR
(
"string not null-terminated at byte position %d, data is 0x%x
\n
"
,
i
,
pStubMsg
->
Buffer
[
i
]);
RpcRaiseException
(
RPC_S_INVALID_BOUND
);
}
safe_buffer_increment
(
pStubMsg
,
bufsize
);
pStubMsg
->
MemorySize
+=
memsize
;
return
pStubMsg
->
MemorySize
;
}
/************************************************************************
...
...
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