Commit Graph

94 Commits

Author SHA1 Message Date
Robert Shearman 2f0e714a27 ole32: When marshaling a proxy make sure to maintain an external
reference on the stub object so that the first proxy can be released.

Implement external refcount sharing between a proxy and the marshaled proxy.

Extend the marshaling of a proxy test to show that an external reference 
is always kept on the stub object.
2006-06-29 14:40:50 +02:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Robert Shearman 875390110f ole32: Release the proxy buffer object on the last release of the proxy's outer unknown.
Release the proxy buffer object on the last release of the proxy's outer
unknown, otherwise memory is leaked for the Ndr implementation of
IRpcProxyBuffer.

Fix up the hand-coded proxies to match the behaviour from the Ndr
implementation.
2006-05-23 12:05:01 +02:00
Robert Shearman 50ec1d6849 ole32: Add on the size of the whole OBJREF structure in the case of custom marshaling. 2006-05-08 15:44:06 +02:00
Robert Shearman 7406cc210b ole: Implement IRpcChannelBuffer::GetDestCtx on the client side. 2006-03-06 11:09:34 +01:00
Robert Shearman 92a1f52b4d ole: Store the destination context and the destination context data in
the proxy manager when unmarshaling.
2006-03-06 11:08:52 +01:00
Robert Shearman 9a9981bad5 ole: Change NORMALEXTREFS to 5, like it is in native. 2006-03-01 19:54:45 +01:00
Robert Shearman 857a6d1f63 ole: Fix marshaling of proxies for interfaces that haven't already been unmarshaled. 2006-03-01 19:54:20 +01:00
Robert Shearman 781970f001 ole: Initialise hrref so as not to display garbage in the trace. 2006-01-11 12:09:17 +01:00
Robert Shearman cd2fafb775 ole: Defer apartment window creation until the first object is marshalled. 2006-01-10 20:41:23 +01:00
Robert Shearman d389b57171 - Fix a trace to refer to the object ID rather than the legacy MID.
- Fix the error case of CoMarshalInterThreadInterface to release the
  stream.
2005-09-20 11:36:40 +00:00
Robert Shearman 0ceacf017f Fix the return codes during unmarshaling so that it returns failure
codes instead of S_FALSE returned from IStream_Read.
2005-09-19 14:34:04 +00:00
Robert Shearman b3a4b59668 Fix ref-counting rules to match native DCOM Dlls. 2005-09-18 11:10:37 +00:00
Alexandre Julliard 611b5acbf8 Authors: Mike Hearn <mh@codeweavers.com>, Robert Shearman <rob@codeweavers.com>
Change stub manager to track the number of normal marshals instead of
using the state machine so that multiple marshals of the same object
and interface work correctly.
2005-09-02 11:18:45 +00:00
Robert Shearman dab603def3 - Implement IMarshal on proxies so that we don't end up with proxies
to proxies, causing potential deadlock issues and performance
  problems.
- Add a test for this situation and remove the todo_wine from another
  test that now succeeds.
2005-08-27 09:25:16 +00:00
Robert Shearman 775898ba97 - Always query for the correct stub interface, otherwise we will be
pointing to the completely wrong object when a proxy does a
  queryinterface.
- Remove assumption that the stub buffer will handle the lifetime of
  the object.
2005-07-19 19:59:41 +00:00
Mike McCormack c7fdb4565a Fix gcc 4.0 -Wpointer-sign warnings. 2005-07-05 11:02:54 +00:00
Robert Shearman 037bdc0dc0 IUnknown isn't a remotable interface so the stub manager shouldn't
need a marshaller for it.
2005-06-09 09:45:59 +00:00
Rob Shearman e46047e4da Don't disconnect proxies flagged with SORFP_NOLIFETIMEMGMT. It makes
no sense and only causes trouble for proxies that depend on these
proxies being available.
2005-06-05 19:19:24 +00:00
Robert Shearman 27d73d6115 - Add a useful trace message.
- Fix more places where custom header size was calculated exclusive of
  the data size member.
- Optimize custom marshaling by getting size before calling the custom
  marshaler so we can write the header before and not use a second
  stream.
2005-05-23 10:27:23 +00:00
Robert Shearman a890293f33 - Change remaining blocks of code with 2-space indentation to 4-space
indentation.
- Make vtables const.
- Remove an unnecessary memcpy and let the compiler do the work.
2005-05-19 12:04:58 +00:00
Robert Shearman 447ab61288 Write custom header up to and including size, not excluding. 2005-05-19 11:15:50 +00:00
Robert Shearman 1b5ebabdce - Add critsec debugging info.
- Move the modal loop called during RPCs into CoWaitForMultipleHandles.
- Use a mutex for long remoting calls to IRemUnknown methods.
- Remove locking in apartment_disconnectproxies as it is not needed.
- Use PostMessage instead of SendMessage so we can run the message
  loop or not as appropriate.
2005-03-17 10:26:20 +00:00
Robert Shearman 8971f06225 - Rename apartment functions to become more object-oriented.
- Rename register_ifstub to marshal_object to more accurately describe
  what it does.
- Add new function, apartment_getoxid, to prepare for a possible
  future patch where remoting is started on demand.
2005-03-11 10:19:10 +00:00
Robert Shearman 527ef47d70 Make each ifproxy have its own channel buffer to fix a bug where a
proxy with multiple interfaces could invoke the wrong stub buffer on
the server.
2005-03-07 17:14:11 +00:00
Mike Hearn 4d49d8ca36 Avoid infinite loop when doing a typelib marshalled
IUnknown::QueryInterface by only doing an extra QI if requested IID is
not equal to marshalled IID.
2005-02-21 18:35:07 +00:00
Robert Shearman 95288f9148 - Move marshaling state machine into stub manager from ifstub.
- Add additional needed states for table-weak marshaling, as shown by
  tests.
- Protect external reference count from underflows/overflows.
2005-02-18 20:03:23 +00:00
Robert Shearman 552cc7d5b3 - Remove cruft left over from previous RPC backend implementation in
the apartment structure.
- Don't pass an IPID by value for proxy_manager_create_ifproxy.
- Disable more of RPC_UnregisterInterface to prevent the RPC runtime
  using freed memory.
- Rename various external RPC backend functions so that they all have
  the same "RPC_" prefix.
- Reduce the timeout of the function that connects to a local server
  to 30s, like native.
2005-02-15 15:44:25 +00:00
Robert Shearman db6db7cb4c Make COM use the RPC runtime as the backend for RPC calls. Based on a
patch by Ove Kåven.
2005-02-15 15:02:49 +00:00
Robert Shearman 514af6ce78 Move object-to-stub-manager mapping rule to register_ifstub. 2005-02-08 14:26:19 +00:00
Alexandre Julliard 2a46702761 Authors: Mike Hearn <mh@codeweavers.com>, Robert Shearman <rob@codeweavers.com>
- Rework RPC dispatch layer to be simpler and not get confused by
  server/client duality.
- Make threads shut down at the right time and not access freed memory
  after apartment destruction.
- Rename stub_dispatch_thread to client_dispatch_thread.
- Add some more tracing
- Check return value of WaitNamedPipe.
- Change named pipe timeouts to 0.5s, which should be enough for even the slowest machines.
2005-02-08 12:55:26 +00:00
Robert Shearman b9aa9e0bdd - Pass the original IID to IMarshal_UnmarshalInterface and query for
the requested interface.
- Unmarshaling IID_NULL means use the IID the interface was originally
  marshaled with.
2005-02-02 19:11:23 +00:00
Robert Shearman e6afc84873 - Add code for destroying the thread-local storage data, but don't use
it yet.
- Don't release apartment on changing modes because we didn't add a
  reference anywhere.
- Quieten the RPC_E_DISCONNECTED error message as it is an expected
  return code.
- Treat IID_NULL the same as IID_IUnknown.
- Make tests compile on Win95 again.
- Fix copy+paste error where the test failure should be from the
  CoUnmarshalInterface function.
2005-02-01 14:18:10 +00:00
Robert Shearman 9b634b97ae - More tests.
- Change return code of CoGetPSClsid to match test result.
- Do a slight hack to make IRemUnknown proxies be added after the
  proxy that uses them to stop them being used after they are
  destroyed.
- Fix multiple local server connections.
2005-01-28 12:39:13 +00:00
Robert Shearman 5bef770490 Give IUnknown its own ifstub to fix ref-counting and ipid storage
issues.
2005-01-27 10:39:44 +00:00
Robert Shearman 3018974ce3 - Make proxy manager use IMultiQI instead of IInternalUnknown as tests
show that IInternalUnknown isn't exposed.
- Implement IMultiQI on top of IRemUnknown calls.
- Silence some fixmes that occur during tests and don't give us any
  useful information.
- Fix typo in class factory proxy that caused us to use the wrong
  offset into the CFProxy structure, causing us to not call the
  outer_unknown properly.
2005-01-26 21:07:05 +00:00
Robert Shearman cbbf08a7e2 - Use InterlockedIncrement for the ipid counter instead of a critical
section (suggested by Mike Hearn).
- Remove a line added by a bad merge.
- Implement RemUnkStub_Disconnect.
- Remove all of the RPC disconnect code.
2005-01-26 20:53:06 +00:00
Robert Shearman 963ac3f013 - Implement IRemUnknown.
- Use IRemUnknown for life-cycle management instead of the current
  hacks.
2005-01-26 20:42:30 +00:00
Robert Shearman ad34f3dc5e - Generate machine-local IPIDs.
- Make pipes be uniquely identified only by their IPID.
2005-01-25 10:57:24 +00:00
Robert Shearman 6b89a92215 - Add a new flag SORFP_NOLIFETIMEMGMT to tell the proxy manager not to
call any IRemUnknown functions.
- Move the low-level unmarshaling code into a new function,
  unmarshal_object, so that it can be easily reused for unmarshaling
  IRemUnknown.
2005-01-24 11:24:08 +00:00
Robert Shearman 717eb8fff4 - Consolidate more stub creation details into register_ifstub.
- Replace the current wine_marshal_id structure with STDOBJREF for the
  on-the-wire format.
2005-01-20 10:35:46 +00:00
Robert Shearman 6a20b2f476 - Initialize ppv pointer in ClientIdentity_QueryInterface to NULL as
apps depend on this.
- Don't release IRpcProxyBuffer on ifproxy destruction - the caller
  will do this for us.
- Make find_proxy_manager add a reference to the proxy manager and
  make proxy_manager_construct return an object with a valid
  ref-count.
- Remove stray not operator to fix a memory leak / crash in
  proxy_manager_destroy.
- More debug messages, especially on errors.
- Fix ref-count leak in the Class Factory proxy.
- Add a test case for IClassFactory_CreateInstance.
2005-01-19 17:00:20 +00:00
Robert Shearman b5a10936bd Initialize clsid member to the marshaler clsid to fix custom
marshaling.
2005-01-17 19:32:25 +00:00
Robert Shearman 4c8d59dd91 Implement table marshaling. 2005-01-17 13:39:40 +00:00
Robert Shearman ca608933dd Make proxy shutdown test succeed by releasing the channel on
disconnect.
2005-01-14 17:20:13 +00:00
Robert Shearman 6036a773e2 - The apartment reference should be held while the stub manager
reference is held.
- Fix same apartment-unmarshal detection.
2005-01-14 16:48:34 +00:00
Robert Shearman 2891bc53ba Remove wine_marshal_data: it is unneeded and there is no equivalent in
STDOBJREF.
2005-01-12 19:48:20 +00:00
Robert Shearman c353f85082 - Document how thread-safety is ensured for each member of the
stub_manager and ifstub structs.
- Make stub_manager ref counted to ensure it doesn't get freed whilst
  it is still being used.
- ifstubs are now freed only when the controlling stub_manager is freed.
- Rename stub_manager_ref/unref to stub_manager_ext_addref/release
  respectively and make then take an unsigned long to prevent
  malicious callers from passing in a negative value and corrupting
  the ref count.
2005-01-11 10:45:34 +00:00
Robert Shearman 86d63bbbac Rename iid in wine_marshal_id to ipid and use IPIDs instead of IIDs in
the stub manager.
2005-01-07 15:33:41 +00:00
Mike Hearn a6a416cb4e - Make apartment access thread-safe by introducing refcounting and
wider usage of the apartment lock.
- Rework OLE TLS management to eliminate uninitialised apartments and
  parent chaining.
2005-01-05 17:14:33 +00:00