[rpcrt4]
[reactos.git] / reactos / dll / win32 / rpcrt4 / rpc_server.c
1 /*
2 * RPC server API
3 *
4 * Copyright 2001 Ove Kåven, TransGaming Technologies
5 * Copyright 2004 Filip Navara
6 * Copyright 2006-2008 Robert Shearman (for CodeWeavers)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23 #include "config.h"
24 #include "wine/port.h"
25
26 #include <stdarg.h>
27 #include <stdio.h>
28 #include <string.h>
29 #include <assert.h>
30
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winerror.h"
34
35 #include "rpc.h"
36 #include "rpcndr.h"
37 #include "excpt.h"
38
39 #include "wine/debug.h"
40 #include "wine/exception.h"
41
42 #include "rpc_server.h"
43 #include "rpc_assoc.h"
44 #include "rpc_message.h"
45 #include "rpc_defs.h"
46 #include "ncastatus.h"
47
48 WINE_DEFAULT_DEBUG_CHANNEL(rpc);
49
50 typedef struct _RpcPacket
51 {
52 struct _RpcConnection* conn;
53 RpcPktHdr* hdr;
54 RPC_MESSAGE* msg;
55 } RpcPacket;
56
57 typedef struct _RpcObjTypeMap
58 {
59 /* FIXME: a hash table would be better. */
60 struct _RpcObjTypeMap *next;
61 UUID Object;
62 UUID Type;
63 } RpcObjTypeMap;
64
65 static RpcObjTypeMap *RpcObjTypeMaps;
66
67 /* list of type RpcServerProtseq */
68 static struct list protseqs = LIST_INIT(protseqs);
69 static struct list server_interfaces = LIST_INIT(server_interfaces);
70
71 static CRITICAL_SECTION server_cs;
72 static CRITICAL_SECTION_DEBUG server_cs_debug =
73 {
74 0, 0, &server_cs,
75 { &server_cs_debug.ProcessLocksList, &server_cs_debug.ProcessLocksList },
76 0, 0, { (DWORD_PTR)(__FILE__ ": server_cs") }
77 };
78 static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
79
80 static CRITICAL_SECTION listen_cs;
81 static CRITICAL_SECTION_DEBUG listen_cs_debug =
82 {
83 0, 0, &listen_cs,
84 { &listen_cs_debug.ProcessLocksList, &listen_cs_debug.ProcessLocksList },
85 0, 0, { (DWORD_PTR)(__FILE__ ": listen_cs") }
86 };
87 static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
88
89 /* whether the server is currently listening */
90 static BOOL std_listen;
91 /* number of manual listeners (calls to RpcServerListen) */
92 static LONG manual_listen_count;
93 /* total listeners including auto listeners */
94 static LONG listen_count;
95
96 static UUID uuid_nil;
97
98 static inline RpcObjTypeMap *LookupObjTypeMap(UUID *ObjUuid)
99 {
100 RpcObjTypeMap *rslt = RpcObjTypeMaps;
101 RPC_STATUS dummy;
102
103 while (rslt) {
104 if (! UuidCompare(ObjUuid, &rslt->Object, &dummy)) break;
105 rslt = rslt->next;
106 }
107
108 return rslt;
109 }
110
111 static inline UUID *LookupObjType(UUID *ObjUuid)
112 {
113 RpcObjTypeMap *map = LookupObjTypeMap(ObjUuid);
114 if (map)
115 return &map->Type;
116 else
117 return &uuid_nil;
118 }
119
120 static RpcServerInterface* RPCRT4_find_interface(UUID* object,
121 const RPC_SYNTAX_IDENTIFIER* if_id,
122 BOOL check_object)
123 {
124 UUID* MgrType = NULL;
125 RpcServerInterface* cif;
126 RPC_STATUS status;
127
128 if (check_object)
129 MgrType = LookupObjType(object);
130 EnterCriticalSection(&server_cs);
131 LIST_FOR_EACH_ENTRY(cif, &server_interfaces, RpcServerInterface, entry) {
132 if (!memcmp(if_id, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)) &&
133 (check_object == FALSE || UuidEqual(MgrType, &cif->MgrTypeUuid, &status)) &&
134 std_listen) {
135 InterlockedIncrement(&cif->CurrentCalls);
136 break;
137 }
138 }
139 LeaveCriticalSection(&server_cs);
140 if (&cif->entry == &server_interfaces) cif = NULL;
141 TRACE("returning %p for object %s, if_id { %d.%d %s }\n", cif,
142 debugstr_guid(object), if_id->SyntaxVersion.MajorVersion,
143 if_id->SyntaxVersion.MinorVersion, debugstr_guid(&if_id->SyntaxGUID));
144 return cif;
145 }
146
147 static void RPCRT4_release_server_interface(RpcServerInterface *sif)
148 {
149 if (!InterlockedDecrement(&sif->CurrentCalls) &&
150 sif->Delete) {
151 /* sif must have been removed from server_interfaces before
152 * CallsCompletedEvent is set */
153 if (sif->CallsCompletedEvent)
154 SetEvent(sif->CallsCompletedEvent);
155 HeapFree(GetProcessHeap(), 0, sif);
156 }
157 }
158
159 static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg)
160 {
161 RPC_STATUS status;
162 RpcServerInterface* sif;
163 RpcPktHdr *response = NULL;
164
165 /* FIXME: do more checks! */
166 if (hdr->max_tsize < RPC_MIN_PACKET_SIZE ||
167 !UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status) ||
168 conn->server_binding) {
169 TRACE("packet size less than min size, or active interface syntax guid non-null\n");
170 sif = NULL;
171 } else {
172 /* create temporary binding */
173 if (RPCRT4_MakeBinding(&conn->server_binding, conn) == RPC_S_OK &&
174 RpcServerAssoc_GetAssociation(rpcrt4_conn_get_name(conn),
175 conn->NetworkAddr, conn->Endpoint,
176 conn->NetworkOptions,
177 hdr->assoc_gid,
178 &conn->server_binding->Assoc) == RPC_S_OK)
179 sif = RPCRT4_find_interface(NULL, &hdr->abstract, FALSE);
180 else
181 sif = NULL;
182 }
183 if (sif == NULL) {
184 TRACE("rejecting bind request on connection %p\n", conn);
185 /* Report failure to client. */
186 response = RPCRT4_BuildBindNackHeader(NDR_LOCAL_DATA_REPRESENTATION,
187 RPC_VER_MAJOR, RPC_VER_MINOR);
188 } else {
189 TRACE("accepting bind request on connection %p for %s\n", conn,
190 debugstr_guid(&hdr->abstract.SyntaxGUID));
191
192 /* accept. */
193 response = RPCRT4_BuildBindAckHeader(NDR_LOCAL_DATA_REPRESENTATION,
194 RPC_MAX_PACKET_SIZE,
195 RPC_MAX_PACKET_SIZE,
196 conn->server_binding->Assoc->assoc_group_id,
197 conn->Endpoint,
198 RESULT_ACCEPT, REASON_NONE,
199 &sif->If->TransferSyntax);
200
201 /* save the interface for later use */
202 conn->ActiveInterface = hdr->abstract;
203 conn->MaxTransmissionSize = hdr->max_tsize;
204
205 RPCRT4_release_server_interface(sif);
206 }
207
208 if (response)
209 status = RPCRT4_Send(conn, response, NULL, 0);
210 else
211 status = ERROR_OUTOFMEMORY;
212 RPCRT4_FreeHeader(response);
213
214 return status;
215 }
216
217 static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *hdr, RPC_MESSAGE *msg)
218 {
219 RPC_STATUS status;
220 RpcPktHdr *response = NULL;
221 RpcServerInterface* sif;
222 RPC_DISPATCH_FUNCTION func;
223 BOOL exception;
224 UUID *object_uuid;
225 NDR_SCONTEXT context_handle;
226 void *buf = msg->Buffer;
227
228 /* fail if the connection isn't bound with an interface */
229 if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status)) {
230 /* FIXME: should send BindNack instead */
231 response = RPCRT4_BuildFaultHeader(NDR_LOCAL_DATA_REPRESENTATION,
232 status);
233
234 RPCRT4_Send(conn, response, NULL, 0);
235 RPCRT4_FreeHeader(response);
236 return RPC_S_OK;
237 }
238
239 if (hdr->common.flags & RPC_FLG_OBJECT_UUID) {
240 object_uuid = (UUID*)(hdr + 1);
241 } else {
242 object_uuid = NULL;
243 }
244
245 sif = RPCRT4_find_interface(object_uuid, &conn->ActiveInterface, TRUE);
246 if (!sif) {
247 WARN("interface %s no longer registered, returning fault packet\n", debugstr_guid(&conn->ActiveInterface.SyntaxGUID));
248 response = RPCRT4_BuildFaultHeader(NDR_LOCAL_DATA_REPRESENTATION,
249 NCA_S_UNK_IF);
250
251 RPCRT4_Send(conn, response, NULL, 0);
252 RPCRT4_FreeHeader(response);
253 return RPC_S_OK;
254 }
255 msg->RpcInterfaceInformation = sif->If;
256 /* copy the endpoint vector from sif to msg so that midl-generated code will use it */
257 msg->ManagerEpv = sif->MgrEpv;
258 if (object_uuid != NULL) {
259 RPCRT4_SetBindingObject(msg->Handle, object_uuid);
260 }
261
262 /* find dispatch function */
263 msg->ProcNum = hdr->opnum;
264 if (sif->Flags & RPC_IF_OLE) {
265 /* native ole32 always gives us a dispatch table with a single entry
266 * (I assume that's a wrapper for IRpcStubBuffer::Invoke) */
267 func = *sif->If->DispatchTable->DispatchTable;
268 } else {
269 if (msg->ProcNum >= sif->If->DispatchTable->DispatchTableCount) {
270 WARN("invalid procnum (%d/%d)\n", msg->ProcNum, sif->If->DispatchTable->DispatchTableCount);
271 response = RPCRT4_BuildFaultHeader(NDR_LOCAL_DATA_REPRESENTATION,
272 NCA_S_OP_RNG_ERROR);
273
274 RPCRT4_Send(conn, response, NULL, 0);
275 RPCRT4_FreeHeader(response);
276 }
277 func = sif->If->DispatchTable->DispatchTable[msg->ProcNum];
278 }
279
280 /* put in the drep. FIXME: is this more universally applicable?
281 perhaps we should move this outward... */
282 msg->DataRepresentation =
283 MAKELONG( MAKEWORD(hdr->common.drep[0], hdr->common.drep[1]),
284 MAKEWORD(hdr->common.drep[2], hdr->common.drep[3]));
285
286 exception = FALSE;
287
288 /* dispatch */
289 RPCRT4_SetThreadCurrentCallHandle(msg->Handle);
290 __TRY {
291 if (func) func(msg);
292 } __EXCEPT_ALL {
293 WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
294 exception = TRUE;
295 if (GetExceptionCode() == STATUS_ACCESS_VIOLATION)
296 status = ERROR_NOACCESS;
297 else
298 status = GetExceptionCode();
299 response = RPCRT4_BuildFaultHeader(msg->DataRepresentation,
300 RPC2NCA_STATUS(status));
301 } __ENDTRY
302 RPCRT4_SetThreadCurrentCallHandle(NULL);
303
304 /* release any unmarshalled context handles */
305 while ((context_handle = RPCRT4_PopThreadContextHandle()) != NULL)
306 RpcServerAssoc_ReleaseContextHandle(conn->server_binding->Assoc, context_handle, TRUE);
307
308 if (!exception)
309 response = RPCRT4_BuildResponseHeader(msg->DataRepresentation,
310 msg->BufferLength);
311
312 /* send response packet */
313 if (response) {
314 status = RPCRT4_Send(conn, response, exception ? NULL : msg->Buffer,
315 exception ? 0 : msg->BufferLength);
316 RPCRT4_FreeHeader(response);
317 } else
318 ERR("out of memory\n");
319
320 msg->RpcInterfaceInformation = NULL;
321 RPCRT4_release_server_interface(sif);
322
323 if (msg->Buffer == buf) buf = NULL;
324 TRACE("freeing Buffer=%p\n", buf);
325 I_RpcFree(buf);
326
327 return status;
328 }
329
330 static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, RPC_MESSAGE* msg)
331 {
332 RPC_STATUS status;
333
334 msg->Handle = (RPC_BINDING_HANDLE)conn->server_binding;
335
336 switch (hdr->common.ptype) {
337 case PKT_BIND:
338 TRACE("got bind packet\n");
339
340 status = process_bind_packet(conn, &hdr->bind, msg);
341 break;
342
343 case PKT_REQUEST:
344 TRACE("got request packet\n");
345
346 status = process_request_packet(conn, &hdr->request, msg);
347 break;
348
349 default:
350 FIXME("unhandled packet type %u\n", hdr->common.ptype);
351 break;
352 }
353
354 /* clean up */
355 I_RpcFree(msg->Buffer);
356 RPCRT4_FreeHeader(hdr);
357 HeapFree(GetProcessHeap(), 0, msg);
358 }
359
360 static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
361 {
362 RpcPacket *pkt = the_arg;
363 RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg);
364 HeapFree(GetProcessHeap(), 0, pkt);
365 return 0;
366 }
367
368 static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
369 {
370 RpcConnection* conn = (RpcConnection*)the_arg;
371 RpcPktHdr *hdr;
372 RPC_MESSAGE *msg;
373 RPC_STATUS status;
374 RpcPacket *packet;
375
376 TRACE("(%p)\n", conn);
377
378 for (;;) {
379 msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RPC_MESSAGE));
380
381 status = RPCRT4_Receive(conn, &hdr, msg);
382 if (status != RPC_S_OK) {
383 WARN("receive failed with error %x\n", status);
384 HeapFree(GetProcessHeap(), 0, msg);
385 break;
386 }
387
388 packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket));
389 if (!packet) {
390 I_RpcFree(msg->Buffer);
391 RPCRT4_FreeHeader(hdr);
392 HeapFree(GetProcessHeap(), 0, msg);
393 break;
394 }
395 packet->conn = conn;
396 packet->hdr = hdr;
397 packet->msg = msg;
398 if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) {
399 ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError());
400 I_RpcFree(msg->Buffer);
401 RPCRT4_FreeHeader(hdr);
402 HeapFree(GetProcessHeap(), 0, msg);
403 HeapFree(GetProcessHeap(), 0, packet);
404 break;
405 }
406
407 msg = NULL;
408 }
409 RPCRT4_DestroyConnection(conn);
410 return 0;
411 }
412
413 void RPCRT4_new_client(RpcConnection* conn)
414 {
415 HANDLE thread = CreateThread(NULL, 0, RPCRT4_io_thread, conn, 0, NULL);
416 if (!thread) {
417 DWORD err = GetLastError();
418 ERR("failed to create thread, error=%08x\n", err);
419 RPCRT4_DestroyConnection(conn);
420 }
421 /* we could set conn->thread, but then we'd have to make the io_thread wait
422 * for that, otherwise the thread might finish, destroy the connection, and
423 * free the memory we'd write to before we did, causing crashes and stuff -
424 * so let's implement that later, when we really need conn->thread */
425
426 CloseHandle( thread );
427 }
428
429 static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
430 {
431 int res;
432 unsigned int count;
433 void *objs = NULL;
434 RpcServerProtseq* cps = the_arg;
435 RpcConnection* conn;
436 BOOL set_ready_event = FALSE;
437
438 TRACE("(the_arg == ^%p)\n", the_arg);
439
440 for (;;) {
441 objs = cps->ops->get_wait_array(cps, objs, &count);
442
443 if (set_ready_event)
444 {
445 /* signal to function that changed state that we are now sync'ed */
446 SetEvent(cps->server_ready_event);
447 set_ready_event = FALSE;
448 }
449
450 /* start waiting */
451 res = cps->ops->wait_for_new_connection(cps, count, objs);
452 if (res == -1)
453 break;
454 else if (res == 0)
455 {
456 if (!std_listen)
457 {
458 SetEvent(cps->server_ready_event);
459 break;
460 }
461 set_ready_event = TRUE;
462 }
463 }
464 cps->ops->free_wait_array(cps, objs);
465 EnterCriticalSection(&cps->cs);
466 /* close connections */
467 conn = cps->conn;
468 while (conn) {
469 RPCRT4_CloseConnection(conn);
470 conn = conn->Next;
471 }
472 LeaveCriticalSection(&cps->cs);
473 return 0;
474 }
475
476 /* tells the server thread that the state has changed and waits for it to
477 * make the changes */
478 static void RPCRT4_sync_with_server_thread(RpcServerProtseq *ps)
479 {
480 /* make sure we are the only thread sync'ing the server state, otherwise
481 * there is a race with the server thread setting an older state and setting
482 * the server_ready_event when the new state hasn't yet been applied */
483 WaitForSingleObject(ps->mgr_mutex, INFINITE);
484
485 ps->ops->signal_state_changed(ps);
486
487 /* wait for server thread to make the requested changes before returning */
488 WaitForSingleObject(ps->server_ready_event, INFINITE);
489
490 ReleaseMutex(ps->mgr_mutex);
491 }
492
493 static RPC_STATUS RPCRT4_start_listen_protseq(RpcServerProtseq *ps, BOOL auto_listen)
494 {
495 RPC_STATUS status = RPC_S_OK;
496 HANDLE server_thread;
497
498 EnterCriticalSection(&listen_cs);
499 if (ps->is_listening) goto done;
500
501 if (!ps->mgr_mutex) ps->mgr_mutex = CreateMutexW(NULL, FALSE, NULL);
502 if (!ps->server_ready_event) ps->server_ready_event = CreateEventW(NULL, FALSE, FALSE, NULL);
503 server_thread = CreateThread(NULL, 0, RPCRT4_server_thread, ps, 0, NULL);
504 if (!server_thread)
505 {
506 status = RPC_S_OUT_OF_RESOURCES;
507 goto done;
508 }
509 ps->is_listening = TRUE;
510 CloseHandle(server_thread);
511
512 done:
513 LeaveCriticalSection(&listen_cs);
514 return status;
515 }
516
517 static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
518 {
519 RPC_STATUS status = RPC_S_ALREADY_LISTENING;
520 RpcServerProtseq *cps;
521
522 TRACE("\n");
523
524 EnterCriticalSection(&listen_cs);
525 if (auto_listen || (manual_listen_count++ == 0))
526 {
527 status = RPC_S_OK;
528 if (++listen_count == 1)
529 std_listen = TRUE;
530 }
531 LeaveCriticalSection(&listen_cs);
532
533 if (std_listen)
534 {
535 EnterCriticalSection(&server_cs);
536 LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
537 {
538 status = RPCRT4_start_listen_protseq(cps, TRUE);
539 if (status != RPC_S_OK)
540 break;
541
542 /* make sure server is actually listening on the interface before
543 * returning */
544 RPCRT4_sync_with_server_thread(cps);
545 }
546 LeaveCriticalSection(&server_cs);
547 }
548
549 return status;
550 }
551
552 static void RPCRT4_stop_listen(BOOL auto_listen)
553 {
554 EnterCriticalSection(&listen_cs);
555 if (auto_listen || (--manual_listen_count == 0))
556 {
557 if (listen_count != 0 && --listen_count == 0) {
558 RpcServerProtseq *cps;
559
560 std_listen = FALSE;
561 LeaveCriticalSection(&listen_cs);
562
563 LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
564 RPCRT4_sync_with_server_thread(cps);
565
566 return;
567 }
568 assert(listen_count >= 0);
569 }
570 LeaveCriticalSection(&listen_cs);
571 }
572
573 static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq* ps, LPSTR endpoint)
574 {
575 RPC_STATUS status;
576
577 status = ps->ops->open_endpoint(ps, endpoint);
578 if (status != RPC_S_OK)
579 return status;
580
581 if (std_listen)
582 {
583 status = RPCRT4_start_listen_protseq(ps, FALSE);
584 if (status == RPC_S_OK)
585 RPCRT4_sync_with_server_thread(ps);
586 }
587
588 return status;
589 }
590
591 /***********************************************************************
592 * RpcServerInqBindings (RPCRT4.@)
593 */
594 RPC_STATUS WINAPI RpcServerInqBindings( RPC_BINDING_VECTOR** BindingVector )
595 {
596 RPC_STATUS status;
597 DWORD count;
598 RpcServerProtseq* ps;
599 RpcConnection* conn;
600
601 if (BindingVector)
602 TRACE("(*BindingVector == ^%p)\n", *BindingVector);
603 else
604 ERR("(BindingVector == NULL!!?)\n");
605
606 EnterCriticalSection(&server_cs);
607 /* count connections */
608 count = 0;
609 LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) {
610 EnterCriticalSection(&ps->cs);
611 conn = ps->conn;
612 while (conn) {
613 count++;
614 conn = conn->Next;
615 }
616 LeaveCriticalSection(&ps->cs);
617 }
618 if (count) {
619 /* export bindings */
620 *BindingVector = HeapAlloc(GetProcessHeap(), 0,
621 sizeof(RPC_BINDING_VECTOR) +
622 sizeof(RPC_BINDING_HANDLE)*(count-1));
623 (*BindingVector)->Count = count;
624 count = 0;
625 LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) {
626 EnterCriticalSection(&ps->cs);
627 conn = ps->conn;
628 while (conn) {
629 RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count],
630 conn);
631 count++;
632 conn = conn->Next;
633 }
634 LeaveCriticalSection(&ps->cs);
635 }
636 status = RPC_S_OK;
637 } else {
638 *BindingVector = NULL;
639 status = RPC_S_NO_BINDINGS;
640 }
641 LeaveCriticalSection(&server_cs);
642 return status;
643 }
644
645 /***********************************************************************
646 * RpcServerUseProtseqEpA (RPCRT4.@)
647 */
648 RPC_STATUS WINAPI RpcServerUseProtseqEpA( RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor )
649 {
650 RPC_POLICY policy;
651
652 TRACE( "(%s,%u,%s,%p)\n", Protseq, MaxCalls, Endpoint, SecurityDescriptor );
653
654 /* This should provide the default behaviour */
655 policy.Length = sizeof( policy );
656 policy.EndpointFlags = 0;
657 policy.NICFlags = 0;
658
659 return RpcServerUseProtseqEpExA( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
660 }
661
662 /***********************************************************************
663 * RpcServerUseProtseqEpW (RPCRT4.@)
664 */
665 RPC_STATUS WINAPI RpcServerUseProtseqEpW( RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor )
666 {
667 RPC_POLICY policy;
668
669 TRACE( "(%s,%u,%s,%p)\n", debugstr_w( Protseq ), MaxCalls, debugstr_w( Endpoint ), SecurityDescriptor );
670
671 /* This should provide the default behaviour */
672 policy.Length = sizeof( policy );
673 policy.EndpointFlags = 0;
674 policy.NICFlags = 0;
675
676 return RpcServerUseProtseqEpExW( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
677 }
678
679 /***********************************************************************
680 * alloc_serverprotoseq (internal)
681 *
682 * Must be called with server_cs held.
683 */
684 static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, char *Protseq, RpcServerProtseq **ps)
685 {
686 const struct protseq_ops *ops = rpcrt4_get_protseq_ops(Protseq);
687
688 if (!ops)
689 {
690 FIXME("protseq %s not supported\n", debugstr_a(Protseq));
691 return RPC_S_PROTSEQ_NOT_SUPPORTED;
692 }
693
694 *ps = ops->alloc();
695 if (!*ps)
696 return RPC_S_OUT_OF_RESOURCES;
697 (*ps)->MaxCalls = MaxCalls;
698 (*ps)->Protseq = Protseq;
699 (*ps)->ops = ops;
700 (*ps)->MaxCalls = 0;
701 (*ps)->conn = NULL;
702 InitializeCriticalSection(&(*ps)->cs);
703 (*ps)->is_listening = FALSE;
704 (*ps)->mgr_mutex = NULL;
705 (*ps)->server_ready_event = NULL;
706
707 list_add_head(&protseqs, &(*ps)->entry);
708
709 TRACE("new protseq %p created for %s\n", *ps, Protseq);
710
711 return RPC_S_OK;
712 }
713
714 /* Finds a given protseq or creates a new one if one doesn't already exist */
715 static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, char *Protseq, RpcServerProtseq **ps)
716 {
717 RPC_STATUS status;
718 RpcServerProtseq *cps;
719
720 EnterCriticalSection(&server_cs);
721
722 LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
723 if (!strcmp(cps->Protseq, Protseq))
724 {
725 TRACE("found existing protseq object for %s\n", Protseq);
726 *ps = cps;
727 LeaveCriticalSection(&server_cs);
728 return S_OK;
729 }
730
731 status = alloc_serverprotoseq(MaxCalls, Protseq, ps);
732
733 LeaveCriticalSection(&server_cs);
734
735 return status;
736 }
737
738 /***********************************************************************
739 * RpcServerUseProtseqEpExA (RPCRT4.@)
740 */
741 RPC_STATUS WINAPI RpcServerUseProtseqEpExA( RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor,
742 PRPC_POLICY lpPolicy )
743 {
744 char *szps = (char*)Protseq, *szep = (char*)Endpoint;
745 RpcServerProtseq* ps;
746 RPC_STATUS status;
747
748 TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a(szps), MaxCalls,
749 debugstr_a(szep), SecurityDescriptor,
750 lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
751
752 status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupA(szps), &ps);
753 if (status != RPC_S_OK)
754 return status;
755
756 return RPCRT4_use_protseq(ps, szep);
757 }
758
759 /***********************************************************************
760 * RpcServerUseProtseqEpExW (RPCRT4.@)
761 */
762 RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor,
763 PRPC_POLICY lpPolicy )
764 {
765 RpcServerProtseq* ps;
766 RPC_STATUS status;
767 LPSTR EndpointA;
768
769 TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls,
770 debugstr_w( Endpoint ), SecurityDescriptor,
771 lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
772
773 status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupWtoA(Protseq), &ps);
774 if (status != RPC_S_OK)
775 return status;
776
777 EndpointA = RPCRT4_strdupWtoA(Endpoint);
778 status = RPCRT4_use_protseq(ps, EndpointA);
779 RPCRT4_strfree(EndpointA);
780 return status;
781 }
782
783 /***********************************************************************
784 * RpcServerUseProtseqA (RPCRT4.@)
785 */
786 RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
787 {
788 TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor);
789 return RpcServerUseProtseqEpA(Protseq, MaxCalls, NULL, SecurityDescriptor);
790 }
791
792 /***********************************************************************
793 * RpcServerUseProtseqW (RPCRT4.@)
794 */
795 RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
796 {
797 TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor);
798 return RpcServerUseProtseqEpW(Protseq, MaxCalls, NULL, SecurityDescriptor);
799 }
800
801 /***********************************************************************
802 * RpcServerRegisterIf (RPCRT4.@)
803 */
804 RPC_STATUS WINAPI RpcServerRegisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv )
805 {
806 TRACE("(%p,%s,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv);
807 return RpcServerRegisterIf2( IfSpec, MgrTypeUuid, MgrEpv, 0, RPC_C_LISTEN_MAX_CALLS_DEFAULT, (UINT)-1, NULL );
808 }
809
810 /***********************************************************************
811 * RpcServerRegisterIfEx (RPCRT4.@)
812 */
813 RPC_STATUS WINAPI RpcServerRegisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
814 UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN* IfCallbackFn )
815 {
816 TRACE("(%p,%s,%p,%u,%u,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls, IfCallbackFn);
817 return RpcServerRegisterIf2( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, (UINT)-1, IfCallbackFn );
818 }
819
820 /***********************************************************************
821 * RpcServerRegisterIf2 (RPCRT4.@)
822 */
823 RPC_STATUS WINAPI RpcServerRegisterIf2( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
824 UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn )
825 {
826 PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec;
827 RpcServerInterface* sif;
828 unsigned int i;
829
830 TRACE("(%p,%s,%p,%u,%u,%u,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls,
831 MaxRpcSize, IfCallbackFn);
832 TRACE(" interface id: %s %d.%d\n", debugstr_guid(&If->InterfaceId.SyntaxGUID),
833 If->InterfaceId.SyntaxVersion.MajorVersion,
834 If->InterfaceId.SyntaxVersion.MinorVersion);
835 TRACE(" transfer syntax: %s %d.%d\n", debugstr_guid(&If->TransferSyntax.SyntaxGUID),
836 If->TransferSyntax.SyntaxVersion.MajorVersion,
837 If->TransferSyntax.SyntaxVersion.MinorVersion);
838 TRACE(" dispatch table: %p\n", If->DispatchTable);
839 if (If->DispatchTable) {
840 TRACE(" dispatch table count: %d\n", If->DispatchTable->DispatchTableCount);
841 for (i=0; i<If->DispatchTable->DispatchTableCount; i++) {
842 TRACE(" entry %d: %p\n", i, If->DispatchTable->DispatchTable[i]);
843 }
844 TRACE(" reserved: %ld\n", If->DispatchTable->Reserved);
845 }
846 TRACE(" protseq endpoint count: %d\n", If->RpcProtseqEndpointCount);
847 TRACE(" default manager epv: %p\n", If->DefaultManagerEpv);
848 TRACE(" interpreter info: %p\n", If->InterpreterInfo);
849
850 sif = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcServerInterface));
851 sif->If = If;
852 if (MgrTypeUuid) {
853 sif->MgrTypeUuid = *MgrTypeUuid;
854 sif->MgrEpv = MgrEpv;
855 } else {
856 memset(&sif->MgrTypeUuid, 0, sizeof(UUID));
857 sif->MgrEpv = If->DefaultManagerEpv;
858 }
859 sif->Flags = Flags;
860 sif->MaxCalls = MaxCalls;
861 sif->MaxRpcSize = MaxRpcSize;
862 sif->IfCallbackFn = IfCallbackFn;
863
864 EnterCriticalSection(&server_cs);
865 list_add_head(&server_interfaces, &sif->entry);
866 LeaveCriticalSection(&server_cs);
867
868 if (sif->Flags & RPC_IF_AUTOLISTEN)
869 RPCRT4_start_listen(TRUE);
870
871 return RPC_S_OK;
872 }
873
874 /***********************************************************************
875 * RpcServerUnregisterIf (RPCRT4.@)
876 */
877 RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, UINT WaitForCallsToComplete )
878 {
879 PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec;
880 HANDLE event = NULL;
881 BOOL found = FALSE;
882 BOOL completed = TRUE;
883 RpcServerInterface *cif;
884 RPC_STATUS status;
885
886 TRACE("(IfSpec == (RPC_IF_HANDLE)^%p (%s), MgrTypeUuid == %s, WaitForCallsToComplete == %u)\n",
887 IfSpec, debugstr_guid(&If->InterfaceId.SyntaxGUID), debugstr_guid(MgrTypeUuid), WaitForCallsToComplete);
888
889 EnterCriticalSection(&server_cs);
890 LIST_FOR_EACH_ENTRY(cif, &server_interfaces, RpcServerInterface, entry) {
891 if ((!IfSpec || !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER))) &&
892 UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) {
893 list_remove(&cif->entry);
894 TRACE("unregistering cif %p\n", cif);
895 if (cif->CurrentCalls) {
896 completed = FALSE;
897 cif->Delete = TRUE;
898 if (WaitForCallsToComplete)
899 cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL);
900 }
901 found = TRUE;
902 break;
903 }
904 }
905 LeaveCriticalSection(&server_cs);
906
907 if (!found) {
908 ERR("not found for object %s\n", debugstr_guid(MgrTypeUuid));
909 return RPC_S_UNKNOWN_IF;
910 }
911
912 if (completed)
913 HeapFree(GetProcessHeap(), 0, cif);
914 else if (event) {
915 /* sif will be freed when the last call is completed, so be careful not to
916 * touch that memory here as that could happen before we get here */
917 WaitForSingleObject(event, INFINITE);
918 CloseHandle(event);
919 }
920
921 return RPC_S_OK;
922 }
923
924 /***********************************************************************
925 * RpcServerUnregisterIfEx (RPCRT4.@)
926 */
927 RPC_STATUS WINAPI RpcServerUnregisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles )
928 {
929 FIXME("(IfSpec == (RPC_IF_HANDLE)^%p, MgrTypeUuid == %s, RundownContextHandles == %d): stub\n",
930 IfSpec, debugstr_guid(MgrTypeUuid), RundownContextHandles);
931
932 return RPC_S_OK;
933 }
934
935 /***********************************************************************
936 * RpcObjectSetType (RPCRT4.@)
937 *
938 * PARAMS
939 * ObjUuid [I] "Object" UUID
940 * TypeUuid [I] "Type" UUID
941 *
942 * RETURNS
943 * RPC_S_OK The call succeeded
944 * RPC_S_INVALID_OBJECT The provided object (nil) is not valid
945 * RPC_S_ALREADY_REGISTERED The provided object is already registered
946 *
947 * Maps "Object" UUIDs to "Type" UUID's. Passing the nil UUID as the type
948 * resets the mapping for the specified object UUID to nil (the default).
949 * The nil object is always associated with the nil type and cannot be
950 * reassigned. Servers can support multiple implementations on the same
951 * interface by registering different end-point vectors for the different
952 * types. There's no need to call this if a server only supports the nil
953 * type, as is typical.
954 */
955 RPC_STATUS WINAPI RpcObjectSetType( UUID* ObjUuid, UUID* TypeUuid )
956 {
957 RpcObjTypeMap *map = RpcObjTypeMaps, *prev = NULL;
958 RPC_STATUS dummy;
959
960 TRACE("(ObjUUID == %s, TypeUuid == %s).\n", debugstr_guid(ObjUuid), debugstr_guid(TypeUuid));
961 if ((! ObjUuid) || UuidIsNil(ObjUuid, &dummy)) {
962 /* nil uuid cannot be remapped */
963 return RPC_S_INVALID_OBJECT;
964 }
965
966 /* find the mapping for this object if there is one ... */
967 while (map) {
968 if (! UuidCompare(ObjUuid, &map->Object, &dummy)) break;
969 prev = map;
970 map = map->next;
971 }
972 if ((! TypeUuid) || UuidIsNil(TypeUuid, &dummy)) {
973 /* ... and drop it from the list */
974 if (map) {
975 if (prev)
976 prev->next = map->next;
977 else
978 RpcObjTypeMaps = map->next;
979 HeapFree(GetProcessHeap(), 0, map);
980 }
981 } else {
982 /* ... , fail if we found it ... */
983 if (map)
984 return RPC_S_ALREADY_REGISTERED;
985 /* ... otherwise create a new one and add it in. */
986 map = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcObjTypeMap));
987 map->Object = *ObjUuid;
988 map->Type = *TypeUuid;
989 map->next = NULL;
990 if (prev)
991 prev->next = map; /* prev is the last map in the linklist */
992 else
993 RpcObjTypeMaps = map;
994 }
995
996 return RPC_S_OK;
997 }
998
999 /***********************************************************************
1000 * RpcServerRegisterAuthInfoA (RPCRT4.@)
1001 */
1002 RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
1003 LPVOID Arg )
1004 {
1005 FIXME( "(%s,%u,%p,%p): stub\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg );
1006
1007 return RPC_S_UNKNOWN_AUTHN_SERVICE; /* We don't know any authentication services */
1008 }
1009
1010 /***********************************************************************
1011 * RpcServerRegisterAuthInfoW (RPCRT4.@)
1012 */
1013 RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn,
1014 LPVOID Arg )
1015 {
1016 FIXME( "(%s,%u,%p,%p): stub\n", debugstr_w( ServerPrincName ), AuthnSvc, GetKeyFn, Arg );
1017
1018 return RPC_S_UNKNOWN_AUTHN_SERVICE; /* We don't know any authentication services */
1019 }
1020
1021 /***********************************************************************
1022 * RpcServerListen (RPCRT4.@)
1023 */
1024 RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait )
1025 {
1026 RPC_STATUS status = RPC_S_OK;
1027
1028 TRACE("(%u,%u,%u)\n", MinimumCallThreads, MaxCalls, DontWait);
1029
1030 if (list_empty(&protseqs))
1031 return RPC_S_NO_PROTSEQS_REGISTERED;
1032
1033 status = RPCRT4_start_listen(FALSE);
1034
1035 if (DontWait || (status != RPC_S_OK)) return status;
1036
1037 return RpcMgmtWaitServerListen();
1038 }
1039
1040 /***********************************************************************
1041 * RpcMgmtServerWaitListen (RPCRT4.@)
1042 */
1043 RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
1044 {
1045 RpcServerProtseq *cps;
1046
1047 EnterCriticalSection(&listen_cs);
1048
1049 if (!std_listen) {
1050 LeaveCriticalSection(&listen_cs);
1051 return RPC_S_NOT_LISTENING;
1052 }
1053
1054 do {
1055 LeaveCriticalSection(&listen_cs);
1056 LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry)
1057 WaitForSingleObject(cps->server_ready_event, INFINITE);
1058
1059 EnterCriticalSection(&listen_cs);
1060 } while (!std_listen);
1061
1062 LeaveCriticalSection(&listen_cs);
1063
1064 return RPC_S_OK;
1065 }
1066
1067 /***********************************************************************
1068 * RpcMgmtStopServerListening (RPCRT4.@)
1069 */
1070 RPC_STATUS WINAPI RpcMgmtStopServerListening ( RPC_BINDING_HANDLE Binding )
1071 {
1072 TRACE("(Binding == (RPC_BINDING_HANDLE)^%p)\n", Binding);
1073
1074 if (Binding) {
1075 FIXME("client-side invocation not implemented.\n");
1076 return RPC_S_WRONG_KIND_OF_BINDING;
1077 }
1078
1079 RPCRT4_stop_listen(FALSE);
1080
1081 return RPC_S_OK;
1082 }
1083
1084 /***********************************************************************
1085 * RpcMgmtEnableIdleCleanup (RPCRT4.@)
1086 */
1087 RPC_STATUS WINAPI RpcMgmtEnableIdleCleanup(void)
1088 {
1089 FIXME("(): stub\n");
1090 return RPC_S_OK;
1091 }
1092
1093 /***********************************************************************
1094 * I_RpcServerStartListening (RPCRT4.@)
1095 */
1096 RPC_STATUS WINAPI I_RpcServerStartListening( HWND hWnd )
1097 {
1098 FIXME( "(%p): stub\n", hWnd );
1099
1100 return RPC_S_OK;
1101 }
1102
1103 /***********************************************************************
1104 * I_RpcServerStopListening (RPCRT4.@)
1105 */
1106 RPC_STATUS WINAPI I_RpcServerStopListening( void )
1107 {
1108 FIXME( "(): stub\n" );
1109
1110 return RPC_S_OK;
1111 }
1112
1113 /***********************************************************************
1114 * I_RpcWindowProc (RPCRT4.@)
1115 */
1116 UINT WINAPI I_RpcWindowProc( void *hWnd, UINT Message, UINT wParam, ULONG lParam )
1117 {
1118 FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
1119
1120 return 0;
1121 }
1122
1123 /***********************************************************************
1124 * RpcMgmtInqIfIds (RPCRT4.@)
1125 */
1126 RPC_STATUS WINAPI RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR **IfIdVector)
1127 {
1128 FIXME("(%p,%p): stub\n", Binding, IfIdVector);
1129 return RPC_S_INVALID_BINDING;
1130 }
1131
1132 /***********************************************************************
1133 * RpcMgmtInqStats (RPCRT4.@)
1134 */
1135 RPC_STATUS WINAPI RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
1136 {
1137 RPC_STATS_VECTOR *stats;
1138
1139 FIXME("(%p,%p)\n", Binding, Statistics);
1140
1141 if ((stats = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_STATS_VECTOR))))
1142 {
1143 stats->Count = 1;
1144 stats->Stats[0] = 0;
1145 *Statistics = stats;
1146 return RPC_S_OK;
1147 }
1148 return RPC_S_OUT_OF_RESOURCES;
1149 }
1150
1151 /***********************************************************************
1152 * RpcMgmtStatsVectorFree (RPCRT4.@)
1153 */
1154 RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
1155 {
1156 FIXME("(%p)\n", StatsVector);
1157
1158 if (StatsVector)
1159 {
1160 HeapFree(GetProcessHeap(), 0, *StatsVector);
1161 *StatsVector = NULL;
1162 }
1163 return RPC_S_OK;
1164 }
1165
1166 /***********************************************************************
1167 * RpcMgmtEpEltInqBegin (RPCRT4.@)
1168 */
1169 RPC_STATUS WINAPI RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE Binding, ULONG InquiryType,
1170 RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
1171 {
1172 FIXME("(%p,%u,%p,%u,%p,%p): stub\n",
1173 Binding, InquiryType, IfId, VersOption, ObjectUuid, InquiryContext);
1174 return RPC_S_INVALID_BINDING;
1175 }
1176
1177 /***********************************************************************
1178 * RpcMgmtIsServerListening (RPCRT4.@)
1179 */
1180 RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
1181 {
1182 FIXME("(%p): stub\n", Binding);
1183 return RPC_S_INVALID_BINDING;
1184 }
1185
1186 /***********************************************************************
1187 * RpcMgmtSetServerStackSize (RPCRT4.@)
1188 */
1189 RPC_STATUS WINAPI RpcMgmtSetServerStackSize(ULONG ThreadStackSize)
1190 {
1191 FIXME("(0x%x): stub\n", ThreadStackSize);
1192 return RPC_S_OK;
1193 }
1194
1195 /***********************************************************************
1196 * I_RpcGetCurrentCallHandle (RPCRT4.@)
1197 */
1198 RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
1199 {
1200 TRACE("\n");
1201 return RPCRT4_GetThreadCurrentCallHandle();
1202 }