Commit Graph

252 Commits

Author SHA1 Message Date
Rob Shearman 59158fb25c rpcrt4: Unmarshalling functions should always set fMustAlloc when allocating memory.
The memory is uninitialised and so further unmarshalling shouldn't try
to reuse any memory. fMustAlloc is always set to TRUE when allocating
memory so that it is clear that the unmarshalling is safe and to avoid
future problems with change or the code being copied.
2009-01-12 13:07:31 +01:00
Alexandre Julliard 9d09985ad1 rpcrt4: Fix an unused value warning on non-i386. 2009-01-08 17:30:09 +01:00
Francois Gouget bbc4413548 rpcrt4: Remove WINAPI on static functions where not needed. 2008-11-26 12:10:54 +01:00
Huw Davies c74de4a1ce rpcrt4: Actually set an unmarshalled object ptr to NULL when a NULL pointer id is received. 2008-10-02 10:28:19 -05:00
Rob Shearman a8f7c716ef rpcrt4: Change type of len parameter of NdrAllocate from size_t to SIZE_T.
Use SIZE_T as it matches the size that Windows programs expect whereas
size_t is platform-dependent.
2008-09-08 12:51:37 +02:00
Rob Shearman 27ae234b04 rpcrt4: Remove unreachable code in EmbeddedComplexSize.
RPC_FC_ERROR_STATUS_T has a value of 0x10 and therefore isn't a
possible value of "flags_type & 0xf" in the switch statement.
2008-08-18 17:34:13 +02:00
Rob Shearman 2652ddfeba rpcrt4: Re-implement part of the conformant varying structure processing routines using array_* functions. 2008-08-18 14:34:41 +02:00
Rob Shearman b2305adc3c rpcrt4: Factorise conformant string functions into array_* functions.
This allows conformant string array types to be
marshalled/unmarshalled when embedded in a complex type.
2008-08-18 14:34:40 +02:00
Rob Shearman 9e3260847a rpcrt4: Factorise conformant varying array functions into array_* functions.
This allows conformant varying array types to be
marshalled/unmarshalled when embedded in a complex type.
2008-08-18 14:34:40 +02:00
Rob Shearman 9116d73c63 rpcrt4: Factorise conformant array NDR functions and use them to fix the wire-representation of complex structures with conformant arrays.
Factorise each conformant array function into the part that deals with
reading, writing or sizing the conformance and another part that deals
with reading, writing or sizing the variance and the element data.

This allows complex structures to use the right wire format where the
conformance appears before the structure data starts.
2008-08-18 14:34:40 +02:00
Rob Shearman 8af1dba5a9 rpcrt4: Fix the memory pointer passed into the conformant array marshaller in NdrComplexStructMarshall.
It needs to be the end of the memory used by the constant part of the
structure, which is returned by CompkexStructMarshall.
2008-07-16 17:54:48 +02:00
Rob Shearman b75828fc90 rpcrt4: Clear the memory of embedded complex types in ComplexUnmarshall when fMustAlloc is TRUE to avoid passing uninitialised memory to the unmarshaller.
Found by Valgrind.
2008-07-07 12:11:24 +02:00
Rob Shearman 620d783680 rpcrt4: Don't reserve space in the buffer for reference pointers embedded in complex types.
Ref pointers don't need a pointer ID and reserving space would render
the code incompatible with other clients. Note that the pointer
marshalling/unmarshalling functions didn't actually read/write pointer
IDs to/from the reserved space in the buffer.
2008-07-04 19:49:00 +02:00
Rob Shearman 5887be5717 rpcrt4: Implement memory sizing for pointers in complex types. 2008-07-04 19:48:47 +02:00
Rob Shearman 81b4436add rpcrt4: The conformant array offset in complex structs should be signed. 2008-07-04 19:48:38 +02:00
Rob Shearman 44649e855a rpcrt4: Fix NdrComplexArrayUnmarshall and NdrComplexStructUnmarshall to reuse memory for embedded pointers. 2008-07-04 19:48:30 +02:00
Rob Shearman 517844e054 rpcrt4: Support calculating the size in memory of range types embedded in complex types. 2008-07-04 19:47:58 +02:00
Rob Shearman 0c095ee0d3 rpcrt4: Fix NdrConformantVaryingStructUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2008-06-23 19:46:29 +02:00
Rob Shearman 33e907bc9d rpcrt4: Factor out string validation from NDR unmarshalling functions into a separate function, validate_string_data. 2008-06-23 19:46:29 +02:00
Rob Shearman 4bde42aaa2 rpcrt4: Use abrtitrary pointer identifiers when marshalling pointers instead of using pointer values.
This ensures that no information about the server memory layout is
leaked to clients.
2008-06-21 11:12:58 +02:00
Rob Shearman 8e08b1dd7f rpcrt4: Use safe_copy_from_buffer instead of direct memory copy in NdrBaseTypeUnmarshall.
This makes the code check that the buffer is big enough to read from 
before copying the data from it. The safe_buffer_increment call is still 
needed for the case where we point the memory to the buffer, so move the 
call there.
2008-04-28 13:28:16 +02:00
Andrew Talbot 649c7aeb7c rpcrt4: Remove unused variables. 2008-04-25 11:28:34 +02:00
Austin English aab8fae59a Spelling fixes. 2008-04-21 14:25:05 +02:00
Austin English 313a85f163 Spelling fixes. 2008-04-17 12:25:57 +02:00
Rob Shearman e05ccfe2bb rpcrt4: Add buffer size checks to base type unmarshalling.
Reimplement NdrSimpleTypeUnmarshall using similar macros to
NdrBaseTypeUnmarshalling without buffer checks, due to
NdrSimpleTypeUnmarshall not doing any safety checks.
2008-04-14 12:40:22 +02:00
Andrew Talbot 1f53b85445 rpcrt4: Void functions should not return a value. 2008-03-31 12:13:59 +02:00
Dan Hipschman 629a29d81e rpcrt4: Handle FC_ENUM16. 2008-03-21 11:24:19 +01:00
Rob Shearman a4b18699ac rpcrt4: Only initialise the context handle to NULL in NdrContextHandleUnmarshall if it is an out-only or return one.
Fix the indentation and add tracing of the context handle flags.
2008-01-17 15:30:30 +01:00
Andrew Talbot 3c14ae6699 rpcrt4: Remove unneeded casts. 2008-01-17 13:42:14 +01:00
Rob Shearman 4f6142b8d9 rpcrt4: Handle complex arrays in calc_arg_size. 2008-01-14 15:31:37 +01:00
Rob Shearman aabfc52573 rpcrt4: Fix the calculation of element sizes for complex arrays by using a new function ComplexStructSize that doesn't touch the buffer to calculate the size.
Otherwise, this would fail on arrays with a conformance or variance of zero.
2008-01-14 15:31:37 +01:00
Rob Shearman 4402daa00b rpcrt4: Don't print fixmes for NDR types without a freeing function.
Not all types have a freeing function.
2008-01-14 13:39:03 +01:00
Rob Shearman 97b842c817 rpcrt4: Add support for calculating the memory size of complex types with embedded non-conformant strings. 2008-01-14 13:38:58 +01:00
Rob Shearman 23c9b6c161 rpcrt4: Add stubs for NdrCorrelationInitialize, NdrCorrelationPass and NdrCorrelationFree. 2008-01-07 22:55:34 +01:00
Rob Shearman a0410bef34 rpcrt4: Print fixme's if the serialize or no-serialize flags are set on a context handle being marshalled or unmarshalled. 2008-01-07 12:32:31 +01:00
Rob Shearman f9fc52f602 rpcrt4: Pass the interface identifier to the lower-level context handle routines for context handles with the strict flag set. 2008-01-07 12:32:07 +01:00
Rob Shearman c8b3dc40a4 rpcrt4: Update todos. 2008-01-07 12:02:52 +01:00
Rob Shearman 86a0b1d24e rpcrt4: Implement NdrConformantStringMemorySize. 2007-12-31 16:47:55 +01:00
Rob Shearman eeeed91d92 rpcrt4: Implement non-conformant string functions. 2007-12-31 16:46:10 +01:00
Rob Shearman 3e8a032e8b rpcrt4: Re-use existing memory for embedded pointers in NdrVaryingArrayUnmarshall. 2007-12-26 14:02:58 +01:00
Rob Shearman 273766ee6f rpcrt4: Re-use existing memory for embedded pointers in NdrConformantVaryingArrayUnmarshall. 2007-12-26 14:02:55 +01:00
Rob Shearman 698ba6b4d4 rpcrt4: Implement higher-level NDR server context handle functions.
Implement NdrServerContextMarshall and NdrServerContextNewMarshall on
top of NDRSContextMarshall2. Implement NdrContextHandleInitialize,
NdrServerContextUnmarshall and NdrServerContextNewUnmarshall on top of
NDSContextUnmarshall2.
2007-12-26 13:26:38 +01:00
Rob Shearman cf6d95c1b8 rpcrt4: Move low-level NDR context handle functions to a separate file. 2007-12-26 13:26:30 +01:00
Rob Shearman 64d1e2d8e3 rpcrt4: Set pStubMsg->BufferMark in NdrConformantVaryingArrayUnmarshall and NdrVaryingArrayUnmarshall.
pStubMsg->BufferMark should always be set before
EmbeddedPointerUnmarshall is called and these functions didn't
previously do so.
2007-12-23 13:55:27 +01:00
Rob Shearman 17eb6f44ad rpcrt4: Print an error if stub buffer pointer is passed into safe_copy_from_buffer.
Also print an error message if there was an overflow.
2007-12-21 12:41:18 +01:00
Rob Shearman 9a888e6465 rpcrt4: Fix NdrConformantStringUnmarshall to always increment the buffer during unmarshalling.
safe_copy_from_buffer has the side-effect of incrementing the buffer and 
this still needs to be done when we point the memory into the buffer.

(Thanks to Maarten Lankhorst for finding the mistake and suggesting a fix.)
2007-12-20 12:10:30 +01:00
Rob Shearman 22b20879f7 rpcrt4: Memory should only be cleared in ComplexUnmarshall, not in ComplexMarshall.
Also clear memory when FC_STRUCTPAD* is encountered.
2007-12-19 19:35:02 +01:00
Rob Shearman 50cab7736a rpcrt4: Fix the ALIGN_POINTER_CLEAR macro. 2007-12-19 19:34:56 +01:00
Rob Shearman b9c92e9564 rpcrt4: Don't copy memory from the buffer in NdrConformantStringUnmarshall if we just pointed the memory pointer into the buffer.
(Reported by Dan Kegel.)
2007-12-18 12:32:55 +01:00
Rob Shearman 259879d1f5 rpcrt4: Fix NdrConformantStringUnmarshall to use buffer memory if possible. 2007-12-17 11:58:06 +01:00