Commit Graph

1029 Commits

Author SHA1 Message Date
Rob Shearman 9a2914b11f rpcrt4: Implement I_RpcExceptionFilter. 2008-04-11 12:12:30 +02:00
Rob Shearman 8aeb2858e4 rpcrt4: Add a reference to the binding object in I_RpcNegotiateTransferSyntax and release the reference in I_RpcFreeBuffer.
This is needed because a context binding handle could be released on 
unmarshall, but it still needs to stay valid until the binding handle is 
no longer being used.

Re-use the previously unused RPCRT4_ExportBinding function as 
RPCRT4_AddRefBinding and rename RPCRT4_DestroyBinding to 
RPCRT4_ReleaseBinding to show that it's purpose is to release a 
reference count and destroy if necessary, not always destroy.
2008-04-01 19:11:00 +02:00
Rob Shearman c7f9b9347f rpcrt4: Improve trace in RPCRT4_find_interface to print the interface identifier data as well as the object guid. 2008-04-01 19:10:48 +02:00
Andrew Talbot 1f53b85445 rpcrt4: Void functions should not return a value. 2008-03-31 12:13:59 +02:00
Rob Shearman c06f26f2e3 rpcrt4: Print an error if an invalid client context handle is used. 2008-03-28 21:42:15 +01:00
Dan Hipschman 2fa83d94c8 widl: Make structures with FC_ENUM16 fields complex.
Structures containing enum fields without the v1_enum attribute must be
treated as complex because of the range check and memory/wire size
differences.  This includes a test which didn't pass before and now
passes on Wine and Windows.
2008-03-21 11:24:28 +01:00
Dan Hipschman 629a29d81e rpcrt4: Handle FC_ENUM16. 2008-03-21 11:24:19 +01:00
Dan Hipschman 764cf334d6 rpcrt4: Use correct count in rpcrt4_conn_np_write.
count is the total count passed into rpcrt4_conn_np_write.  If WriteFile
does a partial write it would end up writing too much subsequent times
through the loop.  All tests pass as before.
2008-03-20 14:27:34 +01:00
Rob Shearman f15287dea7 rpcrt4: Add a stub for RpcCancelThreadEx. 2008-03-17 15:20:07 +01:00
Andrew Talbot db6a901bf4 rpcrt4: Assign to structs instead of using memcpy. 2008-03-14 11:21:29 +01:00
Rob Shearman 0e7b25349d rpcrt4: Fix the pointer level being passed into call_unmarshaller in client_do_args_old_format for base return parameters.
NdrBaseTypeUnmarshall expects a pointer to a pointer to a base type. 
pRetVal contains a pointer to a base type, so we need to pass the 
address of pRetVal into call_unmarshaller here.
2008-03-10 19:25:55 +01:00
Rob Shearman 259ccc573c rpcrt4: Fix -Oi interpreter for base types.
Don't call memory sizing rountines to compute the size of a type, since
memory sizing routines have side effects like checking there is enough
space in the buffer for the type and incrementing the buffer pointer.
Instead, create a function which returns the necessary size of the
limited set of types we can encounter and remove call_memory_sizer which
is no longer needed.
2008-03-10 19:12:54 +01:00
Rob Shearman a5599028ea rpcrt4: Check that the input to RPCRT4_strndupW was not NULL before assuming that the string couldn't be allocated due to lack of memory. 2008-03-10 19:12:54 +01:00
Rob Shearman a1e4bcda1a rpcrt4: Use closesocket to close sockets and define it to close on Unix platforms to make the code more portable. 2008-03-06 17:39:31 +01:00
Rob Shearman 48000893f9 makefiles: Simplify the use of the IMPORTLIB variable in the DLL makefiles.
Only specify the root to keep platform-specifics out of the individual 
DLL makefiles.
2008-03-04 20:55:01 +01:00
James Hawkins 00394486df janitorial: Remove links to any microsoft site. 2008-03-01 12:03:59 +01:00
Rob Shearman 5dd2f1efa8 Include config.h and wine/port.h in files that use snprintf. 2008-02-29 12:39:28 +01:00
Paul Vriens 6832c8327d rpcrt4/tests: Make tests run on win9x/NT4 again. 2008-02-28 12:57:02 +01:00
Rob Shearman f7628b69b0 rpcrt4: Add tests for RpcStringBindingParseA. 2008-02-28 10:50:57 +01:00
Rob Shearman 5fce2d8839 rpcrt4: Don't crash in RpcStringBindingParseA/W if Endpoint or Options is NULL. 2008-02-28 10:50:57 +01:00
Rob Shearman 0287289475 rpcrt4: Include ws2tcpip.h instead of Unix headers when targeting a build for Windows. 2008-02-25 13:27:54 +01:00
Dan Hipschman 2d7b1f18b1 widl: Allow is_string_type to work for typedef'd types. 2008-02-22 12:04:26 +01:00
Rob Shearman 8608e895eb Add a new convenience macro for an exception handler that handles all exceptions.
When using native compiler exceptions, the previous method of doing 
this, __EXCEPT(NULL), would expand to __except( 
(NULL)(GetExceptionInformation())) which doesn't compile as NULL isn't a 
function.

So add a new macro, __EXCEPT_ALL, which works correctly both when using 
native compiler exceptions and without and which makes the meaning of 
code in which it is used clearer.
2008-02-16 14:58:24 +01:00
Rob Shearman a82f4dd9b7 Don't use GetExceptionCode and GetExceptionInformation in exception filter functions.
When using native compiler exceptions, it isn't valid to use 
GetExceptionCode and GetExceptionInformation anywhere other than in the 
filter or handler blocks since it would be very hard for the compiler to 
work out where to retrieve the exception information from on the stack.

Therefore, remove the WINE_EXCEPTION_FILTER and WINE_FINALLY_FUNC macros 
which enabled GetExceptionCode, GetExceptionInformation and 
AbnormalTermination to be used inside of the functions they declared and 
fix up all callers to access the information directly.
2008-02-16 14:57:44 +01:00
Rob Shearman 610c213f6d rpcrt4: Add some traces to async_notifier_proc.
Make the test of the return value of wait_for_incoming_data less strict.
2008-02-15 09:53:16 +01:00
Paul Vriens e2539cb9e5 rpcrt4/tests: Don't crash on WinXP SP3. 2008-02-11 20:41:40 +01:00
Paul Vriens 517168b4c5 rpcrt4/tests: Vista uses the same status values as Windows 2003. 2008-02-11 20:41:40 +01:00
Paul Vriens 8554db9f5c rpcrt4/tests: Skip rest of the tests if we fail. 2008-02-08 12:08:32 +01:00
Paul Vriens a9e29c7576 rpcrt4/tests: Change test for Windows 2003. 2008-02-08 12:08:25 +01:00
Alexandre Julliard 05c7174909 tests: Add a helper routine to wait for a child process and propagate its result correctly. 2008-02-07 12:56:00 +01:00
Rob Shearman 1ceef1e149 rpcrt4: Fix potential memory leaks on error paths in RPCRT4_io_thread. 2008-02-05 12:19:37 +01:00
Rob Shearman 8e667fd89c rpcrt4: Fix potential memory leaks in RPCRT4_Receive. 2008-02-05 12:19:37 +01:00
Rob Shearman 7bc9e425f1 rpcrt4: Fix memory leaks in the rpc tests. 2008-02-04 13:04:37 +01:00
Rob Shearman 3024b530c9 rpcrt4: Fix some incorrect checks in RPCRT4_Receive. 2008-02-04 13:02:49 +01:00
Rob Shearman 7277113af3 rpcrt4: Check the return value of RPCRT4_ClientAuthorize in RPCRT4_Send. 2008-01-23 20:45:55 +01:00
Rob Shearman 2badb4faea rpcrt4: Pass the SPN input to RpcBindingSetAuthInfoA/W into InitializeSecurityContextW instead of AcquireCredentialsHandleA/W. 2008-01-23 20:45:52 +01:00
Rob Shearman fef5ce52ce rpcrt4: Fix the error handling in RpcBindingSetAuthInfoA/W when RpcAuthInfo_Create fails.
Don't release the old auth info until we successfully have a new auth 
info and return failure to the caller if RpcAuthInfo_Create fails.
2008-01-23 20:45:44 +01:00
Marcus Meissner 20dcbc3de9 rpcrt4: Initialize CurrentHeader. 2008-01-23 12:05:24 +01:00
Rob Shearman 426418f725 rpcrt4: Don't set BufferStart and BufferEnd in NdrStubCall2.
The operations peformed by the stubless code should roughly match what 
operations MIDL outputs in code, and it doesn't do this.
2008-01-22 11:18:56 +01:00
Rob Shearman e2578c5bb6 rpcrt4: Remove some unimplemented win9x-only spec entries.
We're never going to implement the undocumented ones and we're moving 
more and more towards the architecture of the more recent versions of 
native rpcrt4.
2008-01-21 12:42:06 +01:00
Rob Shearman 2b0d3b7400 rpcrt4: Move the receiving of an individual fragment to a separate function. 2008-01-21 12:42:02 +01:00
Rob Shearman 5f077bab07 rpcrt4: Implement asynchronous RPC support. 2008-01-21 12:41:51 +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
Rob Shearman 6ec9e0c77a rpcrt4: Add an exception handler for stubless object proxies. 2008-01-17 15:30:18 +01:00
Andrew Talbot 3c14ae6699 rpcrt4: Remove unneeded casts. 2008-01-17 13:42:14 +01:00
Rob Shearman 68c8e5fe41 rpcrt4: Add tests for RPC_FC_P_DEREF|RPC_FC_P_ONSTACK pointers. 2008-01-16 15:34:26 +01:00
Francois Gouget f6fab295f3 Fix spelling error in the generated conformance test files. 2008-01-16 12:46:18 +01:00
Rob Shearman ffffcfa239 rpcrt4: Move the setting of retval_ptr outside of any particular stub phase in stub_do_args and stub_do_old_args.
After the change in order of phases it was no longer being set in the 
last phase and so caused all stubless functions to appear to have no 
return value.
2008-01-16 12:15:51 +01:00
Rob Shearman 1a3d7c77a5 rpcrt4: Allow NULL networkaddr and endpoint in rpcrt4_np_get_top_of_tower.
Add tests for this.
2008-01-15 14:35:35 +01:00
Rob Shearman ed5b296289 rpcrt4: The initialisation of [out] variables in the stubless code must be after the unmarshaling of [in] and [in, out] variables has been completed.
This is because the size of an [out] variable could depend on a
conformance value stored in an unmarshalled [in] or [in,out] variable.
2008-01-14 15:31:37 +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 516008ff5f rpcrt4: Add traces to the start of TowerConstruct and TowerExplode. 2008-01-14 13:39:08 +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 576c9dc6fa rpcrt4: Allocate a context handle if a NULL GUID is being unmarshalled. 2008-01-14 13:38:53 +01:00
Rob Shearman a04641c15b rpcrt4: Split RPCRT4_process_packet out into separate functions. 2008-01-11 12:25:59 +01:00
Rob Shearman 492947aa02 rpcrt4: Fix a memory leak in the cstub tests. 2008-01-09 13:38:02 +01:00
Rob Shearman 24ba6a5cc6 rpcrt4: Fix memory leaks in the ndr_marshall tests. 2008-01-09 13:38:02 +01:00
Rob Shearman 52f08dd510 rpcrt4: Fix memory leak in NdrFullPointerXlatFree.
First of all, the code was freeing the wrong pointer (i.e. the pointer
supplied by the caller of one of the NdrFullPointer* functions, not the
PFULL_PTR_TO_REFID_ELEMENT. Second, the code wasn't following the Next
link to the next entry in the list.
2008-01-09 13:38:02 +01:00
Rob Shearman 5be085dec5 rpcrt4: Fix a leak of msg in RPCRT4_io_thread on the error paths. 2008-01-09 12:25:56 +01:00
Rob Shearman e0c67a189b rpcrt4: Implement NdrMapCommAndFaultStatus.
Add tests for this function.
2008-01-09 12:25:50 +01:00
Rob Shearman c370980dfa rpcrt4: Use send on a socket instead of write as it's more portable. 2008-01-09 12:25:46 +01:00
Rob Shearman af4639f74a rpcrt4: Improve error handling in RPCRT4_io_thread and remove commented-out code. 2008-01-08 14:02:56 +01:00
Rob Shearman d0f914befc rpcrt4: Bind to the server interface in I_RpcGetBuffer, not I_RpcSendReceive.
The actual sending of the request is still done in I_RpcSendReceive though.

Disallow the server from calling I_RpcSend and I_RpcReceive to allow 
simplification of the code. The releasing of the connection is now done 
in I_RpcFreeBuffer.

Implement I_RpcNegotiateTransferSyntax.
2008-01-08 14:00:50 +01:00
Rob Shearman bb78c3f86d rpcrt4: Remove some unused includes. 2008-01-08 14:00:46 +01:00
Rob Shearman 9ff15252d0 rpcrt4: Set the fBufferValid flag in NdrProxyGetBuffer.
Only call IRpcChannelBuffer_FreeBuffer in NdrProxyFreeBuffer if 
fBufferValid is set.
2008-01-08 14:00:44 +01:00
Rob Shearman e2e7916739 rpcrt4: Set ReservedForRuntime to NULL in NdrClientInitializeNew. 2008-01-07 22:55:48 +01:00
Rob Shearman ea44471088 rpcrt4: Implement RpcAsyncInitializeHandle. 2008-01-07 22:55:46 +01:00
Rob Shearman 1da9d47f1b rpcrt4: Add tests for some async RPC functions. 2008-01-07 22:55:44 +01:00
Rob Shearman fef28ec6cb rpcrt4: Add stubs for asynchronous functions. 2008-01-07 22:55:41 +01:00
Rob Shearman b0cbf664f6 rpcrt4: Add stubs for I_RpcAsyncSetHandle and I_RpcAsyncAbortCall. 2008-01-07 22:55:39 +01:00
Rob Shearman 807a203f77 rpcrt4: Call NdrCorrelationInitialize and NdrCorrelationFree from NdrClientCall2 if new correlation descriptors have been specified. 2008-01-07 22:55:37 +01:00
Rob Shearman 23c9b6c161 rpcrt4: Add stubs for NdrCorrelationInitialize, NdrCorrelationPass and NdrCorrelationFree. 2008-01-07 22:55:34 +01:00
Rob Shearman f9a54a58d5 rpcrt4: ndr_stubless.h should include ndrtypes.h as it depends on types it defines. 2008-01-07 22:55:32 +01:00
Rob Shearman 31676530c2 rpcrt4: Set the ProcNum of RPC_MESSAGE in NdrClientInitializeNew to include RPC_VALID_FLAGS_BIT.
Mask out RPC_VALID_FLAGS_BIT from ProcNum when it is used to build a 
packet to send to the server.
2008-01-07 22:55:28 +01:00
Rob Shearman 4d6aa7ca95 rpcrt4: Add tests for the RPC_MESSAGE members set by NdrClientInitializeNew. 2008-01-07 22:55:22 +01:00
Rob Shearman f296a8ca6c rpcrt4: Implement I_RpcMapWin32Status.
Add a test for this function.
2008-01-07 12:41:17 +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 0e6d5202c8 rpcrt4: Don't set Buffer to NULL in I_RpcFreeBuffer. 2008-01-07 12:04:31 +01:00
Rob Shearman 1bb6c1b4d1 rpcrt4: Add some tests for NdrGetBuffer and NdrFreeBuffer. 2008-01-07 12:04:28 +01:00
Rob Shearman c8b3dc40a4 rpcrt4: Update todos. 2008-01-07 12:02:52 +01:00
Rob Shearman 56da854c21 rpcrt4: Fix NdrGetBuffer to set the correct fields in the MIDL_STUB_MESSAGE structure.
Fix NdrFreeBuffer to use the fBufferValid flag to determine whether or 
not I_RpcFreeBuffer needs to be called.
2007-12-31 17:14:34 +01:00
Rob Shearman 4aff0cdac4 rpcrt4: Make some variables in the tests static. 2007-12-31 17:14:29 +01:00
Rob Shearman 07622b0f05 rpcrt4: Add tests for NdrServerInitializeNew. 2007-12-31 17:14:22 +01:00
Rob Shearman e745f93c79 rpcrt4: Fix the MIDL_STUB_MESSAGE fields set by NdrServerInitializeNew. 2007-12-31 17:14:16 +01:00
Rob Shearman f6a29a1e73 rpcrt4: Fix a case of destroying a context handle without first releasing the lock.
Reverse the order of the release statements in NDRSContextMarshall2 for 
the case where the context handle doesn't have valid data so that the 
release that releases the lock comes first and then the optional second 
release doesn't need to release the lock.
2007-12-31 17:14:04 +01:00
Rob Shearman 51c051c0c4 rpcrt4: Keep a track of server context handles allocated during processing of a request.
Release them after processing of a request has finished to avoid a slow 
memory leak if the association isn't released for ages.
2007-12-31 17:13:55 +01:00
Rob Shearman 86a0b1d24e rpcrt4: Implement NdrConformantStringMemorySize. 2007-12-31 16:47:55 +01:00
Rob Shearman 274dc73ba1 rpcrt4: Add some tests for non-conformant strings. 2007-12-31 16:46:16 +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 a05923e1d3 rpcrt4: Add tests for varying and conformant varying arrays. 2007-12-26 14:02:53 +01:00
Rob Shearman e24f664b26 rpcrt4: Add tests for low-level context handle functions. 2007-12-26 13:26:52 +01:00
Rob Shearman 3d8af5630b rpcrt4: Implement low-level context handle support.
Server context handles are tracked from associations as their lifetime
is determined by the lifetime of the association.
2007-12-26 13:26:49 +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 366fd6e3af rpcrt4: Fix a memory leak from the get_filename call in the server tests. 2007-12-21 12:41:21 +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 6382c8af3f rpcrt4: Don't use BufferEnd in RpcStream_Write.
It is usually used during marshalling, where pStubMsg->BufferStart and 
pStubMsg->BufferEnd won't be valid. Replace it with a check using 
RpcMsg->Buffer and pStubMsg->BufferLength.
2007-12-19 19:35:42 +01:00
Rob Shearman c49a73b853 rpcrt4: Initialise memory passed into RPCs in the server test.
aligns contains padding, but the memory is marshalled in one block so 
call memset to avoid Valgrind warnings. padded and padded2 are 
marshalled as complex types so this is not required here.

Initialise the dummy member of test_list_t to zero for the TL_NULL case. 
Change the type to the smallest available to not waste buffer space.
2007-12-19 19:35:28 +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 1cb7df8a98 rpcrt4: Implement I_RpcGetCurrentCallHandle. 2007-12-18 19:48:19 +01:00
Michael Stefaniuc 6210c097a4 rpcrt4: Add missing LeaveCriticalSection. Found by Smatch. 2007-12-18 12:32:55 +01:00
Rob Shearman bdc5a34196 rpcrt4: Add a stub for I_RpcGetCurrentCallHandle. 2007-12-18 12:32:55 +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
Francois Gouget 76d266cbb0 rpcrt4: Add an rpcasync.h header stub and fix the RpcErrorStartEnumeration() prototype. 2007-12-18 12:32:42 +01:00
Rob Shearman 737510eeb6 rpcrt4: Move association code into a separate file. 2007-12-17 11:59:18 +01:00
Rob Shearman 22f530c835 rpcrt4: Make a server association when a bind packet is received in the server.
Support handing out association group IDs.
2007-12-17 11:59:13 +01:00
Rob Shearman 2bda19c6b0 rpcrt4: Return an error from rpcrt4_conn_tcp_read if recv returns 0. 2007-12-17 11:58:57 +01:00
Rob Shearman 259879d1f5 rpcrt4: Fix NdrConformantStringUnmarshall to use buffer memory if possible. 2007-12-17 11:58:06 +01:00
Rob Shearman b300189c43 rpcrt4: Add a FIXME for RPC_FC_P_ALLOCALLNODES in PointerUnmarshall. 2007-12-17 11:58:00 +01:00
Rob Shearman 68432dd339 rpcrt4: Clear padding inserted into the buffer during marshalling because of alignment. 2007-12-17 11:57:54 +01:00
Rob Shearman c8a802eea8 include: Make RpcRaiseException DECLSPEC_NORETURN, like it is in the PSDK. 2007-12-14 12:28:03 +01:00
Rob Shearman ba280fb1b0 rpcrt4: Fix a typo in rpcrt4_conn_tcp_read. 2007-12-14 12:27:09 +01:00
Rob Shearman 25bf0a409a rpcrt4: Update TODO list.
Out-of-memory check is performed by NdrAllocate and so isn't required to 
be done in the unmarshalling functions.
2007-12-14 12:24:34 +01:00
Rob Shearman 4a028589eb rpcrt4: Document NdrAllocate. 2007-12-14 12:24:24 +01:00
Rob Shearman c7261b732b rpcrt4: Partially revert commit 18faf3184b2ea263d77c2a7ad92eef27bc4ba08f.
Tests show that NdrPointerFree (and hence NdrFree) don't check whether 
the memory was allocated with NdrAllocate before freeing it. This makes 
sense as servers don't need to use NdrAllocate to allocate memory being 
returned and so this commit caused that memory to be leaked.

NdrAllocate hasn't been changed as the tests show it is correct and it 
appears that the memory list is used to implement the RpcSs memory model.
2007-12-14 12:24:21 +01:00
Rob Shearman ce220e2b5f rpcrt4: Free the base pointer in PointerFree when freeing a pointer with RPC_FC_P_DEREF. 2007-12-14 12:24:03 +01:00
Rob Shearman d5ff3467bc rpcrt4: Fix the check in NdrPointerFree.
Add comments to justify why this is the only check that is needed.
2007-12-14 12:23:55 +01:00
Rob Shearman 9d8ebc1a24 rpcrt4: NdrStubGetBuffer shouldn't set BufferStart and BufferEnd.
These are supposed to point to the original buffer when the types were 
unmarshalled.
2007-12-14 12:23:46 +01:00
Rob Shearman ded4b86625 Revert "rpcrt4: Try to free every non-stack pointer in PointerFree now that NdrFree does the sanity checking for us.".
This reverts commit 6db648302ce43f625a073426a35a6f40b7869d8b.

Tests show the assumptions in a commit that this commit depends on are 
not valid.
2007-12-14 12:23:38 +01:00
Rob Shearman 9642714d06 rpcrt4: Add tests for freeing non-NdrAllocate allocated memory blocks. 2007-12-13 14:30:40 +01:00
Rob Shearman e12b487e26 rpcrt4: Try to free every non-stack pointer in PointerFree now that NdrFree does the sanity checking for us. 2007-12-12 16:02:53 +01:00
Rob Shearman 9c8c74f388 rpcrt4: Store allocated memory in a singly-linked list to keep track of what we should and shouldn't free in NdrFree. 2007-12-12 16:02:43 +01:00
Rob Shearman 33c4c25dad rpcrt4: Make the NdrAllocate tests pass on XP SP2 and greater. 2007-12-12 16:01:33 +01:00
Rob Shearman d458a599eb widl: Add support for non-basetype return types. 2007-12-11 18:07:05 +01:00
Rob Shearman 766d8a17af rpcrt4: Pass the USER_MARSHAL_CB structure into user marshal routines. 2007-12-10 12:04:28 +01:00
Rob Shearman 80b8743aa2 rpcrt4: NdrRangeUnmarshall is implemented so add it to the spec file. 2007-12-10 12:04:19 +01:00
Rob Shearman a07afe7e06 rpcrt4: Implement NdrConformantArrayMemorySize. 2007-12-10 12:04:15 +01:00
Rob Shearman 41937c5756 rpcrt4: Add a missing break in DllMain. 2007-12-08 19:58:24 +01:00
Rob Shearman 417b9d80f2 rpcrt4: Save the buffer in EmbeddedPointerMemorySize, like EmbeddedPointerUnmarshall does. 2007-12-08 19:58:11 +01:00
Rob Shearman d7a0de303e rpcrt4: Fix the return value from NdrSimpleStructMemorySize. 2007-12-08 19:58:07 +01:00
Rob Shearman 3a13de3115 rpcrt4: Add a trace to NdrBaseTypeMemorySize. 2007-12-08 19:58:03 +01:00
Rob Shearman 7ae1d44816 rpcrt4: Implement PointerMemorySize. 2007-12-08 19:57:55 +01:00
Rob Shearman 8348f0413d rpcrt4: Fix NdrConformantStructUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:46 +01:00
Rob Shearman a5f9ed81e3 rpcrt4: Fix NdrFixedArrayUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:39 +01:00
Rob Shearman abbceb137a rpcrt4: Fix NdrConformantArrayUnmarshall to use buffer memory if applicable and to reuse memory for embedded pointers. 2007-12-08 19:57:32 +01:00
Alexandre Julliard c0b12351e0 Avoid size_t types in traces. 2007-12-07 18:49:18 +01:00
Rob Shearman 7092590c90 rpcrt4: Use an alertable wait in rpcrt4_protseq_np_wait_for_new_connection to fix a small memory leak flagged by Valgrind.
This is called only by the RPCRT4_server_thread so we don't have to 
worry about application user APCs being run at improper times.
2007-12-07 17:06:33 +01:00
Rob Shearman ba6aec70ca rpcrt4: Implement NdrConformantStructFree. 2007-12-07 17:06:05 +01:00
Rob Shearman 2ebee18198 rpcrt4: Improve PointerFree to not free buffer memory. 2007-12-07 16:34:17 +01:00
Rob Shearman 1b79da8be0 rpcrt4: Fix a memory leak caused by NdrFullPointerXlatFree not freeing the entries in the full pointer translation table. 2007-12-06 12:08:10 +01:00
Rob Shearman 867cc3c05f rpcrt4: Fix a memory leak when freeing an association by deleting the critical section. 2007-12-06 12:08:05 +01:00
Rob Shearman 5fb5fccac0 rpcrt4: Fix a memory leak in RpcAssoc_BindConnection. 2007-12-06 12:08:00 +01:00
Rob Shearman 13e47d762a rpcrt4: Set the memory pointer in NdrBaseTypeUnmarshall to the buffer if we're unmarshalling on a server without memory being passed in. 2007-12-05 13:49:08 +01:00
Rob Shearman 17132f7e1f rpcrt4: Set fMustAlloc to TRUE when unmarshalling an object pointer. 2007-12-05 13:48:59 +01:00
Rob Shearman c866b06806 rpcrt4: Add tests for a pointer to a conformant strings. 2007-12-04 18:18:03 +01:00
Rob Shearman 2a9fae7565 rpcrt4: Set the destination pointer in PointerUnmarshall before calling the referenced type's unmarshalling routine.
When a pointer that is dereferenced is encountered then this can result 
in a stale pointer (i.e. the one that is marshalled into the buffer for 
the embedded pointer unmarshalling case) being used instead of the one 
that was intended.
2007-12-04 18:18:01 +01:00
Rob Shearman a016d7b335 rpcrt4: Handle all non-continuable exceptions in CStdStubBuffer_Invoke. 2007-12-04 13:33:10 +01:00
Rob Shearman 6dcc3fe62e rpcrt4: Put the delegating stub thunks in an executable memory page, rather than on the heap. 2007-12-04 13:32:41 +01:00
Rob Shearman 341208bf1b rpcrt4: Call IRpcChannelBuffer_GetDestCtx in NdrStubInitialize, just like we do in NdrProxyInitialize. 2007-12-04 13:32:29 +01:00
Rob Shearman f191f59ee4 rpcrt4: Flesh out more of the IRpcChannelBuffer vtable to make the test_delegating_Invoke test succeed on Windows. 2007-12-04 13:31:59 +01:00
Rob Shearman 620fca405d rpcrt4: Test that the string retrieved from get_name was actually unmarshalled correctly. 2007-12-03 13:10:21 +01:00
Rob Shearman d8e467b0fd rpcrt4: Reverse the conditions for which *pPointer is assigned base_ptr_val in PointerUnmarshall.
In one condition (fMustAlloc == TRUE), base_ptr_val may be uninitialised
and so cause a valgrind warning. Reversing the check is harmless and
doesn't result in a performance decrease.
2007-12-03 13:10:21 +01:00
Rob Shearman eef207e3f1 rpcrt4: Initialise the memory in test_simple_struct_marshal before passing it to NdrSimpleStructUnmarshall.
Otherwise, the unmarshalling code will read from unintialised memory
when trying to reuse the embedded pointers in the memory block.

Also fix a couple of memory leaks.
2007-12-03 13:10:21 +01:00
Rob Shearman c735a14788 rpcrt4: Fix NdrSimpleStructUnmarshall to cope with [in, out] embedded pointers. 2007-11-30 11:56:30 +01:00
Rob Shearman b676309db3 rpcrt4: Improve PointerUnmarshall to cope with keeping the non-NULL source pointer of a client unmarshall.
This will enable various types with embedded pointers to handle [in,out] 
parameters correctly by keeping the existing memory.
2007-11-30 11:56:21 +01:00
Rob Shearman 4e8f69ac2d rpcrt4: Move forcing of fMustAlloc to NULL to the callers of EmbeddedPointerUnmarshall.
This will enable them to be individually fixed up to use memory if it 
was provided by the caller.
2007-11-30 11:56:11 +01:00
Rob Shearman 43e0c67fe2 rpcrt4: EmbeddedPointerUnmarshall doesn't need to change the address of the allocated memory, so reduce the level of indirection of the memory parameter by one. 2007-11-30 11:56:04 +01:00
Rob Shearman 34522de870 rpcrt4: Errors in sending or receiving packets should result in RPC_S_CALL_FAILED being returned, not RPC_S_PROTOCOL_ERROR. 2007-11-30 11:55:50 +01:00
Rob Shearman 8668369b4f rpcrt4: Fix an integer overflow in NdrConformantStructMarshall and NdrConformantStructUnmarshall. 2007-11-29 13:31:05 +01:00
Rob Shearman 074898ba2b rpcrt4: Fix some more potential buffer overflows. 2007-11-29 13:30:58 +01:00
Rob Shearman 5a3c34eb89 rpcrt4: Check there is enough space in the buffer and that the size doesn't cause an overflow when copying data to it. 2007-11-29 13:30:21 +01:00
Rob Shearman d0223ecc0e rpcrt4: Check for integer overflows when increasing the buffer length.
Rename safe_buffer_copy to safe_copy_from_buffer.
2007-11-29 13:30:04 +01:00
Rob Shearman 4171309731 rpcrt4: Fix the tests for up_enum16.
It is different to the other base types as it has a different size on 
the wire to in memory, so it can't just be set to the buffer when 
unmarshalling.
2007-11-27 16:42:17 +01:00
Michael Stefaniuc 61ed0c99e6 rpcrt4: socket() returns -1 on error so check the return value against that. 2007-11-27 12:29:45 +01:00
Rob Shearman 046f24a0e7 rpcrt4: Raise an exception if a NULL ref-pointer is passed in to PointerMarshall or PointerBufferSize. 2007-11-21 12:03:35 +01:00
Rob Shearman 8a15423ab7 rpcrt4: Hold the thread-data's critical section while cancelling a call.
Check that there is a connection before trying to cancel it.
2007-11-19 13:53:22 +01:00
Francois Gouget 4fddc5e726 rpcrt4: Add some missing prototypes and better match the PSDK types. 2007-11-13 23:28:06 +01:00
Rob Shearman 3634dc1b1c rpcrt4: Fix a copy and paste mistake in declaring threaddata_cs_debug.
Reported by Hans Leidekker.
2007-11-13 23:28:05 +01:00
Francois Gouget b6ad7b5ef7 rpcrt4: Add an API documentation stub to make winapi_check happy. 2007-11-13 13:37:24 +01:00
Rob Shearman a51486c657 rpcrt4: Implement RpcCancelThread for the ncacn_ip_tcp protocol sequence. 2007-11-13 13:34:50 +01:00
Rob Shearman 7ad36eabfc rpcrt4: Add stubs for RpcMgmtSetCancelTimeout and RpcCancelThread. 2007-11-07 11:57:25 +01:00
Rob Shearman ebe885d782 rpcrt4: Add a stub for RpcErrorStartEnumeration. 2007-11-07 11:57:20 +01:00
Dan Hipschman a0ac63961d widl: Don't rely on type_memsize to return 0 for all conformant arrays. 2007-11-06 13:02:56 +01:00
Rob Shearman 04dc115b54 rpcrt4: Handle FC_IGNORE in the base type functions. 2007-11-05 15:06:06 +01:00
Dan Hipschman 8d15820f79 widl: Handle pointers to conformant arrays (e.g., "[size_is(, n)] int **p; "). 2007-11-05 13:24:37 +01:00
Dan Hipschman 8caa325eb7 rpcrt4: Initialize allocated pointers to NULL in PointerUnmarshall.
This patch initializes allocated pointers in PointerUnmarshall since later
code checks the value for NULL (specifically, NdrConformantArrayUnmarshall).
2007-11-05 13:24:36 +01:00
Dan Hipschman eaffc0a0da rpcrt4/tests: Initialize memory in the get_name test.
This initializes the memory for an [in] parameter.
2007-11-05 13:24:36 +01:00
Rob Shearman c4a1a081a9 rpcrt4: Factorise out the argument processing from NdrStubCall2 into two functions. 2007-11-05 13:24:36 +01:00
Rob Shearman 83bc80ada0 rpcrt4: Move some type definitions from ndr_stubless.c to ndr_stubless.h. 2007-11-05 13:24:36 +01:00
Rob Shearman 3eac5b4e59 rpcrt4: Add a small bit of documentation as to what NdrStubCall2 does. 2007-11-05 13:24:36 +01:00
Rob Shearman 18c16a8027 rpcrt4: Add a test for the pointers in [in,out] pointer structs not changing when the pointers aren't NULL. 2007-11-02 12:37:35 +01:00
Gerald Pfeifer 826a6d09d4 rpcrt4: Initialize variable to avoid compiler warning. 2007-10-25 12:48:01 +02:00
Dan Hipschman ff8930f2bf widl: Fix problems with variable-size user types. 2007-10-22 13:47:56 +02:00
Dan Hipschman 1d0f9378bc widl: Detect conformant arrays of user types correctly. 2007-10-18 12:09:23 +02:00
Dan Hipschman e219087c65 rpcrt4/tests: Free memory from one of the tests. 2007-10-15 16:55:31 +02:00
Dan Hipschman acfde97b9e rpcrt4, widl: Make pointer layouts compatible with windows; fix conformant array tests. 2007-10-11 16:24:28 +02:00
Dan Hipschman d00ff2ed58 widl: Make structs containing user types bogus; fix square_test_us test failure. 2007-10-09 11:39:26 +02:00
Dan Hipschman e0b209815d rpcrt4/tests: Make server.idl compatible with MIDL. 2007-10-09 11:39:21 +02:00
Alexandre Julliard b7df430831 rpcrt4/tests: Remove static keywords that hide test failures. 2007-09-27 20:13:21 +02:00
Dan Hipschman 723c8bacfa widl: Fix string codes in pointer descriptions. 2007-09-27 10:09:38 +02:00
Dan Hipschman 347f2a2da2 widl: Fix top-level conformant arrays with pointer attributes. 2007-09-27 10:09:32 +02:00
Dan Hipschman 767a1f26f6 widl: Handle top-level conformance for complex arrays. 2007-09-20 14:27:29 +02:00