ReactOS 0.4.16-dev-2320-ge1853c6
rpc.c
Go to the documentation of this file.
1/*
2 * Copyright 2001 Ove Kåven, TransGaming Technologies
3 * Copyright 2002 Marcus Meissner
4 * Copyright 2005 Mike Hearn, Rob Shearman for CodeWeavers
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <stdarg.h>
22
23#define COBJMACROS
24
25#include "windef.h"
26#include "winbase.h"
27#include "winsvc.h"
28#include "servprov.h"
29
30#include "wine/debug.h"
31#include "wine/exception.h"
32
33#include "combase_private.h"
34
35#include "irpcss.h"
36
37#ifdef __REACTOS__
38#include <wine/irot.h>
39#endif
40
42
44
45/* we only use one function to dispatch calls for all methods - we use the
46 * RPC_IF_OLE flag to tell the RPC runtime that this is the case */
49
50static struct list registered_interfaces = LIST_INIT(registered_interfaces); /* (CS csRegIf) */
53{
54 0, 0, &csRegIf,
56 0, 0, { (DWORD_PTR)(__FILE__ ": dcom registered server interfaces") }
57};
58static CRITICAL_SECTION csRegIf = { &csRegIf_debug, -1, 0, 0, 0, 0 };
59
60static struct list channel_hooks = LIST_INIT(channel_hooks); /* (CS csChannelHook) */
63{
64 0, 0, &csChannelHook,
66 0, 0, { (DWORD_PTR)(__FILE__ ": channel hooks") }
67};
68static CRITICAL_SECTION csChannelHook = { &csChannelHook_debug, -1, 0, 0, 0, 0 };
69
70static WCHAR rpctransportW[] = L"ncalrpc";
71
73{
74 struct list entry;
75 DWORD refs; /* ref count */
76 RPC_SERVER_INTERFACE If; /* interface registered with the RPC runtime */
77};
78
79/* get the pipe endpoint specified of the specified apartment */
80static inline void get_rpc_endpoint(LPWSTR endpoint, const OXID *oxid)
81{
82 /* FIXME: should get endpoint from rpcss */
83 wsprintfW(endpoint, L"\\pipe\\OLE_%016I64x", *oxid);
84}
85
86typedef struct
87{
90
91 DWORD dest_context; /* returned from GetDestCtx */
92 void *dest_context_data; /* returned from GetDestCtx */
94
95typedef struct
96{
97 RpcChannelBuffer super; /* superclass */
98
99 RPC_BINDING_HANDLE bind; /* handle to the remote server */
100 OXID oxid; /* apartment in which the channel is valid */
101 DWORD server_pid; /* id of server process */
102 HANDLE event; /* cached event handle */
103 IID iid; /* IID of the proxy this belongs to */
105
107{
108 RPCOLEMESSAGE *msg; /* message */
109 IRpcStubBuffer *stub; /* stub buffer, if applicable */
110 IRpcChannelBuffer *chan; /* server channel buffer, if applicable */
111 IID iid; /* ID of interface being called */
112 IUnknown *iface; /* interface being called */
113 HANDLE handle; /* handle that will become signaled when call finishes */
114 BOOL bypass_rpcrt; /* bypass RPC runtime? */
115 RPC_STATUS status; /* status (out) */
116 HRESULT hr; /* hresult (out) */
117};
118
120{
123 SChannelHookCallInfo channel_hook_info;
125
126 /* client only */
130};
131
132typedef struct
133{
137 /* [size_is((size+7)&~7)] */ unsigned char data[1];
139
140typedef struct
141{
144 unsigned char extent[1];
146
147typedef struct
148{
153 unsigned char extensions[1];
155
156typedef struct
157{
159 unsigned char extensions[1];
161
163{
164 struct list entry;
167};
168
170{
173};
175{
176 return malloc(size);
177}
178
180{
181 free(p);
182}
183
185{
187}
188
189static BOOL start_rpcss(void)
190{
192 SC_HANDLE scm, service;
193 BOOL ret = FALSE;
194
195 TRACE("\n");
196
197 if (!(scm = OpenSCManagerW(NULL, NULL, 0)))
198 {
199 ERR("Failed to open service manager\n");
200 return FALSE;
201 }
202
203 if (!(service = OpenServiceW(scm, L"RpcSs", SERVICE_START | SERVICE_QUERY_STATUS)))
204 {
205 ERR("Failed to open RpcSs service\n");
206 CloseServiceHandle( scm );
207 return FALSE;
208 }
209
211 {
212 ULONGLONG start_time = GetTickCount64();
213 do
214 {
215 DWORD dummy;
216
217 if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO, (BYTE *)&status, sizeof(status), &dummy))
218 break;
219 if (status.dwCurrentState == SERVICE_RUNNING)
220 {
221 ret = TRUE;
222 break;
223 }
224 if (GetTickCount64() - start_time > 30000) break;
225 Sleep( 100 );
226
227 } while (status.dwCurrentState == SERVICE_START_PENDING);
228
229 if (status.dwCurrentState != SERVICE_RUNNING)
230 WARN("RpcSs failed to start %lu\n", status.dwCurrentState);
231 }
232 else
233 ERR("Failed to start RpcSs service\n");
234
235 CloseServiceHandle(service);
237 return ret;
238}
239
240static RPC_BINDING_HANDLE get_rpc_handle(unsigned short *protseq, unsigned short *endpoint)
241{
245
247 if (status == RPC_S_OK)
248 {
251 }
252
253 return handle;
254}
255
257{
258 static RPC_BINDING_HANDLE irpcss_handle;
259
260 if (!irpcss_handle)
261 {
262 unsigned short protseq[] = IRPCSS_PROTSEQ;
263 unsigned short endpoint[] = IRPCSS_ENDPOINT;
264
265 RPC_BINDING_HANDLE new_handle = get_rpc_handle(protseq, endpoint);
266 if (InterlockedCompareExchangePointer(&irpcss_handle, new_handle, NULL))
267 /* another thread beat us to it */
268 RpcBindingFree(&new_handle);
269 }
270 return irpcss_handle;
271}
272
274{
275 static RPC_BINDING_HANDLE irot_handle;
276
277 if (!irot_handle)
278 {
279 unsigned short protseq[] = IROT_PROTSEQ;
280 unsigned short endpoint[] = IROT_ENDPOINT;
281
282 RPC_BINDING_HANDLE new_handle = get_rpc_handle(protseq, endpoint);
283 if (InterlockedCompareExchangePointer(&irot_handle, new_handle, NULL))
284 /* another thread beat us to it */
285 RpcBindingFree(&new_handle);
286 }
287 return irot_handle;
288}
289
290#define RPCSS_CALL_START \
291 HRESULT hr; \
292 for (;;) { \
293 __TRY {
294
295#define RPCSS_CALL_END \
296 } __EXCEPT(rpc_filter) { \
297 hr = HRESULT_FROM_WIN32(GetExceptionCode()); \
298 } \
299 __ENDTRY \
300 if (hr == HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)) { \
301 if (start_rpcss()) \
302 continue; \
303 } \
304 break; \
305 } \
306 return hr;
307
309{
313}
314
316 const InterfaceData *object, const InterfaceData *moniker,
317 const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
318{
320 hr = IrotRegister(get_irot_handle(), moniker_data, object, moniker, time, flags, cookie, ctxt_handle);
322}
323
325{
327 hr = IrotIsRunning(get_irot_handle(), moniker_data);
329}
330
331HRESULT WINAPI InternalIrotGetObject(const MonikerComparisonData *moniker_data, PInterfaceData *obj,
332 IrotCookie *cookie)
333{
335 hr = IrotGetObject(get_irot_handle(), moniker_data, obj, cookie);
337}
338
340{
344}
345
347{
351}
352
354{
358}
359
360HRESULT WINAPI InternalIrotRevoke(IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object,
361 PInterfaceData *moniker)
362{
364 hr = IrotRevoke(get_irot_handle(), cookie, ctxt_handle, object, moniker);
366}
367
368static HRESULT rpcss_server_register(REFCLSID clsid, DWORD flags, MInterfacePointer *obj, unsigned int *cookie)
369{
373}
374
376{
380}
381
382static HRESULT rpcss_get_class_object(REFCLSID rclsid, PMInterfacePointer *objref)
383{
385 hr = irpcss_get_class_object(get_irpcss_handle(), rclsid, objref);
387}
388
390{
391 SC_HANDLE handle, hsvc;
393
394 TRACE("Starting service %s %ld params\n", debugstr_w(name), num);
395
397 if (!handle)
398 return r;
400 if (hsvc)
401 {
402 if(StartServiceW(hsvc, num, params))
404 else
405 r = GetLastError();
408 CloseServiceHandle(hsvc);
409 }
410 else
411 r = GetLastError();
413
414 TRACE("StartService returned error %lu (%s)\n", r, (r == ERROR_SUCCESS) ? "ok":"failed");
415
416 return r;
417}
418
419/*
420 * create_local_service() - start a COM server in a service
421 *
422 * To start a Local Service, we read the AppID value under
423 * the class's CLSID key, then open the HKCR\\AppId key specified
424 * there and check for a LocalService value.
425 *
426 * Note: Local Services are not supported under Windows 9x
427 */
429{
430 HRESULT hr;
432 HKEY hkey;
433 LONG r;
434 DWORD type, sz;
435
436 TRACE("Attempting to start Local service for %s\n", debugstr_guid(rclsid));
437
438 hr = open_appidkey_from_clsid(rclsid, KEY_READ, &hkey);
439 if (FAILED(hr))
440 return hr;
441
442 /* read the LocalService and ServiceParameters values from the AppID key */
443 sz = sizeof buf;
444 r = RegQueryValueExW(hkey, L"LocalService", NULL, &type, (LPBYTE)buf, &sz);
445 if (r == ERROR_SUCCESS && type == REG_SZ)
446 {
447 DWORD num_args = 0;
448 LPWSTR args[1] = { NULL };
449
450 /*
451 * FIXME: I'm not really sure how to deal with the service parameters.
452 * I suspect that the string returned from RegQueryValueExW
453 * should be split into a number of arguments by spaces.
454 * It would make more sense if ServiceParams contained a
455 * REG_MULTI_SZ here, but it's a REG_SZ for the services
456 * that I'm interested in for the moment.
457 */
458 r = RegQueryValueExW(hkey, L"ServiceParams", NULL, &type, NULL, &sz);
459 if (r == ERROR_SUCCESS && type == REG_SZ && sz)
460 {
461 args[0] = calloc(1, sz);
462 num_args++;
463 RegQueryValueExW(hkey, L"ServiceParams", NULL, &type, (LPBYTE)args[0], &sz);
464 }
465 r = start_local_service(buf, num_args, (LPCWSTR *)args);
466 if (r != ERROR_SUCCESS)
467 hr = REGDB_E_CLASSNOTREG; /* FIXME: check retval */
468 free(args[0]);
469 }
470 else
471 {
472 WARN("No LocalService value\n");
473 hr = REGDB_E_CLASSNOTREG; /* FIXME: check retval */
474 }
475 RegCloseKey(hkey);
476
477 return hr;
478}
479
481{
482 static const WCHAR embeddingW[] = L" -Embedding";
483 HKEY key;
484 int arch = (sizeof(void *) > sizeof(int)) ? 64 : 32;
485 REGSAM opposite = (arch == 64) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
486 BOOL is_wow64 = FALSE, is_opposite = FALSE;
487 HRESULT hr;
488 WCHAR command[MAX_PATH + ARRAY_SIZE(embeddingW)];
489 DWORD size = (MAX_PATH+1) * sizeof(WCHAR);
492 LONG ret;
493
494 TRACE("Attempting to start server for %s\n", debugstr_guid(rclsid));
495
496 hr = open_key_for_clsid(rclsid, L"LocalServer32", KEY_READ, &key);
497 if (FAILED(hr) && (arch == 64 || (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
498 {
499 hr = open_key_for_clsid(rclsid, L"LocalServer32", opposite | KEY_READ, &key);
500 is_opposite = TRUE;
501 }
502 if (FAILED(hr))
503 {
504 ERR("class %s not registered\n", debugstr_guid(rclsid));
505 return hr;
506 }
507
510 if (ret)
511 {
512 WARN("No default value for LocalServer32 key\n");
513 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */
514 }
515
516 memset(&sinfo, 0, sizeof(sinfo));
517 sinfo.cb = sizeof(sinfo);
518
519 /* EXE servers are started with the -Embedding switch. */
520
521 lstrcatW(command, embeddingW);
522
523 TRACE("activating local server %s for %s\n", debugstr_w(command), debugstr_guid(rclsid));
524
525 /* FIXME: Win2003 supports a ServerExecutable value that is passed into
526 * CreateProcess */
527 if (is_opposite)
528 {
529 void *cookie;
532 {
533 WARN("failed to run local server %s\n", debugstr_w(command));
535 }
537 if (FAILED(hr)) return hr;
538 }
540 {
541 WARN("failed to run local server %s\n", debugstr_w(command));
543 }
544 *process = pinfo.hProcess;
545 CloseHandle(pinfo.hThread);
546
547 return S_OK;
548}
549
551{
552 static const WCHAR processidW[] = L" /PROCESSID:";
553 HKEY key;
554 int arch = (sizeof(void *) > sizeof(int)) ? 64 : 32;
555 REGSAM opposite = (arch == 64) ? KEY_WOW64_32KEY : KEY_WOW64_64KEY;
556 BOOL is_wow64 = FALSE, is_opposite = FALSE;
557 HRESULT hr;
559 DWORD size;
562 LONG ret;
563
564 TRACE("Attempting to start surrogate server for %s\n", debugstr_guid(rclsid));
565
566 hr = open_key_for_clsid(rclsid, NULL, KEY_READ, &key);
567 if (FAILED(hr) && (arch == 64 || (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
568 hr = open_key_for_clsid(rclsid, NULL, opposite | KEY_READ, &key);
569 if (FAILED(hr)) return hr;
571
573 if (FAILED(hr) && (arch == 64 || (IsWow64Process(GetCurrentProcess(), &is_wow64) && is_wow64)))
574 {
575 hr = open_appidkey_from_clsid(rclsid, opposite | KEY_READ, &key);
576 if (FAILED(hr)) return hr;
577 is_opposite = TRUE;
578 }
579
580 size = (MAX_PATH + 1) * sizeof(WCHAR);
581 ret = RegQueryValueExW(key, L"DllSurrogate", NULL, NULL, (LPBYTE)command, &size);
583 if (ret || !size || !command[0])
584 {
585 TRACE("No value for DllSurrogate key\n");
586
587 if ((sizeof(void *) == 8 || is_wow64) && opposite == KEY_WOW64_32KEY)
589 else
590 GetSystemDirectoryW(command, MAX_PATH - ARRAY_SIZE(L"\\dllhost.exe"));
591
592 wcscat(command, L"\\dllhost.exe");
593 }
594
595 /* Surrogate EXE servers are started with the /PROCESSID:{GUID} switch. */
596 wcscat(command, processidW);
598
599 memset(&si, 0, sizeof(si));
600 si.cb = sizeof(si);
601
602 TRACE("Activating surrogate local server %s\n", debugstr_w(command));
603
604 if (is_opposite)
605 {
606 void *cookie;
609 {
610 WARN("failed to run surrogate local server %s\n", debugstr_w(command));
612 }
614 }
616 {
617 WARN("failed to run surrogate local server %s\n", debugstr_w(command));
619 }
620
621 if (FAILED(hr)) return hr;
622
625
626 return S_OK;
627}
628
630{
631 PMInterfacePointer objref = NULL;
634 ULARGE_INTEGER newpos;
636 int tries = 0;
638 HRESULT hr;
639 static const int MAXTRIES = 30; /* 30 seconds */
640
641 TRACE("clsid %s, riid %s\n", debugstr_guid(rclsid), debugstr_guid(riid));
642
643 while (tries++ < MAXTRIES)
644 {
645 DWORD index, start_ticks;
646 HANDLE process = 0;
647
648 if (SUCCEEDED(hr = rpcss_get_class_object(rclsid, &objref)))
649 break;
650
651 if (tries == 1)
652 {
653 if ((hr = create_local_service(rclsid)) && (hr = create_server(rclsid, &process)) &&
654 (hr = create_surrogate_server(rclsid, &process)) )
655 return hr;
656 }
657
658 /* Wait for one second, even if messages arrive. */
659 start_ticks = GetTickCount();
660 do
661 {
662 if (SUCCEEDED(CoWaitForMultipleHandles(0, 1000, (process != 0), &process, &index)) && process && !index)
663 {
664 WARN("Server for %s failed to start.\n", debugstr_guid(rclsid));
666 return E_NOINTERFACE;
667 }
668 } while (GetTickCount() - start_ticks < 1000);
669
671 }
672
673 if (!objref || tries >= MAXTRIES)
674 return E_NOINTERFACE;
675
677 hr = IStream_Write(stream, objref->abData, objref->ulCntData, &length);
678
679 MIDL_user_free(objref);
680
681 if (SUCCEEDED(hr))
682 {
683 seekto.QuadPart = 0;
684 IStream_Seek(stream, seekto, STREAM_SEEK_SET, &newpos);
685
686 TRACE("Unmarshalling local server.\n");
687 hr = CoUnmarshalInterface(stream, &IID_IServiceProvider, (void **)&local_server);
688 if (SUCCEEDED(hr))
689 {
690 hr = IServiceProvider_QueryService(local_server, rclsid, riid, obj);
691 IServiceProvider_Release(local_server);
692 }
693 }
694
695 if (stream)
696 IStream_Release(stream);
697
698 return hr;
699}
700
702{
703 MInterfacePointer *obj;
704 const void *ptr;
705 HGLOBAL hmem;
706 SIZE_T size;
707 HRESULT hr;
708
709 TRACE("%s, %#lx\n", debugstr_guid(clsid), flags);
710
712 if (FAILED(hr)) return hr;
713
714 size = GlobalSize(hmem);
715 if (!(obj = malloc(FIELD_OFFSET(MInterfacePointer, abData[size]))))
716 return E_OUTOFMEMORY;
717 obj->ulCntData = size;
718 ptr = GlobalLock(hmem);
719 memcpy(obj->abData, ptr, size);
720 GlobalUnlock(hmem);
721
723
724 free(obj);
725
726 return hr;
727}
728
729static HRESULT unmarshal_ORPCTHAT(RPC_MESSAGE *msg, ORPCTHAT *orpcthat, ORPC_EXTENT_ARRAY *orpc_ext_array,
730 WIRE_ORPC_EXTENT **first_wire_orpc_extent);
731
732/* Channel Hook Functions */
733
735 unsigned int *hook_count, ULONG *extension_count)
736{
738 ULONG total_size = 0;
739 unsigned int hook_index = 0;
740
741 *hook_count = 0;
742 *extension_count = 0;
743
745
747 (*hook_count)++;
748
749 if (*hook_count)
750 *data = malloc(*hook_count * sizeof(struct channel_hook_buffer_data));
751 else
752 *data = NULL;
753
755 {
756 ULONG extension_size = 0;
757
758 IChannelHook_ClientGetSize(entry->hook, &entry->id, &info->iid, &extension_size);
759
760 TRACE("%s: extension_size = %lu\n", debugstr_guid(&entry->id), extension_size);
761
762 extension_size = (extension_size+7)&~7;
763 (*data)[hook_index].id = entry->id;
764 (*data)[hook_index].extension_size = extension_size;
765
766 /* an extension is only put onto the wire if it has data to write */
767 if (extension_size)
768 {
769 total_size += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[extension_size]);
770 (*extension_count)++;
771 }
772
773 hook_index++;
774 }
775
777
778 return total_size;
779}
780
781static unsigned char * ChannelHooks_ClientFillBuffer(SChannelHookCallInfo *info,
782 unsigned char *buffer, struct channel_hook_buffer_data *data,
783 unsigned int hook_count)
784{
786
788
790 {
791 unsigned int i;
792 ULONG extension_size = 0;
793 WIRE_ORPC_EXTENT *wire_orpc_extent = (WIRE_ORPC_EXTENT *)buffer;
794
795 for (i = 0; i < hook_count; i++)
796 if (IsEqualGUID(&entry->id, &data[i].id))
797 extension_size = data[i].extension_size;
798
799 /* an extension is only put onto the wire if it has data to write */
800 if (!extension_size)
801 continue;
802
803 IChannelHook_ClientFillBuffer(entry->hook, &entry->id, &info->iid,
804 &extension_size, buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]));
805
806 TRACE("%s: extension_size = %lu\n", debugstr_guid(&entry->id), extension_size);
807
808 /* FIXME: set unused portion of wire_orpc_extent->data to 0? */
809
810 wire_orpc_extent->conformance = (extension_size+7)&~7;
811 wire_orpc_extent->size = extension_size;
812 wire_orpc_extent->id = entry->id;
813 buffer += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[wire_orpc_extent->conformance]);
814 }
815
817
818 return buffer;
819}
820
821static void ChannelHooks_ServerNotify(SChannelHookCallInfo *info,
822 DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent,
823 ULONG extension_count)
824{
826 ULONG i;
827
829
831 {
832 WIRE_ORPC_EXTENT *wire_orpc_extent;
833 for (i = 0, wire_orpc_extent = first_wire_orpc_extent;
834 i < extension_count;
835 i++, wire_orpc_extent = (WIRE_ORPC_EXTENT *)&wire_orpc_extent->data[wire_orpc_extent->conformance])
836 {
837 if (IsEqualGUID(&entry->id, &wire_orpc_extent->id))
838 break;
839 }
840 if (i == extension_count) wire_orpc_extent = NULL;
841
842 IChannelHook_ServerNotify(entry->hook, &entry->id, &info->iid,
843 wire_orpc_extent ? wire_orpc_extent->size : 0,
844 wire_orpc_extent ? wire_orpc_extent->data : NULL,
845 lDataRep);
846 }
847
849}
850
851static ULONG ChannelHooks_ServerGetSize(SChannelHookCallInfo *info,
852 struct channel_hook_buffer_data **data, unsigned int *hook_count,
853 ULONG *extension_count)
854{
856 ULONG total_size = 0;
857 unsigned int hook_index = 0;
858
859 *hook_count = 0;
860 *extension_count = 0;
861
863
865 (*hook_count)++;
866
867 if (*hook_count)
868 *data = malloc(*hook_count * sizeof(struct channel_hook_buffer_data));
869 else
870 *data = NULL;
871
873 {
874 ULONG extension_size = 0;
875
876 IChannelHook_ServerGetSize(entry->hook, &entry->id, &info->iid, S_OK,
877 &extension_size);
878
879 TRACE("%s: extension_size = %lu\n", debugstr_guid(&entry->id), extension_size);
880
881 extension_size = (extension_size+7)&~7;
882 (*data)[hook_index].id = entry->id;
883 (*data)[hook_index].extension_size = extension_size;
884
885 /* an extension is only put onto the wire if it has data to write */
886 if (extension_size)
887 {
888 total_size += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[extension_size]);
889 (*extension_count)++;
890 }
891
892 hook_index++;
893 }
894
896
897 return total_size;
898}
899
900static unsigned char * ChannelHooks_ServerFillBuffer(SChannelHookCallInfo *info,
901 unsigned char *buffer, struct channel_hook_buffer_data *data,
902 unsigned int hook_count)
903{
905
907
909 {
910 unsigned int i;
911 ULONG extension_size = 0;
912 WIRE_ORPC_EXTENT *wire_orpc_extent = (WIRE_ORPC_EXTENT *)buffer;
913
914 for (i = 0; i < hook_count; i++)
915 if (IsEqualGUID(&entry->id, &data[i].id))
916 extension_size = data[i].extension_size;
917
918 /* an extension is only put onto the wire if it has data to write */
919 if (!extension_size)
920 continue;
921
922 IChannelHook_ServerFillBuffer(entry->hook, &entry->id, &info->iid,
923 &extension_size, buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]),
924 S_OK);
925
926 TRACE("%s: extension_size = %lu\n", debugstr_guid(&entry->id), extension_size);
927
928 /* FIXME: set unused portion of wire_orpc_extent->data to 0? */
929
930 wire_orpc_extent->conformance = (extension_size+7)&~7;
931 wire_orpc_extent->size = extension_size;
932 wire_orpc_extent->id = entry->id;
933 buffer += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[wire_orpc_extent->conformance]);
934 }
935
937
938 return buffer;
939}
940
941static void ChannelHooks_ClientNotify(SChannelHookCallInfo *info,
942 DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent,
943 ULONG extension_count, HRESULT hrFault)
944{
946 ULONG i;
947
949
951 {
952 WIRE_ORPC_EXTENT *wire_orpc_extent;
953 for (i = 0, wire_orpc_extent = first_wire_orpc_extent;
954 i < extension_count;
955 i++, wire_orpc_extent = (WIRE_ORPC_EXTENT *)&wire_orpc_extent->data[wire_orpc_extent->conformance])
956 {
957 if (IsEqualGUID(&entry->id, &wire_orpc_extent->id))
958 break;
959 }
960 if (i == extension_count) wire_orpc_extent = NULL;
961
962 IChannelHook_ClientNotify(entry->hook, &entry->id, &info->iid,
963 wire_orpc_extent ? wire_orpc_extent->size : 0,
964 wire_orpc_extent ? wire_orpc_extent->data : NULL,
965 lDataRep, hrFault);
966 }
967
969}
970
972{
974
975 entry = malloc(sizeof(*entry));
976 if (!entry)
977 return E_OUTOFMEMORY;
978
979 entry->id = *rguid;
980 entry->hook = hook;
981 IChannelHook_AddRef(hook);
982
986
987 return S_OK;
988}
989
991{
993 struct channel_hook_entry *cursor2;
994
997 free(cursor);
1001}
1002
1003/* RPC Channel Buffer Functions */
1004
1006{
1007 *ppv = NULL;
1008 if (IsEqualIID(riid,&IID_IRpcChannelBuffer) || IsEqualIID(riid,&IID_IUnknown))
1009 {
1010 *ppv = iface;
1011 IRpcChannelBuffer_AddRef(iface);
1012 return S_OK;
1013 }
1014 return E_NOINTERFACE;
1015}
1016
1018{
1020 return InterlockedIncrement(&This->refs);
1021}
1022
1024{
1026 ULONG ref;
1027
1028 ref = InterlockedDecrement(&This->refs);
1029 if (ref)
1030 return ref;
1031
1032 free(This);
1033 return 0;
1034}
1035
1037{
1039 ULONG ref;
1040
1041 ref = InterlockedDecrement(&This->super.refs);
1042 if (ref)
1043 return ref;
1044
1045 if (This->event) CloseHandle(This->event);
1046 RpcBindingFree(&This->bind);
1047 free(This);
1048 return 0;
1049}
1050
1052{
1054 RPC_MESSAGE *msg = (RPC_MESSAGE *)olemsg;
1056 ORPCTHAT *orpcthat;
1058 ULONG extensions_size;
1059 struct channel_hook_buffer_data *channel_hook_data;
1060 unsigned int channel_hook_count;
1061 ULONG extension_count;
1062
1063 TRACE("(%p)->(%p,%s)\n", This, olemsg, debugstr_guid(riid));
1064
1065 message_state = msg->Handle;
1066 /* restore the binding handle and the real start of data */
1067 msg->Handle = message_state->binding_handle;
1068 msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1069
1071 &channel_hook_data, &channel_hook_count, &extension_count);
1072
1073 msg->BufferLength += FIELD_OFFSET(WIRE_ORPCTHAT, extensions) + sizeof(DWORD);
1074 if (extensions_size)
1075 {
1076 msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent[2*sizeof(DWORD) + extensions_size]);
1077 if (extension_count & 1)
1078 msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
1079 }
1080
1082 {
1083 msg->Buffer = malloc(msg->BufferLength);
1084 if (msg->Buffer)
1085 status = RPC_S_OK;
1086 else
1087 {
1088 free(channel_hook_data);
1089 return E_OUTOFMEMORY;
1090 }
1091 }
1092 else
1094
1095 orpcthat = msg->Buffer;
1096 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHAT, extensions);
1097
1098 orpcthat->flags = ORPCF_NULL /* FIXME? */;
1099
1100 /* NDR representation of orpcthat->extensions */
1101 *(DWORD *)msg->Buffer = extensions_size ? 1 : 0;
1102 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1103
1104 if (extensions_size)
1105 {
1106 WIRE_ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer;
1107 orpc_extent_array->size = extension_count;
1108 orpc_extent_array->reserved = 0;
1109 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
1110 /* NDR representation of orpc_extent_array->extent */
1111 *(DWORD *)msg->Buffer = 1;
1112 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1113 /* NDR representation of [size_is] attribute of orpc_extent_array->extent */
1114 *(DWORD *)msg->Buffer = (extension_count + 1) & ~1;
1115 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1116
1118 msg->Buffer, channel_hook_data, channel_hook_count);
1119
1120 /* we must add a dummy extension if there is an odd extension
1121 * count to meet the contract specified by the size_is attribute */
1122 if (extension_count & 1)
1123 {
1124 WIRE_ORPC_EXTENT *wire_orpc_extent = msg->Buffer;
1125 wire_orpc_extent->conformance = 0;
1126 wire_orpc_extent->id = GUID_NULL;
1127 wire_orpc_extent->size = 0;
1128 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
1129 }
1130 }
1131
1132 free(channel_hook_data);
1133
1134 /* store the prefixed data length so that we can restore the real buffer
1135 * later */
1136 message_state->prefix_data_len = (char *)msg->Buffer - (char *)orpcthat;
1137 msg->BufferLength -= message_state->prefix_data_len;
1138 /* save away the message state again */
1139 msg->Handle = message_state;
1140
1141 TRACE("-- %ld\n", status);
1142
1143 return HRESULT_FROM_WIN32(status);
1144}
1145
1147{
1148 HANDLE event = InterlockedExchangePointer(&This->event, NULL);
1149
1150 /* Note: must be auto-reset event so we can reuse it without a call
1151 * to ResetEvent */
1152 if (!event) event = CreateEventW(NULL, FALSE, FALSE, NULL);
1153
1154 return event;
1155}
1156
1158{
1160 /* already a handle cached in This */
1162}
1163
1165{
1167 RPC_MESSAGE *msg = (RPC_MESSAGE *)olemsg;
1170 ORPCTHIS *orpcthis;
1172 ULONG extensions_size;
1173 struct channel_hook_buffer_data *channel_hook_data;
1174 unsigned int channel_hook_count;
1175 ULONG extension_count;
1176 IPID ipid;
1177 HRESULT hr;
1178 struct apartment *apt = NULL;
1179
1180 TRACE("(%p)->(%p,%s)\n", This, olemsg, debugstr_guid(riid));
1181
1182 cif = calloc(1, sizeof(RPC_CLIENT_INTERFACE));
1183 if (!cif)
1184 return E_OUTOFMEMORY;
1185
1187 if (!message_state)
1188 {
1189 free(cif);
1190 return E_OUTOFMEMORY;
1191 }
1192
1193 cif->Length = sizeof(RPC_CLIENT_INTERFACE);
1194 /* RPC interface ID = COM interface ID */
1195 cif->InterfaceId.SyntaxGUID = This->iid;
1196 /* COM objects always have a version of 0.0 */
1199 msg->Handle = This->bind;
1200 msg->RpcInterfaceInformation = cif;
1201
1204
1208 message_state->channel_hook_info.dwServerPid = This->server_pid;
1209 message_state->channel_hook_info.iMethod = msg->ProcNum & ~RPC_FLAGS_VALID_BIT;
1210 message_state->channel_hook_info.pObject = NULL; /* only present on server-side */
1214
1216 &channel_hook_data, &channel_hook_count, &extension_count);
1217
1218 msg->BufferLength += FIELD_OFFSET(WIRE_ORPCTHIS, extensions) + sizeof(DWORD);
1219 if (extensions_size)
1220 {
1221 msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent[2*sizeof(DWORD) + extensions_size]);
1222 if (extension_count & 1)
1223 msg->BufferLength += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
1224 }
1225
1227 hr = ipid_get_dispatch_params(&ipid, &apt, NULL, &message_state->params.stub,
1228 &message_state->params.chan,
1229 &message_state->params.iid,
1230 &message_state->params.iface);
1231 if (hr == S_OK)
1232 {
1233 /* stub, chan, iface and iid are unneeded in multi-threaded case as we go
1234 * via the RPC runtime */
1235 if (apt->multi_threaded)
1236 {
1237 IRpcStubBuffer_Release(message_state->params.stub);
1238 message_state->params.stub = NULL;
1239 IRpcChannelBuffer_Release(message_state->params.chan);
1240 message_state->params.chan = NULL;
1241 message_state->params.iface = NULL;
1242 }
1243 else
1244 {
1245 message_state->params.bypass_rpcrt = TRUE;
1248 /* we assume later on that this being non-NULL is the indicator that
1249 * means call directly instead of going through RPC runtime */
1251 ERR("window for apartment %s is NULL\n", wine_dbgstr_longlong(apt->oxid));
1252 }
1253 }
1254 if (apt) apartment_release(apt);
1256 /* Note: message_state->params.msg is initialised in
1257 * ClientRpcChannelBuffer_SendReceive */
1258
1259 /* shortcut the RPC runtime */
1261 {
1262 msg->Buffer = malloc(msg->BufferLength);
1263 if (msg->Buffer)
1264 status = RPC_S_OK;
1265 else
1267 }
1268 else
1270
1271 msg->Handle = message_state;
1272
1273 if (status == RPC_S_OK)
1274 {
1275 orpcthis = msg->Buffer;
1276 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHIS, extensions);
1277
1278 orpcthis->version.MajorVersion = COM_MAJOR_VERSION;
1279 orpcthis->version.MinorVersion = COM_MINOR_VERSION;
1280 orpcthis->flags = message_state->channel_hook_info.dwServerPid ? ORPCF_LOCAL : ORPCF_NULL;
1281 orpcthis->reserved1 = 0;
1282 orpcthis->cid = message_state->channel_hook_info.uCausality;
1283
1284 /* NDR representation of orpcthis->extensions */
1285 *(DWORD *)msg->Buffer = extensions_size ? 1 : 0;
1286 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1287
1288 if (extensions_size)
1289 {
1290 ORPC_EXTENT_ARRAY *orpc_extent_array = msg->Buffer;
1291 orpc_extent_array->size = extension_count;
1292 orpc_extent_array->reserved = 0;
1293 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
1294 /* NDR representation of orpc_extent_array->extent */
1295 *(DWORD *)msg->Buffer = 1;
1296 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1297 /* NDR representation of [size_is] attribute of orpc_extent_array->extent */
1298 *(DWORD *)msg->Buffer = (extension_count + 1) & ~1;
1299 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1300
1302 msg->Buffer, channel_hook_data, channel_hook_count);
1303
1304 /* we must add a dummy extension if there is an odd extension
1305 * count to meet the contract specified by the size_is attribute */
1306 if (extension_count & 1)
1307 {
1308 WIRE_ORPC_EXTENT *wire_orpc_extent = msg->Buffer;
1309 wire_orpc_extent->conformance = 0;
1310 wire_orpc_extent->id = GUID_NULL;
1311 wire_orpc_extent->size = 0;
1312 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
1313 }
1314 }
1315
1316 /* store the prefixed data length so that we can restore the real buffer
1317 * pointer in ClientRpcChannelBuffer_SendReceive. */
1318 message_state->prefix_data_len = (char *)msg->Buffer - (char *)orpcthis;
1319 msg->BufferLength -= message_state->prefix_data_len;
1320 }
1321
1322 free(channel_hook_data);
1323
1324 TRACE("-- %ld\n", status);
1325
1326 return HRESULT_FROM_WIN32(status);
1327}
1328
1329static HRESULT WINAPI ServerRpcChannelBuffer_SendReceive(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg, ULONG *pstatus)
1330{
1331 FIXME("stub\n");
1332 return E_NOTIMPL;
1333}
1334
1335/* this thread runs an outgoing RPC */
1337{
1338 struct dispatch_params *data = param;
1339
1340 /* Note: I_RpcSendReceive doesn't raise exceptions like the higher-level
1341 * RPC functions do */
1342 data->status = I_RpcSendReceive((RPC_MESSAGE *)data->msg);
1343
1344 TRACE("completed with status %#lx\n", data->status);
1345
1346 SetEvent(data->handle);
1347
1348 return 0;
1349}
1350
1352{
1353 if (!apt)
1354 return S_FALSE;
1355 if (This->oxid != apartment_getoxid(apt))
1356 return S_FALSE;
1357 return S_OK;
1358}
1359
1361{
1363 HRESULT hr;
1364 RPC_MESSAGE *msg = (RPC_MESSAGE *)olemsg;
1366 DWORD index;
1368 ORPCTHAT orpcthat;
1369 ORPC_EXTENT_ARRAY orpc_ext_array;
1370 WIRE_ORPC_EXTENT *first_wire_orpc_extent = NULL;
1371 HRESULT hrFault = S_OK;
1373 struct tlsdata *tlsdata;
1374
1375 TRACE("%p, iMethod %ld\n", olemsg, olemsg->iMethod);
1376
1378 if (hr != S_OK)
1379 {
1380 ERR("called from wrong apartment, should have been 0x%s\n",
1381 wine_dbgstr_longlong(This->oxid));
1383 return RPC_E_WRONG_THREAD;
1384 }
1385
1387 return hr;
1388
1389 /* This situation should be impossible in multi-threaded apartments,
1390 * because the calling thread isn't re-enterable.
1391 * Note: doing a COM call during the processing of a sent message is
1392 * only disallowed if a client call is already being waited for
1393 * completion */
1394 if (!apt->multi_threaded &&
1396 InSendMessage())
1397 {
1398 ERR("can't make an outgoing COM call in response to a sent message\n");
1401 }
1402
1403 message_state = msg->Handle;
1404 /* restore the binding handle and the real start of data */
1405 msg->Handle = message_state->binding_handle;
1406 msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1407 msg->BufferLength += message_state->prefix_data_len;
1408
1409 /* Note: this is an optimization in the Microsoft OLE runtime that we need
1410 * to copy, as shown by the test_no_couninitialize_client test. without
1411 * short-circuiting the RPC runtime in the case below, the test will
1412 * deadlock on the loader lock due to the RPC runtime needing to create
1413 * a thread to process the RPC when this function is called indirectly
1414 * from DllMain */
1415
1416 message_state->params.msg = olemsg;
1417 if (message_state->params.bypass_rpcrt)
1418 {
1419 TRACE("Calling apartment thread %#lx...\n", message_state->target_tid);
1420
1421 msg->ProcNum &= ~RPC_FLAGS_VALID_BIT;
1422
1425 {
1426 ERR("PostMessage failed with error %lu\n", GetLastError());
1427
1428 /* Note: message_state->params.iface doesn't have a reference and
1429 * so doesn't need to be released */
1430
1432 }
1433 }
1434 else
1435 {
1436 /* we use a separate thread here because we need to be able to
1437 * pump the message loop in the application thread: if we do not,
1438 * any windows created by this thread will hang and RPCs that try
1439 * and re-enter this STA from an incoming server thread will
1440 * deadlock. InstallShield is an example of that.
1441 */
1443 {
1444 ERR("QueueUserWorkItem failed with error %lu\n", GetLastError());
1445 hr = E_UNEXPECTED;
1446 }
1447 else
1448 hr = S_OK;
1449 }
1450
1451 if (hr == S_OK)
1452 {
1454 {
1458 }
1459 }
1461
1462 /* for WM shortcut, faults are returned in params->hr */
1463 if (hr == S_OK)
1464 hrFault = message_state->params.hr;
1465
1466 status = message_state->params.status;
1467
1468 orpcthat.flags = ORPCF_NULL;
1469 orpcthat.extensions = NULL;
1470
1471 TRACE("RPC call status: %#lx\n", status);
1472 if (status != RPC_S_OK)
1474
1475 TRACE("hrFault = %#lx\n", hrFault);
1476
1477 /* FIXME: this condition should be
1478 * "hr == S_OK && (!hrFault || msg->BufferLength > FIELD_OFFSET(ORPCTHAT, extensions) + 4)"
1479 * but we don't currently reset the message length for PostMessage
1480 * dispatched calls */
1481 if (hr == S_OK && hrFault == S_OK)
1482 {
1483 HRESULT hr2;
1484 char *original_buffer = msg->Buffer;
1485
1486 /* handle ORPCTHAT and client extensions */
1487
1488 hr2 = unmarshal_ORPCTHAT(msg, &orpcthat, &orpc_ext_array, &first_wire_orpc_extent);
1489 if (FAILED(hr2))
1490 hr = hr2;
1491
1492 message_state->prefix_data_len = (char *)msg->Buffer - original_buffer;
1493 msg->BufferLength -= message_state->prefix_data_len;
1494 }
1495 else
1497
1498 if (hr == S_OK)
1499 {
1501 msg->DataRepresentation,
1502 first_wire_orpc_extent,
1503 orpcthat.extensions && first_wire_orpc_extent ? orpcthat.extensions->size : 0,
1504 hrFault);
1505 }
1506
1507 /* save away the message state again */
1508 msg->Handle = message_state;
1509
1510 if (pstatus) *pstatus = status;
1511
1512 if (hr == S_OK)
1513 hr = hrFault;
1514
1515 TRACE("-- %#lx\n", hr);
1516
1518 return hr;
1519}
1520
1522{
1523 RPC_MESSAGE *msg = (RPC_MESSAGE *)olemsg;
1526
1527 TRACE("(%p)\n", msg);
1528
1529 message_state = msg->Handle;
1530 /* restore the binding handle and the real start of data */
1531 msg->Handle = message_state->binding_handle;
1532 msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1533 msg->BufferLength += message_state->prefix_data_len;
1535
1537 {
1538 free(msg->Buffer);
1539 status = RPC_S_OK;
1540 }
1541 else
1543
1544 msg->Handle = message_state;
1545
1546 TRACE("-- %ld\n", status);
1547
1548 return HRESULT_FROM_WIN32(status);
1549}
1550
1552{
1553 RPC_MESSAGE *msg = (RPC_MESSAGE *)olemsg;
1556
1557 TRACE("(%p)\n", msg);
1558
1559 message_state = msg->Handle;
1560 /* restore the binding handle and the real start of data */
1561 msg->Handle = message_state->binding_handle;
1562 msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1563 msg->BufferLength += message_state->prefix_data_len;
1564
1565 if (message_state->params.bypass_rpcrt)
1566 {
1567 free(msg->Buffer);
1568 status = RPC_S_OK;
1569 }
1570 else
1572
1573 free(msg->RpcInterfaceInformation);
1574 msg->RpcInterfaceInformation = NULL;
1575
1576 if (message_state->params.stub)
1577 IRpcStubBuffer_Release(message_state->params.stub);
1578 if (message_state->params.chan)
1579 IRpcChannelBuffer_Release(message_state->params.chan);
1581
1582 TRACE("-- %ld\n", status);
1583
1584 return HRESULT_FROM_WIN32(status);
1585}
1586
1587static HRESULT WINAPI ClientRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD* pdwDestContext, void** ppvDestContext)
1588{
1590
1591 TRACE("(%p,%p)\n", pdwDestContext, ppvDestContext);
1592
1593 *pdwDestContext = This->super.dest_context;
1594 *ppvDestContext = This->super.dest_context_data;
1595
1596 return S_OK;
1597}
1598
1599static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD* dest_context, void** dest_context_data)
1600{
1602
1603 TRACE("(%p,%p)\n", dest_context, dest_context_data);
1604
1605 *dest_context = This->dest_context;
1606 *dest_context_data = This->dest_context_data;
1607 return S_OK;
1608}
1609
1611{
1612 TRACE("()\n");
1613 /* native does nothing too */
1614 return S_OK;
1615}
1616
1617static const IRpcChannelBufferVtbl ClientRpcChannelBufferVtbl =
1618{
1627};
1628
1629static const IRpcChannelBufferVtbl ServerRpcChannelBufferVtbl =
1630{
1639};
1640
1641/* returns a channel buffer for proxies */
1643 const OXID_INFO *oxid_info, const IID *iid,
1644 DWORD dest_context, void *dest_context_data,
1645 IRpcChannelBuffer **chan, struct apartment *apt)
1646{
1648 WCHAR endpoint[200];
1651 LPWSTR string_binding;
1652
1653 /* FIXME: get the endpoint from oxid_info->psa instead */
1655
1656 TRACE("proxy pipe: connecting to endpoint: %s\n", debugstr_w(endpoint));
1657
1659 NULL,
1661 NULL,
1662 endpoint,
1663 NULL,
1664 &string_binding);
1665
1666 if (status == RPC_S_OK)
1667 {
1668 status = RpcBindingFromStringBindingW(string_binding, &bind);
1669
1670 if (status == RPC_S_OK)
1671 {
1672 IPID ipid2 = *ipid; /* why can't RpcBindingSetObject take a const? */
1673 status = RpcBindingSetObject(bind, &ipid2);
1674 if (status != RPC_S_OK)
1676 }
1677
1678 RpcStringFreeW(&string_binding);
1679 }
1680
1681 if (status != RPC_S_OK)
1682 {
1683 ERR("Couldn't get binding for endpoint %s, status = %ld\n", debugstr_w(endpoint), status);
1684 return HRESULT_FROM_WIN32(status);
1685 }
1686
1687 This = malloc(sizeof(*This));
1688 if (!This)
1689 {
1691 return E_OUTOFMEMORY;
1692 }
1693
1694 This->super.IRpcChannelBuffer_iface.lpVtbl = &ClientRpcChannelBufferVtbl;
1695 This->super.refs = 1;
1696 This->super.dest_context = dest_context;
1697 This->super.dest_context_data = dest_context_data;
1698 This->bind = bind;
1699 This->oxid = apartment_getoxid(apt);
1700 This->server_pid = oxid_info->dwPid;
1701 This->event = NULL;
1702 This->iid = *iid;
1703
1704 *chan = &This->super.IRpcChannelBuffer_iface;
1705
1706 return S_OK;
1707}
1708
1709HRESULT rpc_create_serverchannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan)
1710{
1711 RpcChannelBuffer *This = malloc(sizeof(*This));
1712 if (!This)
1713 return E_OUTOFMEMORY;
1714
1715 This->IRpcChannelBuffer_iface.lpVtbl = &ServerRpcChannelBufferVtbl;
1716 This->refs = 1;
1717 This->dest_context = dest_context;
1718 This->dest_context_data = dest_context_data;
1719
1720 *chan = &This->IRpcChannelBuffer_iface;
1721
1722 return S_OK;
1723}
1724
1725/* unmarshals ORPC_EXTENT_ARRAY according to NDR rules, but doesn't allocate
1726 * any memory */
1728 ORPC_EXTENT_ARRAY *extensions,
1729 WIRE_ORPC_EXTENT **first_wire_orpc_extent)
1730{
1731 DWORD pointer_id;
1732 DWORD i;
1733
1734 memcpy(extensions, msg->Buffer, FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent));
1735 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT_ARRAY, extent);
1736
1737 if ((const char *)msg->Buffer + 2 * sizeof(DWORD) > end)
1738 return RPC_E_INVALID_HEADER;
1739
1740 pointer_id = *(DWORD *)msg->Buffer;
1741 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1742 extensions->extent = NULL;
1743
1744 if (pointer_id)
1745 {
1746 WIRE_ORPC_EXTENT *wire_orpc_extent;
1747
1748 /* conformance */
1749 if (*(DWORD *)msg->Buffer != ((extensions->size+1)&~1))
1750 return RPC_S_INVALID_BOUND;
1751
1752 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1753
1754 /* arbitrary limit for security (don't know what native does) */
1755 if (extensions->size > 256)
1756 {
1757 ERR("too many extensions: %ld\n", extensions->size);
1758 return RPC_S_INVALID_BOUND;
1759 }
1760
1761 *first_wire_orpc_extent = wire_orpc_extent = msg->Buffer;
1762 for (i = 0; i < ((extensions->size+1)&~1); i++)
1763 {
1764 if ((const char *)&wire_orpc_extent->data[0] > end)
1765 return RPC_S_INVALID_BOUND;
1766 if (wire_orpc_extent->conformance != ((wire_orpc_extent->size+7)&~7))
1767 return RPC_S_INVALID_BOUND;
1768 if ((const char *)&wire_orpc_extent->data[wire_orpc_extent->conformance] > end)
1769 return RPC_S_INVALID_BOUND;
1770 TRACE("size %lu, guid %s\n", wire_orpc_extent->size, debugstr_guid(&wire_orpc_extent->id));
1771 wire_orpc_extent = (WIRE_ORPC_EXTENT *)&wire_orpc_extent->data[wire_orpc_extent->conformance];
1772 }
1773 msg->Buffer = wire_orpc_extent;
1774 }
1775
1776 return S_OK;
1777}
1778
1779/* unmarshals ORPCTHIS according to NDR rules, but doesn't allocate any memory */
1780static HRESULT unmarshal_ORPCTHIS(RPC_MESSAGE *msg, ORPCTHIS *orpcthis,
1781 ORPC_EXTENT_ARRAY *orpc_ext_array, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
1782{
1783 const char *end = (char *)msg->Buffer + msg->BufferLength;
1784
1785 *first_wire_orpc_extent = NULL;
1786
1787 if (msg->BufferLength < FIELD_OFFSET(WIRE_ORPCTHIS, extensions) + sizeof(DWORD))
1788 {
1789 ERR("invalid buffer length\n");
1790 return RPC_E_INVALID_HEADER;
1791 }
1792
1793 memcpy(orpcthis, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHIS, extensions));
1794 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHIS, extensions);
1795
1796 if ((const char *)msg->Buffer + sizeof(DWORD) > end)
1797 return RPC_E_INVALID_HEADER;
1798
1799 if (*(DWORD *)msg->Buffer)
1800 orpcthis->extensions = orpc_ext_array;
1801 else
1802 orpcthis->extensions = NULL;
1803
1804 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1805
1806 if (orpcthis->extensions)
1807 {
1808 HRESULT hr = unmarshal_ORPC_EXTENT_ARRAY(msg, end, orpc_ext_array,
1809 first_wire_orpc_extent);
1810 if (FAILED(hr))
1811 return hr;
1812 }
1813
1814 if ((orpcthis->version.MajorVersion != COM_MAJOR_VERSION) ||
1815 (orpcthis->version.MinorVersion > COM_MINOR_VERSION))
1816 {
1817 ERR("COM version {%d, %d} not supported\n",
1818 orpcthis->version.MajorVersion, orpcthis->version.MinorVersion);
1820 }
1821
1822 if (orpcthis->flags & ~(ORPCF_LOCAL|ORPCF_RESERVED1|ORPCF_RESERVED2|ORPCF_RESERVED3|ORPCF_RESERVED4))
1823 {
1824 ERR("invalid flags %#lx\n", orpcthis->flags & ~(ORPCF_LOCAL|ORPCF_RESERVED1|ORPCF_RESERVED2|ORPCF_RESERVED3|ORPCF_RESERVED4));
1825 return RPC_E_INVALID_HEADER;
1826 }
1827
1828 return S_OK;
1829}
1830
1831static HRESULT unmarshal_ORPCTHAT(RPC_MESSAGE *msg, ORPCTHAT *orpcthat,
1832 ORPC_EXTENT_ARRAY *orpc_ext_array, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
1833{
1834 const char *end = (char *)msg->Buffer + msg->BufferLength;
1835
1836 *first_wire_orpc_extent = NULL;
1837
1838 if (msg->BufferLength < FIELD_OFFSET(WIRE_ORPCTHAT, extensions) + sizeof(DWORD))
1839 {
1840 ERR("invalid buffer length\n");
1841 return RPC_E_INVALID_HEADER;
1842 }
1843
1844 memcpy(orpcthat, msg->Buffer, FIELD_OFFSET(WIRE_ORPCTHAT, extensions));
1845 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPCTHAT, extensions);
1846
1847 if ((const char *)msg->Buffer + sizeof(DWORD) > end)
1848 return RPC_E_INVALID_HEADER;
1849
1850 if (*(DWORD *)msg->Buffer)
1851 orpcthat->extensions = orpc_ext_array;
1852 else
1853 orpcthat->extensions = NULL;
1854
1855 msg->Buffer = (char *)msg->Buffer + sizeof(DWORD);
1856
1857 if (orpcthat->extensions)
1858 {
1859 HRESULT hr = unmarshal_ORPC_EXTENT_ARRAY(msg, end, orpc_ext_array,
1860 first_wire_orpc_extent);
1861 if (FAILED(hr))
1862 return hr;
1863 }
1864
1865 if (orpcthat->flags & ~(ORPCF_LOCAL|ORPCF_RESERVED1|ORPCF_RESERVED2|ORPCF_RESERVED3|ORPCF_RESERVED4))
1866 {
1867 ERR("invalid flags %#lx\n", orpcthat->flags & ~(ORPCF_LOCAL|ORPCF_RESERVED1|ORPCF_RESERVED2|ORPCF_RESERVED3|ORPCF_RESERVED4));
1868 return RPC_E_INVALID_HEADER;
1869 }
1870
1871 return S_OK;
1872}
1873
1875{
1877 RPC_MESSAGE *msg = (RPC_MESSAGE *)params->msg;
1878 char *original_buffer = msg->Buffer;
1879 ORPCTHIS orpcthis;
1880 ORPC_EXTENT_ARRAY orpc_ext_array;
1881 WIRE_ORPC_EXTENT *first_wire_orpc_extent;
1882 GUID old_causality_id;
1883 struct tlsdata *tlsdata;
1884 struct apartment *apt;
1885
1887 return;
1888
1889 apt = com_get_current_apt();
1890
1891 /* handle ORPCTHIS and server extensions */
1892
1893 params->hr = unmarshal_ORPCTHIS(msg, &orpcthis, &orpc_ext_array, &first_wire_orpc_extent);
1894 if (params->hr != S_OK)
1895 {
1896 msg->Buffer = original_buffer;
1897 goto exit;
1898 }
1899
1901 if (!message_state)
1902 {
1903 params->hr = E_OUTOFMEMORY;
1904 msg->Buffer = original_buffer;
1905 goto exit;
1906 }
1907
1908 message_state->prefix_data_len = (char *)msg->Buffer - original_buffer;
1909 message_state->binding_handle = msg->Handle;
1910 message_state->bypass_rpcrt = params->bypass_rpcrt;
1911
1914 message_state->channel_hook_info.uCausality = orpcthis.cid;
1916 message_state->channel_hook_info.iMethod = msg->ProcNum;
1917 message_state->channel_hook_info.pObject = params->iface;
1918
1919 if (orpcthis.extensions && first_wire_orpc_extent &&
1920 orpcthis.extensions->size)
1921 ChannelHooks_ServerNotify(&message_state->channel_hook_info, msg->DataRepresentation, first_wire_orpc_extent, orpcthis.extensions->size);
1922
1923 msg->Handle = message_state;
1924 msg->BufferLength -= message_state->prefix_data_len;
1925
1926 /* call message filter */
1927
1928 if (apt->filter)
1929 {
1930 DWORD handlecall;
1931 INTERFACEINFO interface_info;
1932 CALLTYPE calltype;
1933
1934 interface_info.pUnk = params->iface;
1935 interface_info.iid = params->iid;
1936 interface_info.wMethod = msg->ProcNum;
1937
1938 if (IsEqualGUID(&orpcthis.cid, &tlsdata->causality_id))
1939 calltype = CALLTYPE_NESTED;
1940 else if (tlsdata->pending_call_count_server == 0)
1941 calltype = CALLTYPE_TOPLEVEL;
1942 else
1943 calltype = CALLTYPE_TOPLEVEL_CALLPENDING;
1944
1945 handlecall = IMessageFilter_HandleInComingCall(apt->filter,
1946 calltype,
1948 0 /* FIXME */,
1950 TRACE("IMessageFilter_HandleInComingCall returned %ld\n", handlecall);
1951 switch (handlecall)
1952 {
1953 case SERVERCALL_REJECTED:
1955 goto exit_reset_state;
1956 case SERVERCALL_RETRYLATER:
1957#if 0 /* FIXME: handle retries on the client side before enabling this code */
1958 params->hr = RPC_E_RETRY;
1959 goto exit_reset_state;
1960#else
1961 FIXME("retry call later not implemented\n");
1962 break;
1963#endif
1964 case SERVERCALL_ISHANDLED:
1965 default:
1966 break;
1967 }
1968 }
1969
1970 /* invoke the method */
1971
1972 /* save the old causality ID - note: any calls executed while processing
1973 * messages received during the SendReceive will appear to originate from
1974 * this call - this should be checked with what Windows does */
1975 old_causality_id = tlsdata->causality_id;
1976 tlsdata->causality_id = orpcthis.cid;
1978 params->hr = IRpcStubBuffer_Invoke(params->stub, params->msg, params->chan);
1980 tlsdata->causality_id = old_causality_id;
1981
1982 /* the invoke allocated a new buffer, so free the old one */
1983 if (message_state->bypass_rpcrt && original_buffer != msg->Buffer)
1984 free(original_buffer);
1985
1986exit_reset_state:
1987 message_state = msg->Handle;
1988 msg->Handle = message_state->binding_handle;
1989 msg->Buffer = (char *)msg->Buffer - message_state->prefix_data_len;
1990 msg->BufferLength += message_state->prefix_data_len;
1991
1992exit:
1994 if (params->handle) SetEvent(params->handle);
1995}
1996
1998{
1999 struct dispatch_params *params;
2000 struct stub_manager *stub_manager;
2001 struct apartment *apt;
2002 IPID ipid;
2003 HRESULT hr;
2004
2005 RpcBindingInqObject(msg->Handle, &ipid);
2006
2007 TRACE("ipid = %s, iMethod = %d\n", debugstr_guid(&ipid), msg->ProcNum);
2008
2009 params = malloc(sizeof(*params));
2010 if (!params)
2011 {
2013 return;
2014 }
2015
2016 hr = ipid_get_dispatch_params(&ipid, &apt, &stub_manager, &params->stub, &params->chan,
2017 &params->iid, &params->iface);
2018 if (hr != S_OK)
2019 {
2020 ERR("no apartment found for ipid %s\n", debugstr_guid(&ipid));
2021 free(params);
2023 return;
2024 }
2025
2026 params->msg = (RPCOLEMESSAGE *)msg;
2027 params->status = RPC_S_OK;
2028 params->hr = S_OK;
2029 params->handle = NULL;
2030 params->bypass_rpcrt = FALSE;
2031
2032 /* Note: this is the important difference between STAs and MTAs - we
2033 * always execute RPCs to STAs in the thread that originally created the
2034 * apartment (i.e. the one that pumps messages to the window) */
2035 if (!apt->multi_threaded)
2036 {
2037 params->handle = CreateEventW(NULL, FALSE, FALSE, NULL);
2038
2039 TRACE("Calling apartment thread %#lx...\n", apt->tid);
2040
2043 else
2044 {
2045 ERR("PostMessage failed with error %lu\n", GetLastError());
2046 IRpcChannelBuffer_Release(params->chan);
2047 IRpcStubBuffer_Release(params->stub);
2048 }
2049 CloseHandle(params->handle);
2050 }
2051 else
2052 {
2053 BOOL joined = FALSE;
2054 struct tlsdata *tlsdata;
2055
2057
2058 if (!tlsdata->apt)
2059 {
2061 joined = TRUE;
2062 }
2064 if (joined)
2065 {
2067 }
2068 }
2069
2070 hr = params->hr;
2071 if (params->chan)
2072 IRpcChannelBuffer_Release(params->chan);
2073 if (params->stub)
2074 IRpcStubBuffer_Release(params->stub);
2075 free(params);
2076
2079
2080 /* if IRpcStubBuffer_Invoke fails, we should raise an exception to tell
2081 * the RPC runtime that the call failed */
2082 if (hr != S_OK) RpcRaiseException(hr);
2083}
2084
2085/* stub registration */
2087{
2088 struct registered_if *rif;
2089 BOOL found = FALSE;
2090 HRESULT hr = S_OK;
2091
2092 TRACE("(%s)\n", debugstr_guid(riid));
2093
2096 {
2098 {
2099 rif->refs++;
2100 found = TRUE;
2101 break;
2102 }
2103 }
2104 if (!found)
2105 {
2106 TRACE("Creating new interface\n");
2107
2108 rif = calloc(1, sizeof(*rif));
2109 if (rif)
2110 {
2112
2113 rif->refs = 1;
2114 rif->If.Length = sizeof(RPC_SERVER_INTERFACE);
2115 /* RPC interface ID = COM interface ID */
2116 rif->If.InterfaceId.SyntaxGUID = *riid;
2118 /* all other fields are 0, including the version asCOM objects
2119 * always have a version of 0.0 */
2121 (RPC_IF_HANDLE)&rif->If,
2122 NULL, NULL,
2125 NULL);
2126 if (status == RPC_S_OK)
2128 else
2129 {
2130 ERR("RpcServerRegisterIfEx failed with error %ld\n", status);
2131 free(rif);
2133 }
2134 }
2135 else
2136 hr = E_OUTOFMEMORY;
2137 }
2139 return hr;
2140}
2141
2142/* stub unregistration */
2144{
2145 struct registered_if *rif;
2148 {
2150 {
2151 if (!--rif->refs)
2152 {
2154 list_remove(&rif->entry);
2155 free(rif);
2156 }
2157 break;
2158 }
2159 }
2161}
2162
2163/* get the info for an OXID, including the IPID for the rem unknown interface
2164 * and the string binding */
2165HRESULT rpc_resolve_oxid(OXID oxid, OXID_INFO *oxid_info)
2166{
2167 TRACE("%s\n", wine_dbgstr_longlong(oxid));
2168
2169 oxid_info->dwTid = 0;
2170 oxid_info->dwPid = 0;
2171 oxid_info->dwAuthnHint = RPC_C_AUTHN_LEVEL_NONE;
2172 /* FIXME: this is a hack around not having an OXID resolver yet -
2173 * this function should contact the machine's OXID resolver and then it
2174 * should give us the IPID of the IRemUnknown interface */
2175 oxid_info->ipidRemUnknown.Data1 = 0xffffffff;
2176 oxid_info->ipidRemUnknown.Data2 = 0xffff;
2177 oxid_info->ipidRemUnknown.Data3 = 0xffff;
2178 memcpy(oxid_info->ipidRemUnknown.Data4, &oxid, sizeof(OXID));
2179 oxid_info->psa = NULL /* FIXME */;
2180
2181 return S_OK;
2182}
2183
2184/* make the apartment reachable by other threads and processes and create the
2185 * IRemUnknown object */
2187{
2189 {
2190 WCHAR endpoint[200];
2192
2194
2198 endpoint,
2199 NULL);
2200 if (status != RPC_S_OK)
2201 ERR("Couldn't register endpoint %s\n", debugstr_w(endpoint));
2202
2203 /* FIXME: move remote unknown exporting into this function */
2204 }
2206}
2207
2208/******************************************************************************
2209 * DllDebugObjectRPCHook (combase.@)
2210 */
2211BOOL WINAPI DllDebugObjectRPCHook(BOOL trace, /* ORPC_INIT_ARGS * */ void *args)
2212{
2213 FIXME("%d, %p: stub\n", trace, args);
2214
2215 return TRUE;
2216}
2217
2218/******************************************************************************
2219 * CoDecodeProxy (combase.@)
2220 */
2222{
2223 FIXME("%lx, %s, %p.\n", client_pid, wine_dbgstr_longlong(proxy_addr), server_info);
2224 return E_NOTIMPL;
2225}
@ hook
Definition: SystemMenu.c:35
COMPILER_DEPENDENT_UINT64 UINT64
Definition: actypes.h:131
HRESULT enter_apartment(struct tlsdata *data, DWORD model)
Definition: apartment.c:1129
void leave_apartment(struct tlsdata *data)
Definition: apartment.c:1153
void apartment_release(struct apartment *apt)
Definition: apartment.c:444
HWND apartment_getwindow(const struct apartment *apt)
Definition: apartment.c:1278
OXID apartment_getoxid(const struct apartment *apt)
Definition: apartment.c:1284
struct apartment * apartment_get_current_or_mta(void)
Definition: apartment.c:623
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedExchange
Definition: armddk.h:54
#define InterlockedDecrement
Definition: armddk.h:52
#define trace
Definition: atltest.h:70
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define UlongToHandle(ul)
Definition: basetsd.h:91
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:37
HRESULT ipid_get_dispatch_params(const IPID *ipid, struct apartment **stub_apt, struct stub_manager **manager, IRpcStubBuffer **stub, IRpcChannelBuffer **chan, IID *iid, IUnknown **iface)
Definition: stubmanager.c:530
#define DM_EXECUTERPC
ULONG stub_manager_int_release(struct stub_manager *stub_manager)
Definition: stubmanager.c:309
#define CHARS_IN_GUID
static struct apartment * com_get_current_apt(void)
HRESULT start_apartment_remote_unknown(struct apartment *apt)
Definition: stubmanager.c:838
static HRESULT com_get_tlsdata(struct tlsdata **data)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
HRESULT open_appidkey_from_clsid(REFCLSID clsid, REGSAM access, HKEY *subkey)
Definition: combase.c:353
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
HRESULT open_key_for_clsid(REFCLSID clsid, const WCHAR *keyname, REGSAM access, HKEY *subkey)
Definition: combase.c:320
HRESULT WINAPI CoGetCurrentLogicalThreadId(GUID *id)
Definition: combase.c:2714
HRESULT WINAPI CoWaitForMultipleHandles(DWORD flags, DWORD timeout, ULONG handle_count, HANDLE *handles, DWORD *index)
Definition: combase.c:2067
HRESULT WINAPI GetHGlobalFromStream(IStream *stream, HGLOBAL *phglobal)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
static unsigned char * ChannelHooks_ClientFillBuffer(SChannelHookCallInfo *info, unsigned char *buffer, struct channel_hook_buffer_data *data, unsigned int hook_count)
Definition: rpc.c:781
static HRESULT unmarshal_ORPCTHAT(RPC_MESSAGE *msg, ORPCTHAT *orpcthat, ORPC_EXTENT_ARRAY *orpc_ext_array, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
Definition: rpc.c:1831
static RPC_BINDING_HANDLE get_irot_handle(void)
Definition: rpc.c:273
void rpc_execute_call(struct dispatch_params *params)
Definition: rpc.c:1874
static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
Definition: rpc.c:480
static DWORD start_local_service(const WCHAR *name, DWORD num, LPCWSTR *params)
Definition: rpc.c:389
static HRESULT create_local_service(REFCLSID rclsid)
Definition: rpc.c:428
static HRESULT unmarshal_ORPCTHIS(RPC_MESSAGE *msg, ORPCTHIS *orpcthis, ORPC_EXTENT_ARRAY *orpc_ext_array, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
Definition: rpc.c:1780
BOOL WINAPI DllDebugObjectRPCHook(BOOL trace, void *args)
Definition: rpc.c:2211
HRESULT WINAPI InternalIrotEnumRunning(PInterfaceList *list)
Definition: rpc.c:353
HRESULT WINAPI InternalIrotGetObject(const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
Definition: rpc.c:331
static HRESULT create_surrogate_server(REFCLSID rclsid, HANDLE *process)
Definition: rpc.c:550
static DWORD WINAPI rpc_sendreceive_thread(LPVOID param)
Definition: rpc.c:1336
HRESULT rpc_revoke_local_server(unsigned int cookie)
Definition: rpc.c:375
static ULONG ChannelHooks_ClientGetSize(SChannelHookCallInfo *info, struct channel_hook_buffer_data **data, unsigned int *hook_count, ULONG *extension_count)
Definition: rpc.c:734
static ULONG ChannelHooks_ServerGetSize(SChannelHookCallInfo *info, struct channel_hook_buffer_data **data, unsigned int *hook_count, ULONG *extension_count)
Definition: rpc.c:851
static CRITICAL_SECTION csChannelHook
Definition: rpc.c:61
static void get_rpc_endpoint(LPWSTR endpoint, const OXID *oxid)
Definition: rpc.c:80
void rpc_unregister_interface(REFIID riid, BOOL wait)
Definition: rpc.c:2143
static HRESULT WINAPI ServerRpcChannelBuffer_SendReceive(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg, ULONG *pstatus)
Definition: rpc.c:1329
static RPC_BINDING_HANDLE get_irpcss_handle(void)
Definition: rpc.c:256
HRESULT rpc_register_local_server(REFCLSID clsid, IStream *stream, DWORD flags, unsigned int *cookie)
Definition: rpc.c:701
HRESULT rpc_create_clientchannel(const OXID *oxid, const IPID *ipid, const OXID_INFO *oxid_info, const IID *iid, DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan, struct apartment *apt)
Definition: rpc.c:1642
static RPC_DISPATCH_FUNCTION rpc_dispatch_table[1]
Definition: rpc.c:47
static HRESULT WINAPI ServerRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD *dest_context, void **dest_context_data)
Definition: rpc.c:1599
static RPC_DISPATCH_TABLE rpc_dispatch
Definition: rpc.c:48
static HANDLE ClientRpcChannelBuffer_GetEventHandle(ClientRpcChannelBuffer *This)
Definition: rpc.c:1146
void rpc_start_remoting(struct apartment *apt)
Definition: rpc.c:2186
static HRESULT WINAPI ClientRpcChannelBuffer_GetDestCtx(LPRPCCHANNELBUFFER iface, DWORD *pdwDestContext, void **ppvDestContext)
Definition: rpc.c:1587
static HRESULT WINAPI RpcChannelBuffer_QueryInterface(IRpcChannelBuffer *iface, REFIID riid, LPVOID *ppv)
Definition: rpc.c:1005
static CRITICAL_SECTION_DEBUG csRegIf_debug
Definition: rpc.c:52
void *__RPC_USER MIDL_user_allocate(SIZE_T size)
Definition: rpc.c:174
static void ClientRpcChannelBuffer_ReleaseEventHandle(ClientRpcChannelBuffer *This, HANDLE event)
Definition: rpc.c:1157
static struct list channel_hooks
Definition: rpc.c:60
static HRESULT WINAPI RpcChannelBuffer_IsConnected(LPRPCCHANNELBUFFER iface)
Definition: rpc.c:1610
static RPC_BINDING_HANDLE get_rpc_handle(unsigned short *protseq, unsigned short *endpoint)
Definition: rpc.c:240
#define RPCSS_CALL_START
Definition: rpc.c:290
static CRITICAL_SECTION csRegIf
Definition: rpc.c:51
static const IRpcChannelBufferVtbl ClientRpcChannelBufferVtbl
Definition: rpc.c:1617
static ULONG WINAPI ClientRpcChannelBuffer_Release(LPRPCCHANNELBUFFER iface)
Definition: rpc.c:1036
static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg, REFIID riid)
Definition: rpc.c:1164
static ULONG WINAPI ServerRpcChannelBuffer_Release(LPRPCCHANNELBUFFER iface)
Definition: rpc.c:1023
static void ChannelHooks_ClientNotify(SChannelHookCallInfo *info, DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent, ULONG extension_count, HRESULT hrFault)
Definition: rpc.c:941
static void ChannelHooks_ServerNotify(SChannelHookCallInfo *info, DWORD lDataRep, WIRE_ORPC_EXTENT *first_wire_orpc_extent, ULONG extension_count)
Definition: rpc.c:821
static unsigned char * ChannelHooks_ServerFillBuffer(SChannelHookCallInfo *info, unsigned char *buffer, struct channel_hook_buffer_data *data, unsigned int hook_count)
Definition: rpc.c:900
static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg, REFIID riid)
Definition: rpc.c:1051
static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
Definition: rpc.c:184
HRESULT WINAPI InternalIrotNoteChangeTime(IrotCookie cookie, const FILETIME *time)
Definition: rpc.c:339
static HRESULT ClientRpcChannelBuffer_IsCorrectApartment(ClientRpcChannelBuffer *This, const struct apartment *apt)
Definition: rpc.c:1351
HRESULT WINAPI InternalIrotIsRunning(const MonikerComparisonData *moniker_data)
Definition: rpc.c:324
HRESULT WINAPI InternalIrotGetTimeOfLastChange(const MonikerComparisonData *moniker_data, FILETIME *time)
Definition: rpc.c:346
#define RPCSS_CALL_END
Definition: rpc.c:295
HRESULT rpc_register_channel_hook(REFGUID rguid, IChannelHook *hook)
Definition: rpc.c:971
static HRESULT WINAPI ClientRpcChannelBuffer_FreeBuffer(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg)
Definition: rpc.c:1551
HRESULT rpcss_get_next_seqid(DWORD *id)
Definition: rpc.c:308
HRESULT WINAPI CoDecodeProxy(DWORD client_pid, UINT64 proxy_addr, ServerInformation *server_info)
Definition: rpc.c:2221
static HRESULT WINAPI ServerRpcChannelBuffer_FreeBuffer(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg)
Definition: rpc.c:1521
static const IRpcChannelBufferVtbl ServerRpcChannelBufferVtbl
Definition: rpc.c:1629
static HRESULT unmarshal_ORPC_EXTENT_ARRAY(RPC_MESSAGE *msg, const char *end, ORPC_EXTENT_ARRAY *extensions, WIRE_ORPC_EXTENT **first_wire_orpc_extent)
Definition: rpc.c:1727
HRESULT rpc_create_serverchannel(DWORD dest_context, void *dest_context_data, IRpcChannelBuffer **chan)
Definition: rpc.c:1709
HRESULT rpc_resolve_oxid(OXID oxid, OXID_INFO *oxid_info)
Definition: rpc.c:2165
static CRITICAL_SECTION_DEBUG csChannelHook_debug
Definition: rpc.c:62
static struct list registered_interfaces
Definition: rpc.c:50
HRESULT rpc_get_local_class_object(REFCLSID rclsid, REFIID riid, void **obj)
Definition: rpc.c:629
static BOOL start_rpcss(void)
Definition: rpc.c:189
HRESULT rpc_register_interface(REFIID riid)
Definition: rpc.c:2086
void rpc_unregister_channel_hooks(void)
Definition: rpc.c:990
HRESULT WINAPI InternalIrotRegister(const MonikerComparisonData *moniker_data, const InterfaceData *object, const InterfaceData *moniker, const FILETIME *time, DWORD flags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
Definition: rpc.c:315
static ULONG WINAPI RpcChannelBuffer_AddRef(LPRPCCHANNELBUFFER iface)
Definition: rpc.c:1017
static HRESULT WINAPI ClientRpcChannelBuffer_SendReceive(LPRPCCHANNELBUFFER iface, RPCOLEMESSAGE *olemsg, ULONG *pstatus)
Definition: rpc.c:1360
void __RPC_USER MIDL_user_free(void *p)
Definition: rpc.c:179
static HRESULT rpcss_get_class_object(REFCLSID rclsid, PMInterfacePointer *objref)
Definition: rpc.c:382
static HRESULT rpcss_server_register(REFCLSID clsid, DWORD flags, MInterfacePointer *obj, unsigned int *cookie)
Definition: rpc.c:368
static WCHAR rpctransportW[]
Definition: rpc.c:70
static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)
Definition: rpc.c:1997
HRESULT WINAPI InternalIrotRevoke(IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *object, PInterfaceData *moniker)
Definition: rpc.c:360
#define CloseHandle
Definition: compat.h:739
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define GetCurrentProcess()
Definition: compat.h:759
#define IsWow64Process
Definition: compat.h:760
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetSystemWow64DirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2340
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2232
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4442
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1076
BOOL WINAPI Wow64RevertWow64FsRedirection(IN PVOID OldValue)
Definition: utils.c:809
BOOL WINAPI Wow64DisableWow64FsRedirection(IN PVOID *OldValue)
Definition: utils.c:786
ULONGLONG WINAPI DECLSPEC_HOTPATCH GetTickCount64(void)
Definition: sync.c:192
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
struct _cl_event * event
Definition: glext.h:7739
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLuint num
Definition: glext.h:9618
GLfloat param
Definition: glext.h:5796
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
const char cursor[]
Definition: icontest.c:13
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
HRESULT __cdecl IrotRevoke(IrotHandle h, IrotCookie cookie, IrotContextHandle *ctxt_handle, PInterfaceData *obj, PInterfaceData *mk)
Definition: irotp.c:149
HRESULT __cdecl IrotEnumRunning(IrotHandle h, PInterfaceList *list)
Definition: irotp.c:315
HRESULT __cdecl IrotGetObject(IrotHandle h, const MonikerComparisonData *moniker_data, PInterfaceData *obj, IrotCookie *cookie)
Definition: irotp.c:221
HRESULT __cdecl IrotRegister(IrotHandle h, const MonikerComparisonData *data, const InterfaceData *obj, const InterfaceData *mk, const FILETIME *time, DWORD grfFlags, IrotCookie *cookie, IrotContextHandle *ctxt_handle)
Definition: irotp.c:71
HRESULT __cdecl IrotIsRunning(IrotHandle h, const MonikerComparisonData *data)
Definition: irotp.c:196
HRESULT __cdecl IrotGetTimeOfLastChange(IrotHandle h, const MonikerComparisonData *moniker_data, FILETIME *time)
Definition: irotp.c:287
HRESULT __cdecl IrotNoteChangeTime(IrotHandle h, IrotCookie cookie, const FILETIME *last_modified_time)
Definition: irotp.c:263
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
BOOL is_wow64
Definition: main.c:38
#define GUID_NULL
Definition: ks.h:106
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LONG_PTR LPARAM
Definition: minwindef.h:175
#define seekto(pos, errstr)
Definition: mkdosfs.c:1613
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
UINT64 OXID
Definition: marshal.c:86
static RPC_BINDING_HANDLE binding
Definition: server.c:166
const CLSID * clsid
Definition: msctf.cpp:50
static DWORD client_pid
Definition: msiexec.c:401
#define KEY_READ
Definition: nt_native.h:1026
#define DWORD
Definition: nt_native.h:44
@ COINIT_MULTITHREADED
Definition: objbase.h:280
interface IRpcChannelBuffer * LPRPCCHANNELBUFFER
Definition: objfwd.h:39
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
#define calloc
Definition: rosglue.h:14
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:862
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:493
RPC_STATUS WINAPI RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
Definition: rpc_binding.c:798
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:769
RPC_STATUS WINAPI RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
Definition: rpc_binding.c:810
RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1634
RPC_STATUS WINAPI I_RpcSendReceive(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1914
RPC_STATUS WINAPI I_RpcFreeBuffer(PRPC_MESSAGE pMsg)
Definition: rpc_message.c:1692
RPC_STATUS WINAPI RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN *IfCallbackFn)
Definition: rpc_server.c:1125
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1202
RPCRTAPI int RPC_ENTRY I_RpcExceptionFilter(ULONG)
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
#define RPC_C_PROTSEQ_MAX_REQS_DEFAULT
Definition: rpcdce.h:123
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
#define RPC_C_AUTHN_LEVEL_NONE
Definition: rpcdce.h:146
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
#define RPC_IF_OLE
Definition: rpcdce.h:314
void(__RPC_STUB * RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message)
Definition: rpcdcep.h:82
struct _RPC_CLIENT_INTERFACE RPC_CLIENT_INTERFACE
struct _RPC_SERVER_INTERFACE RPC_SERVER_INTERFACE
#define RPC_S_OK
Definition: rpcnterr.h:22
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:181
void DECLSPEC_NORETURN WINAPI RpcRaiseException(RPC_STATUS exception)
Definition: rpcrt4_main.c:213
HRESULT __cdecl irpcss_get_thread_seq_id(handle_t h, DWORD *id)
Definition: rpcss_main.c:144
HRESULT __cdecl irpcss_get_class_object(handle_t h, const GUID *clsid, PMInterfacePointer *object)
Definition: rpcss_main.c:112
HRESULT __cdecl irpcss_server_register(handle_t h, const GUID *clsid, unsigned int flags, PMInterfacePointer object, unsigned int *cookie)
Definition: rpcss_main.c:58
HRESULT __cdecl irpcss_server_revoke(handle_t h, unsigned int cookie)
Definition: rpcss_main.c:92
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2107
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
Definition: scm.c:2926
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2199
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:3019
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define __RPC_STUB
Definition: rpc.h:62
long RPC_STATUS
Definition: rpc.h:48
#define __RPC_USER
Definition: rpc.h:61
wcscat
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
#define exit(n)
Definition: config.h:202
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
#define TRACE(s)
Definition: solgame.cpp:4
RPC_BINDING_HANDLE bind
Definition: rpc.c:99
RpcChannelBuffer super
Definition: rpc.c:97
DWORD dest_context
Definition: rpc.c:91
void * dest_context_data
Definition: rpc.c:92
IRpcChannelBuffer IRpcChannelBuffer_iface
Definition: rpc.c:88
LONG refs
Definition: rpc.c:89
ULONG flags
Definition: rpc.c:158
ULONG flags
Definition: rpc.c:150
ULONG version
Definition: rpc.c:149
GUID cid
Definition: rpc.c:152
ULONG reserved1
Definition: rpc.c:151
ULONG size
Definition: rpc.c:136
unsigned char data[1]
Definition: rpc.c:137
ULONG conformance
Definition: rpc.c:134
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
DWORD ExceptionCode
Definition: compat.h:208
Definition: scsiwmi.h:51
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:117
unsigned int Length
Definition: rpcdcep.h:116
unsigned int Length
Definition: rpcdcep.h:103
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
PRPC_DISPATCH_TABLE DispatchTable
Definition: rpcdcep.h:106
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
unsigned short MajorVersion
Definition: rpcdcep.h:27
unsigned short MinorVersion
Definition: rpcdcep.h:28
LONG remoting_started
BOOL multi_threaded
Definition: match.c:390
Definition: rpc.c:163
IChannelHook * hook
Definition: rpc.c:166
struct list entry
Definition: rpc.c:164
GUID id
Definition: rpc.c:165
Definition: cookie.c:34
IRpcStubBuffer * stub
Definition: rpc.c:109
BOOL bypass_rpcrt
Definition: rpc.c:114
HRESULT hr
Definition: rpc.c:116
IUnknown * iface
Definition: rpc.c:112
RPC_STATUS status
Definition: rpc.c:115
HANDLE handle
Definition: rpc.c:113
IRpcChannelBuffer * chan
Definition: rpc.c:110
RPCOLEMESSAGE * msg
Definition: rpc.c:108
Definition: nis.h:10
Definition: copy.c:22
HWND target_hwnd
Definition: rpc.c:127
SChannelHookCallInfo channel_hook_info
Definition: rpc.c:123
struct dispatch_params params
Definition: rpc.c:129
ULONG prefix_data_len
Definition: rpc.c:122
BOOL bypass_rpcrt
Definition: rpc.c:124
RPC_BINDING_HANDLE binding_handle
Definition: rpc.c:121
DWORD target_tid
Definition: rpc.c:128
Definition: main.c:40
Definition: name.c:39
Definition: send.c:48
DWORD refs
Definition: rpc.c:75
struct list entry
Definition: rpc.c:74
RPC_SERVER_INTERFACE If
Definition: rpc.c:76
Definition: general.c:220
Definition: ps.c:97
Definition: parse.h:23
LONG pending_call_count_client
struct apartment * apt
LONG pending_call_count_server
GUID causality_id
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
#define LIST_INIT(head)
Definition: queue.h:197
#define DWORD_PTR
Definition: treelist.c:76
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned char * LPBYTE
Definition: typedefs.h:53
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1156
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define DETACHED_PROCESS
Definition: winbase.h:183
#define WINAPI
Definition: msvc.h:6
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define S_FALSE
Definition: winerror.h:3451
#define RPC_E_INVALID_HEADER
Definition: winerror.h:3565
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define ERROR_SERVICE_ALREADY_RUNNING
Definition: winerror.h:931
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1400
#define RPC_E_RETRY
Definition: winerror.h:3557
#define RPC_E_WRONG_THREAD
Definition: winerror.h:3562
#define E_NOINTERFACE
Definition: winerror.h:3479
#define RPC_E_CANTCALLOUT_ININPUTSYNCCALL
Definition: winerror.h:3561
#define E_UNEXPECTED
Definition: winerror.h:3528
#define ERROR_FUNCTION_FAILED
Definition: winerror.h:1333
#define RPC_E_VERSION_MISMATCH
Definition: winerror.h:3564
#define RPC_E_CALL_REJECTED
Definition: winerror.h:3530
#define WT_EXECUTEDEFAULT
Definition: winnt_old.h:1092
ACCESS_MASK REGSAM
Definition: winreg.h:76
#define SERVICE_START
Definition: winsvc.h:63
#define SERVICE_QUERY_STATUS
Definition: winsvc.h:61
@ SC_STATUS_PROCESS_INFO
Definition: winsvc.h:125
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
BOOL WINAPI InSendMessage(void)
Definition: message.c:1372
#define KEY_WOW64_32KEY
Definition: cmtypes.h:45
#define KEY_WOW64_64KEY
Definition: cmtypes.h:46
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193