ReactOS  0.4.14-dev-49-gfb4591c
rpc_server.c
Go to the documentation of this file.
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 #include "secext.h"
48 
50 
51 typedef struct _RpcPacket
52 {
56  unsigned char *auth_data;
58 } RpcPacket;
59 
60 typedef struct _RpcObjTypeMap
61 {
62  /* FIXME: a hash table would be better. */
67 
69 
70 /* list of type RpcServerProtseq */
71 static struct list protseqs = LIST_INIT(protseqs);
74 
77 {
78  0, 0, &server_cs,
80  0, 0, { (DWORD_PTR)(__FILE__ ": server_cs") }
81 };
82 static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
83 
86 {
87  0, 0, &listen_cs,
89  0, 0, { (DWORD_PTR)(__FILE__ ": listen_cs") }
90 };
91 static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
92 
95 {
96  0, 0, &server_auth_info_cs,
98  0, 0, { (DWORD_PTR)(__FILE__ ": server_auth_info_cs") }
99 };
101 
102 /* whether the server is currently listening */
104 /* total listeners including auto listeners */
106 /* event set once all manual listening is finished */
108 
109 static UUID uuid_nil;
110 
111 static inline RpcObjTypeMap *LookupObjTypeMap(UUID *ObjUuid)
112 {
115 
116  while (rslt) {
117  if (! UuidCompare(ObjUuid, &rslt->Object, &dummy)) break;
118  rslt = rslt->next;
119  }
120 
121  return rslt;
122 }
123 
124 static inline UUID *LookupObjType(UUID *ObjUuid)
125 {
126  RpcObjTypeMap *map = LookupObjTypeMap(ObjUuid);
127  if (map)
128  return &map->Type;
129  else
130  return &uuid_nil;
131 }
132 
134  const RPC_SYNTAX_IDENTIFIER *if_id,
135  const RPC_SYNTAX_IDENTIFIER *transfer_syntax,
136  BOOL check_object)
137 {
138  UUID* MgrType = NULL;
139  RpcServerInterface* cif;
141 
142  if (check_object)
143  MgrType = LookupObjType(object);
146  if (!memcmp(if_id, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)) &&
147  (!transfer_syntax || !memcmp(transfer_syntax, &cif->If->TransferSyntax, sizeof(RPC_SYNTAX_IDENTIFIER))) &&
148  (check_object == FALSE || UuidEqual(MgrType, &cif->MgrTypeUuid, &status)) &&
149  std_listen) {
151  break;
152  }
153  }
155  if (&cif->entry == &server_interfaces) cif = NULL;
156  TRACE("returning %p for object %s, if_id { %d.%d %s }\n", cif,
157  debugstr_guid(object), if_id->SyntaxVersion.MajorVersion,
159  return cif;
160 }
161 
163 {
164  if (!InterlockedDecrement(&sif->CurrentCalls) &&
165  sif->Delete) {
166  /* sif must have been removed from server_interfaces before
167  * CallsCompletedEvent is set */
168  if (sif->CallsCompletedEvent)
170  HeapFree(GetProcessHeap(), 0, sif);
171  }
172 }
173 
175 {
176  unsigned int reject_reason;
177  switch (error)
178  {
180  reject_reason = REJECT_TEMPORARY_CONGESTION;
181  break;
182  case ERROR_OUTOFMEMORY:
184  reject_reason = REJECT_LOCAL_LIMIT_EXCEEDED;
185  break;
188  break;
190  reject_reason = REJECT_UNKNOWN_AUTHN_SERVICE;
191  break;
192  case ERROR_ACCESS_DENIED:
193  reject_reason = REJECT_INVALID_CHECKSUM;
194  break;
195  default:
196  FIXME("unexpected status value %d\n", error);
197  /* fall through */
198  case RPC_S_INVALID_BOUND:
199  reject_reason = REJECT_REASON_NOT_SPECIFIED;
200  break;
201  }
204  reject_reason);
205 }
206 
209  unsigned char *auth_data, ULONG auth_length, RpcPktHdr **ack_response,
210  unsigned char **auth_data_out, ULONG *auth_length_out)
211 {
213  RpcContextElement *ctxt_elem;
214  unsigned int i;
216 
217  /* validate data */
218  for (i = 0, ctxt_elem = msg->Buffer;
219  i < hdr->num_elements;
220  i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes])
221  {
222  if (((char *)ctxt_elem - (char *)msg->Buffer) > msg->BufferLength ||
223  ((char *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes] - (char *)msg->Buffer) > msg->BufferLength)
224  {
225  ERR("inconsistent data in packet - packet length %d, num elements %d\n",
226  msg->BufferLength, hdr->num_elements);
227  return RPC_S_INVALID_BOUND;
228  }
229  }
230 
231  if (hdr->max_tsize < RPC_MIN_PACKET_SIZE ||
233  conn->server_binding)
234  {
235  TRACE("packet size less than min size, or active interface syntax guid non-null\n");
236 
237  return RPC_S_INVALID_BOUND;
238  }
239 
241  hdr->num_elements * sizeof(*results));
242  if (!results)
243  return RPC_S_OUT_OF_RESOURCES;
244 
245  for (i = 0, ctxt_elem = (RpcContextElement *)msg->Buffer;
246  i < hdr->num_elements;
247  i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes])
248  {
249  RpcServerInterface* sif = NULL;
250  unsigned int j;
251 
252  for (j = 0; !sif && j < ctxt_elem->num_syntaxes; j++)
253  {
254  sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax,
255  &ctxt_elem->transfer_syntaxes[j], FALSE);
256  if (sif)
257  break;
258  }
259  if (sif)
260  {
262  TRACE("accepting bind request on connection %p for %s\n", conn,
264  results[i].result = RESULT_ACCEPT;
265  results[i].reason = REASON_NONE;
266  results[i].transfer_syntax = ctxt_elem->transfer_syntaxes[j];
267 
268  /* save the interface for later use */
269  /* FIXME: save linked list */
270  conn->ActiveInterface = ctxt_elem->abstract_syntax;
271  }
272  else if ((sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax,
273  NULL, FALSE)) != NULL)
274  {
276  TRACE("not accepting bind request on connection %p for %s - no transfer syntaxes supported\n",
277  conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID));
280  memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax));
281  }
282  else
283  {
284  TRACE("not accepting bind request on connection %p for %s - abstract syntax not supported\n",
285  conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID));
288  memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax));
289  }
290  }
291 
292  /* create temporary binding */
293  status = RPCRT4_MakeBinding(&conn->server_binding, conn);
294  if (status != RPC_S_OK)
295  {
297  return status;
298  }
299 
301  conn->NetworkAddr, conn->Endpoint,
302  conn->NetworkOptions,
303  hdr->assoc_gid,
304  &conn->server_binding->Assoc);
305  if (status != RPC_S_OK)
306  {
308  return status;
309  }
310 
311  if (auth_length)
312  {
314  (RpcAuthVerifier *)auth_data,
315  auth_length, auth_data_out,
316  auth_length_out);
317  if (status != RPC_S_OK)
318  {
320  return status;
321  }
322  }
323 
327  conn->server_binding->Assoc->assoc_group_id,
328  conn->Endpoint, hdr->num_elements,
329  results);
331 
332  if (*ack_response)
333  conn->MaxTransmissionSize = hdr->max_tsize;
334  else
336 
337  return status;
338 }
339 
341  RPC_MESSAGE *msg,
342  unsigned char *auth_data,
343  ULONG auth_length)
344 {
346  RpcPktHdr *response = NULL;
347  unsigned char *auth_data_out = NULL;
348  ULONG auth_length_out = 0;
349 
350  status = process_bind_packet_no_send(conn, hdr, msg, auth_data, auth_length,
351  &response, &auth_data_out,
352  &auth_length_out);
353  if (status != RPC_S_OK)
354  response = handle_bind_error(conn, status);
355  if (response)
356  status = RPCRT4_SendWithAuth(conn, response, NULL, 0, auth_data_out, auth_length_out);
357  else
359  RPCRT4_FreeHeader(response);
360 
361  return status;
362 }
363 
364 
366 {
368  RpcPktHdr *response = NULL;
369  RpcServerInterface* sif;
371  BOOL exception;
372  UUID *object_uuid;
373  NDR_SCONTEXT context_handle;
374  void *buf = msg->Buffer;
375 
376  /* fail if the connection isn't bound with an interface */
377  if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status)) {
378  /* FIXME: should send BindNack instead */
380  status);
381 
382  RPCRT4_Send(conn, response, NULL, 0);
383  RPCRT4_FreeHeader(response);
384  return RPC_S_OK;
385  }
386 
387  if (hdr->common.flags & RPC_FLG_OBJECT_UUID) {
388  object_uuid = (UUID*)(hdr + 1);
389  } else {
390  object_uuid = NULL;
391  }
392 
393  sif = RPCRT4_find_interface(object_uuid, &conn->ActiveInterface, NULL, TRUE);
394  if (!sif) {
395  WARN("interface %s no longer registered, returning fault packet\n", debugstr_guid(&conn->ActiveInterface.SyntaxGUID));
397  NCA_S_UNK_IF);
398 
399  RPCRT4_Send(conn, response, NULL, 0);
400  RPCRT4_FreeHeader(response);
401  return RPC_S_OK;
402  }
403  msg->RpcInterfaceInformation = sif->If;
404  /* copy the endpoint vector from sif to msg so that midl-generated code will use it */
405  msg->ManagerEpv = sif->MgrEpv;
406  if (object_uuid != NULL) {
407  RPCRT4_SetBindingObject(msg->Handle, object_uuid);
408  }
409 
410  /* find dispatch function */
411  msg->ProcNum = hdr->opnum;
412  if (sif->Flags & RPC_IF_OLE) {
413  /* native ole32 always gives us a dispatch table with a single entry
414  * (I assume that's a wrapper for IRpcStubBuffer::Invoke) */
416  } else {
417  if (msg->ProcNum >= sif->If->DispatchTable->DispatchTableCount) {
418  WARN("invalid procnum (%d/%d)\n", msg->ProcNum, sif->If->DispatchTable->DispatchTableCount);
421 
422  RPCRT4_Send(conn, response, NULL, 0);
423  RPCRT4_FreeHeader(response);
424  }
425  func = sif->If->DispatchTable->DispatchTable[msg->ProcNum];
426  }
427 
428  /* put in the drep. FIXME: is this more universally applicable?
429  perhaps we should move this outward... */
430  msg->DataRepresentation =
431  MAKELONG( MAKEWORD(hdr->common.drep[0], hdr->common.drep[1]),
432  MAKEWORD(hdr->common.drep[2], hdr->common.drep[3]));
433 
434  exception = FALSE;
435 
436  /* dispatch */
438  __TRY {
439  if (func) func(msg);
440  } __EXCEPT_ALL {
441  WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
442  exception = TRUE;
445  else
447  response = RPCRT4_BuildFaultHeader(msg->DataRepresentation,
449  } __ENDTRY
451 
452  /* release any unmarshalled context handles */
453  while ((context_handle = RPCRT4_PopThreadContextHandle()) != NULL)
454  RpcServerAssoc_ReleaseContextHandle(conn->server_binding->Assoc, context_handle, TRUE);
455 
456  if (!exception)
457  response = RPCRT4_BuildResponseHeader(msg->DataRepresentation,
458  msg->BufferLength);
459 
460  /* send response packet */
461  if (response) {
462  status = RPCRT4_Send(conn, response, exception ? NULL : msg->Buffer,
463  exception ? 0 : msg->BufferLength);
464  RPCRT4_FreeHeader(response);
465  } else
466  ERR("out of memory\n");
467 
468  msg->RpcInterfaceInformation = NULL;
470 
471  if (msg->Buffer == buf) buf = NULL;
472  TRACE("freeing Buffer=%p\n", buf);
473  I_RpcFree(buf);
474 
475  return status;
476 }
477 
480  RPC_MESSAGE *msg,
481  unsigned char *auth_data,
482  ULONG auth_length)
483 {
485 
486  if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status) ||
487  !auth_length || msg->BufferLength != 0)
489  else
490  {
492  (RpcAuthVerifier *)auth_data,
493  auth_length, NULL, NULL);
494  }
495 
496  /* FIXME: client doesn't expect a response to this message so must store
497  * status in connection so that fault packet can be returned when next
498  * packet is received */
499 
500  return RPC_S_OK;
501 }
502 
504  RPC_MESSAGE* msg, unsigned char *auth_data,
505  ULONG auth_length)
506 {
507  msg->Handle = (RPC_BINDING_HANDLE)conn->server_binding;
508 
509  switch (hdr->common.ptype) {
510  case PKT_BIND:
511  TRACE("got bind packet\n");
512  process_bind_packet(conn, &hdr->bind, msg, auth_data, auth_length);
513  break;
514 
515  case PKT_REQUEST:
516  TRACE("got request packet\n");
517  process_request_packet(conn, &hdr->request, msg);
518  break;
519 
520  case PKT_AUTH3:
521  TRACE("got auth3 packet\n");
522  process_auth3_packet(conn, &hdr->common, msg, auth_data, auth_length);
523  break;
524  default:
525  FIXME("unhandled packet type %u\n", hdr->common.ptype);
526  break;
527  }
528 
529  /* clean up */
530  I_RpcFree(msg->Buffer);
532  HeapFree(GetProcessHeap(), 0, msg);
533  HeapFree(GetProcessHeap(), 0, auth_data);
534 }
535 
537 {
538  RpcPacket *pkt = the_arg;
539  RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg, pkt->auth_data,
540  pkt->auth_length);
542  HeapFree(GetProcessHeap(), 0, pkt);
543  return 0;
544 }
545 
547 {
548  RpcConnection* conn = the_arg;
549  RpcPktHdr *hdr;
550  RPC_MESSAGE *msg;
552  RpcPacket *packet;
553  unsigned char *auth_data;
554  ULONG auth_length;
555 
556  TRACE("(%p)\n", conn);
557 
558  for (;;) {
560  if (!msg) break;
561 
562  status = RPCRT4_ReceiveWithAuth(conn, &hdr, msg, &auth_data, &auth_length);
563  if (status != RPC_S_OK) {
564  WARN("receive failed with error %x\n", status);
565  HeapFree(GetProcessHeap(), 0, msg);
566  break;
567  }
568 
569  switch (hdr->common.ptype) {
570  case PKT_BIND:
571  TRACE("got bind packet\n");
572 
573  status = process_bind_packet(conn, &hdr->bind, msg, auth_data,
574  auth_length);
575  break;
576 
577  case PKT_REQUEST:
578  TRACE("got request packet\n");
579 
580  packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket));
581  if (!packet) {
582  I_RpcFree(msg->Buffer);
584  HeapFree(GetProcessHeap(), 0, msg);
585  HeapFree(GetProcessHeap(), 0, auth_data);
586  goto exit;
587  }
588  packet->conn = RPCRT4_GrabConnection( conn );
589  packet->hdr = hdr;
590  packet->msg = msg;
591  packet->auth_data = auth_data;
592  packet->auth_length = auth_length;
594  ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError());
597  } else {
598  continue;
599  }
600  break;
601 
602  case PKT_AUTH3:
603  TRACE("got auth3 packet\n");
604 
605  status = process_auth3_packet(conn, &hdr->common, msg, auth_data,
606  auth_length);
607  break;
608  default:
609  FIXME("unhandled packet type %u\n", hdr->common.ptype);
610  break;
611  }
612 
613  I_RpcFree(msg->Buffer);
615  HeapFree(GetProcessHeap(), 0, msg);
616  HeapFree(GetProcessHeap(), 0, auth_data);
617 
618  if (status != RPC_S_OK) {
619  WARN("processing packet failed with error %u\n", status);
620  break;
621  }
622  }
623 exit:
625  return 0;
626 }
627 
629 {
631  if (!thread) {
632  DWORD err = GetLastError();
633  ERR("failed to create thread, error=%08x\n", err);
635  }
636  /* we could set conn->thread, but then we'd have to make the io_thread wait
637  * for that, otherwise the thread might finish, destroy the connection, and
638  * free the memory we'd write to before we did, causing crashes and stuff -
639  * so let's implement that later, when we really need conn->thread */
640 
641  CloseHandle( thread );
642 }
643 
645 {
646  int res;
647  unsigned int count;
648  void *objs = NULL;
649  RpcServerProtseq* cps = the_arg;
650  RpcConnection* conn;
651  BOOL set_ready_event = FALSE;
652 
653  TRACE("(the_arg == ^%p)\n", the_arg);
654 
655  for (;;) {
656  objs = cps->ops->get_wait_array(cps, objs, &count);
657 
658  if (set_ready_event)
659  {
660  /* signal to function that changed state that we are now sync'ed */
662  set_ready_event = FALSE;
663  }
664 
665  /* start waiting */
666  res = cps->ops->wait_for_new_connection(cps, count, objs);
667 
668  if (res == -1 || (res == 0 && !std_listen))
669  {
670  /* cleanup */
671  cps->ops->free_wait_array(cps, objs);
672  break;
673  }
674  else if (res == 0)
675  set_ready_event = TRUE;
676  }
677 
678  TRACE("closing connections\n");
679 
680  EnterCriticalSection(&cps->cs);
681  LIST_FOR_EACH_ENTRY(conn, &cps->listeners, RpcConnection, protseq_entry)
683  LIST_FOR_EACH_ENTRY(conn, &cps->connections, RpcConnection, protseq_entry)
684  {
685  RPCRT4_GrabConnection(conn);
687  }
688  LeaveCriticalSection(&cps->cs);
689 
690  if (res == 0 && !std_listen)
692 
693  TRACE("waiting for active connections to close\n");
694 
695  EnterCriticalSection(&cps->cs);
696  while (!list_empty(&cps->connections))
697  {
698  conn = LIST_ENTRY(list_head(&cps->connections), RpcConnection, protseq_entry);
699  LeaveCriticalSection(&cps->cs);
701  EnterCriticalSection(&cps->cs);
702  }
703  LeaveCriticalSection(&cps->cs);
704 
707  cps->server_thread = NULL;
709  TRACE("done\n");
710  return 0;
711 }
712 
713 /* tells the server thread that the state has changed and waits for it to
714  * make the changes */
716 {
717  /* make sure we are the only thread sync'ing the server state, otherwise
718  * there is a race with the server thread setting an older state and setting
719  * the server_ready_event when the new state hasn't yet been applied */
721 
722  ps->ops->signal_state_changed(ps);
723 
724  /* wait for server thread to make the requested changes before returning */
726 
727  ReleaseMutex(ps->mgr_mutex);
728 }
729 
731 {
733 
735  if (ps->server_thread) goto done;
736 
737  if (!ps->mgr_mutex) ps->mgr_mutex = CreateMutexW(NULL, FALSE, NULL);
740  if (!ps->server_thread)
742 
743 done:
745  return status;
746 }
747 
749 {
751  RpcServerProtseq *cps;
752 
753  TRACE("\n");
754 
756  if (auto_listen || !listen_done_event)
757  {
758  status = RPC_S_OK;
759  if(!auto_listen)
761  if (++listen_count == 1)
762  std_listen = TRUE;
763  }
765  if (status) return status;
766 
767  if (std_listen)
768  {
771  {
773  if (status != RPC_S_OK)
774  break;
775 
776  /* make sure server is actually listening on the interface before
777  * returning */
779  }
781  }
782 
783  return status;
784 }
785 
786 static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
787 {
788  BOOL stop_listen = FALSE;
790 
792  if (!std_listen && (auto_listen || !listen_done_event))
793  {
795  }
796  else
797  {
798  stop_listen = listen_count != 0 && --listen_count == 0;
799  assert(listen_count >= 0);
800  if (stop_listen)
801  std_listen = FALSE;
802  }
804 
805  if (status) return status;
806 
807  if (stop_listen) {
808  RpcServerProtseq *cps;
813  }
814 
815  if (!auto_listen)
816  {
820  }
821  return RPC_S_OK;
822 }
823 
825 {
826  RpcConnection *conn;
827  BOOL registered = FALSE;
828  EnterCriticalSection(&protseq->cs);
829  LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection, protseq_entry) {
830  if (!endpoint || !strcmp(endpoint, conn->Endpoint)) {
831  registered = TRUE;
832  break;
833  }
834  }
835  LeaveCriticalSection(&protseq->cs);
836  return registered;
837 }
838 
840 {
842 
843  EnterCriticalSection(&ps->cs);
844 
846  status = RPC_S_OK;
847  else
848  status = ps->ops->open_endpoint(ps, endpoint);
849 
850  LeaveCriticalSection(&ps->cs);
851 
852  if (status != RPC_S_OK)
853  return status;
854 
855  if (std_listen)
856  {
858  if (status == RPC_S_OK)
860  }
861 
862  return status;
863 }
864 
865 /***********************************************************************
866  * RpcServerInqBindings (RPCRT4.@)
867  */
869 {
871  DWORD count;
872  RpcServerProtseq* ps;
873  RpcConnection* conn;
874 
875  if (BindingVector)
876  TRACE("(*BindingVector == ^%p)\n", *BindingVector);
877  else
878  ERR("(BindingVector == NULL!!?)\n");
879 
881  /* count connections */
882  count = 0;
884  EnterCriticalSection(&ps->cs);
885  LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry)
886  count++;
887  LeaveCriticalSection(&ps->cs);
888  }
889  if (count) {
890  /* export bindings */
891  *BindingVector = HeapAlloc(GetProcessHeap(), 0,
892  sizeof(RPC_BINDING_VECTOR) +
893  sizeof(RPC_BINDING_HANDLE)*(count-1));
894  (*BindingVector)->Count = count;
895  count = 0;
897  EnterCriticalSection(&ps->cs);
898  LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry) {
899  RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count],
900  conn);
901  count++;
902  }
903  LeaveCriticalSection(&ps->cs);
904  }
905  status = RPC_S_OK;
906  } else {
907  *BindingVector = NULL;
909  }
911  return status;
912 }
913 
914 /***********************************************************************
915  * RpcServerUseProtseqEpA (RPCRT4.@)
916  */
918 {
919  RPC_POLICY policy;
920 
921  TRACE( "(%s,%u,%s,%p)\n", Protseq, MaxCalls, Endpoint, SecurityDescriptor );
922 
923  /* This should provide the default behaviour */
924  policy.Length = sizeof( policy );
925  policy.EndpointFlags = 0;
926  policy.NICFlags = 0;
927 
928  return RpcServerUseProtseqEpExA( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
929 }
930 
931 /***********************************************************************
932  * RpcServerUseProtseqEpW (RPCRT4.@)
933  */
935 {
936  RPC_POLICY policy;
937 
938  TRACE( "(%s,%u,%s,%p)\n", debugstr_w( Protseq ), MaxCalls, debugstr_w( Endpoint ), SecurityDescriptor );
939 
940  /* This should provide the default behaviour */
941  policy.Length = sizeof( policy );
942  policy.EndpointFlags = 0;
943  policy.NICFlags = 0;
944 
945  return RpcServerUseProtseqEpExW( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
946 }
947 
948 /***********************************************************************
949  * alloc_serverprotoseq (internal)
950  *
951  * Must be called with server_cs held.
952  */
953 static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
954 {
955  const struct protseq_ops *ops = rpcrt4_get_protseq_ops(Protseq);
956 
957  if (!ops)
958  {
959  FIXME("protseq %s not supported\n", debugstr_a(Protseq));
961  }
962 
963  *ps = ops->alloc();
964  if (!*ps)
965  return RPC_S_OUT_OF_RESOURCES;
966  (*ps)->MaxCalls = MaxCalls;
967  (*ps)->Protseq = RPCRT4_strdupA(Protseq);
968  (*ps)->ops = ops;
969  list_init(&(*ps)->listeners);
970  list_init(&(*ps)->connections);
971  InitializeCriticalSection(&(*ps)->cs);
972  (*ps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcServerProtseq.cs");
973 
974  list_add_head(&protseqs, &(*ps)->entry);
975 
976  TRACE("new protseq %p created for %s\n", *ps, Protseq);
977 
978  return RPC_S_OK;
979 }
980 
981 /* must be called with server_cs held */
983 {
984  RPCRT4_strfree(ps->Protseq);
985  ps->cs.DebugInfo->Spare[0] = 0;
987  CloseHandle(ps->mgr_mutex);
989  list_remove(&ps->entry);
990  HeapFree(GetProcessHeap(), 0, ps);
991 }
992 
993 /* Finds a given protseq or creates a new one if one doesn't already exist */
994 static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
995 {
997  RpcServerProtseq *cps;
998 
1000 
1002  if (!strcmp(cps->Protseq, Protseq))
1003  {
1004  TRACE("found existing protseq object for %s\n", Protseq);
1005  *ps = cps;
1007  return S_OK;
1008  }
1009 
1010  status = alloc_serverprotoseq(MaxCalls, Protseq, ps);
1011 
1013 
1014  return status;
1015 }
1016 
1017 /***********************************************************************
1018  * RpcServerUseProtseqEpExA (RPCRT4.@)
1019  */
1021  PRPC_POLICY lpPolicy )
1022 {
1023  RpcServerProtseq* ps;
1025 
1026  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a((const char *)Protseq),
1027  MaxCalls, debugstr_a((const char *)Endpoint), SecurityDescriptor,
1028  lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
1029 
1030  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps);
1031  if (status != RPC_S_OK)
1032  return status;
1033 
1034  return RPCRT4_use_protseq(ps, (const char *)Endpoint);
1035 }
1036 
1037 /***********************************************************************
1038  * RpcServerUseProtseqEpExW (RPCRT4.@)
1039  */
1041  PRPC_POLICY lpPolicy )
1042 {
1043  RpcServerProtseq* ps;
1045  LPSTR ProtseqA;
1046  LPSTR EndpointA;
1047 
1048  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls,
1049  debugstr_w( Endpoint ), SecurityDescriptor,
1050  lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
1051 
1052  ProtseqA = RPCRT4_strdupWtoA(Protseq);
1053  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
1054  RPCRT4_strfree(ProtseqA);
1055  if (status != RPC_S_OK)
1056  return status;
1057 
1058  EndpointA = RPCRT4_strdupWtoA(Endpoint);
1059  status = RPCRT4_use_protseq(ps, EndpointA);
1060  RPCRT4_strfree(EndpointA);
1061  return status;
1062 }
1063 
1064 /***********************************************************************
1065  * RpcServerUseProtseqA (RPCRT4.@)
1066  */
1067 RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
1068 {
1070  RpcServerProtseq* ps;
1071 
1072  TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor);
1073 
1074  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps);
1075  if (status != RPC_S_OK)
1076  return status;
1077 
1078  return RPCRT4_use_protseq(ps, NULL);
1079 }
1080 
1081 /***********************************************************************
1082  * RpcServerUseProtseqW (RPCRT4.@)
1083  */
1084 RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
1085 {
1087  RpcServerProtseq* ps;
1088  LPSTR ProtseqA;
1089 
1090  TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor);
1091 
1092  ProtseqA = RPCRT4_strdupWtoA(Protseq);
1093  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
1094  RPCRT4_strfree(ProtseqA);
1095  if (status != RPC_S_OK)
1096  return status;
1097 
1098  return RPCRT4_use_protseq(ps, NULL);
1099 }
1100 
1102 {
1103  RpcServerProtseq *cps, *cursor2;
1104 
1105  if (listen_count != 0)
1106  std_listen = FALSE;
1107 
1110  {
1111  if (listen_count != 0)
1114  }
1118 }
1119 
1120 /***********************************************************************
1121  * RpcServerRegisterIf (RPCRT4.@)
1122  */
1124 {
1125  TRACE("(%p,%s,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv);
1126  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, 0, RPC_C_LISTEN_MAX_CALLS_DEFAULT, (UINT)-1, NULL, NULL );
1127 }
1128 
1129 /***********************************************************************
1130  * RpcServerRegisterIfEx (RPCRT4.@)
1131  */
1133  UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN* IfCallbackFn )
1134 {
1135  TRACE("(%p,%s,%p,%u,%u,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls, IfCallbackFn);
1136  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, (UINT)-1, IfCallbackFn, NULL );
1137 }
1138 
1139 /***********************************************************************
1140  * RpcServerRegisterIf2 (RPCRT4.@)
1141  */
1143  UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn )
1144 {
1145  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, MaxRpcSize, IfCallbackFn, NULL );
1146 }
1147 
1148 /***********************************************************************
1149  * RpcServerRegisterIf3 (RPCRT4.@)
1150  */
1152  UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn, void* SecurityDescriptor)
1153 {
1154  PRPC_SERVER_INTERFACE If = IfSpec;
1155  RpcServerInterface* sif;
1156  unsigned int i;
1157 
1158  TRACE("(%p,%s,%p,%u,%u,%u,%p,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls,
1159  MaxRpcSize, IfCallbackFn, SecurityDescriptor);
1160 
1161  if (SecurityDescriptor)
1162  FIXME("Unsupported SecurityDescriptor argument.\n");
1163 
1164  TRACE(" interface id: %s %d.%d\n", debugstr_guid(&If->InterfaceId.SyntaxGUID),
1167  TRACE(" transfer syntax: %s %d.%d\n", debugstr_guid(&If->TransferSyntax.SyntaxGUID),
1170  TRACE(" dispatch table: %p\n", If->DispatchTable);
1171  if (If->DispatchTable) {
1172  TRACE(" dispatch table count: %d\n", If->DispatchTable->DispatchTableCount);
1173  for (i=0; i<If->DispatchTable->DispatchTableCount; i++) {
1174  TRACE(" entry %d: %p\n", i, If->DispatchTable->DispatchTable[i]);
1175  }
1176  TRACE(" reserved: %ld\n", If->DispatchTable->Reserved);
1177  }
1178  TRACE(" protseq endpoint count: %d\n", If->RpcProtseqEndpointCount);
1179  TRACE(" default manager epv: %p\n", If->DefaultManagerEpv);
1180  TRACE(" interpreter info: %p\n", If->InterpreterInfo);
1181 
1183  sif->If = If;
1184  if (MgrTypeUuid) {
1185  sif->MgrTypeUuid = *MgrTypeUuid;
1186  sif->MgrEpv = MgrEpv;
1187  } else {
1188  memset(&sif->MgrTypeUuid, 0, sizeof(UUID));
1189  sif->MgrEpv = If->DefaultManagerEpv;
1190  }
1191  sif->Flags = Flags;
1192  sif->MaxCalls = MaxCalls;
1193  sif->MaxRpcSize = MaxRpcSize;
1194  sif->IfCallbackFn = IfCallbackFn;
1195 
1199 
1200  if (sif->Flags & RPC_IF_AUTOLISTEN)
1202 
1203  return RPC_S_OK;
1204 }
1205 
1206 /***********************************************************************
1207  * RpcServerUnregisterIf (RPCRT4.@)
1208  */
1209 RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, UINT WaitForCallsToComplete )
1210 {
1211  PRPC_SERVER_INTERFACE If = IfSpec;
1212  HANDLE event = NULL;
1213  BOOL found = FALSE;
1214  BOOL completed = TRUE;
1215  RpcServerInterface *cif;
1217 
1218  TRACE("(IfSpec == (RPC_IF_HANDLE)^%p (%s), MgrTypeUuid == %s, WaitForCallsToComplete == %u)\n",
1219  IfSpec, debugstr_guid(&If->InterfaceId.SyntaxGUID), debugstr_guid(MgrTypeUuid), WaitForCallsToComplete);
1220 
1223  if (((!IfSpec && !(cif->Flags & RPC_IF_AUTOLISTEN)) ||
1224  (IfSpec && !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)))) &&
1225  UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) {
1226  list_remove(&cif->entry);
1227  TRACE("unregistering cif %p\n", cif);
1228  if (cif->CurrentCalls) {
1229  completed = FALSE;
1230  cif->Delete = TRUE;
1231  if (WaitForCallsToComplete)
1232  cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL);
1233  }
1234  found = TRUE;
1235  break;
1236  }
1237  }
1239 
1240  if (!found) {
1241  ERR("not found for object %s\n", debugstr_guid(MgrTypeUuid));
1242  return RPC_S_UNKNOWN_IF;
1243  }
1244 
1245  if (completed)
1246  HeapFree(GetProcessHeap(), 0, cif);
1247  else if (event) {
1248  /* sif will be freed when the last call is completed, so be careful not to
1249  * touch that memory here as that could happen before we get here */
1251  CloseHandle(event);
1252  }
1253 
1254  return RPC_S_OK;
1255 }
1256 
1257 /***********************************************************************
1258  * RpcServerUnregisterIfEx (RPCRT4.@)
1259  */
1260 RPC_STATUS WINAPI RpcServerUnregisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles )
1261 {
1262  FIXME("(IfSpec == (RPC_IF_HANDLE)^%p, MgrTypeUuid == %s, RundownContextHandles == %d): stub\n",
1263  IfSpec, debugstr_guid(MgrTypeUuid), RundownContextHandles);
1264 
1265  return RPC_S_OK;
1266 }
1267 
1268 /***********************************************************************
1269  * RpcObjectSetType (RPCRT4.@)
1270  *
1271  * PARAMS
1272  * ObjUuid [I] "Object" UUID
1273  * TypeUuid [I] "Type" UUID
1274  *
1275  * RETURNS
1276  * RPC_S_OK The call succeeded
1277  * RPC_S_INVALID_OBJECT The provided object (nil) is not valid
1278  * RPC_S_ALREADY_REGISTERED The provided object is already registered
1279  *
1280  * Maps "Object" UUIDs to "Type" UUIDs. Passing the nil UUID as the type
1281  * resets the mapping for the specified object UUID to nil (the default).
1282  * The nil object is always associated with the nil type and cannot be
1283  * reassigned. Servers can support multiple implementations on the same
1284  * interface by registering different end-point vectors for the different
1285  * types. There's no need to call this if a server only supports the nil
1286  * type, as is typical.
1287  */
1289 {
1290  RpcObjTypeMap *map = RpcObjTypeMaps, *prev = NULL;
1291  RPC_STATUS dummy;
1292 
1293  TRACE("(ObjUUID == %s, TypeUuid == %s).\n", debugstr_guid(ObjUuid), debugstr_guid(TypeUuid));
1294  if ((! ObjUuid) || UuidIsNil(ObjUuid, &dummy)) {
1295  /* nil uuid cannot be remapped */
1296  return RPC_S_INVALID_OBJECT;
1297  }
1298 
1299  /* find the mapping for this object if there is one ... */
1300  while (map) {
1301  if (! UuidCompare(ObjUuid, &map->Object, &dummy)) break;
1302  prev = map;
1303  map = map->next;
1304  }
1305  if ((! TypeUuid) || UuidIsNil(TypeUuid, &dummy)) {
1306  /* ... and drop it from the list */
1307  if (map) {
1308  if (prev)
1309  prev->next = map->next;
1310  else
1311  RpcObjTypeMaps = map->next;
1312  HeapFree(GetProcessHeap(), 0, map);
1313  }
1314  } else {
1315  /* ... , fail if we found it ... */
1316  if (map)
1317  return RPC_S_ALREADY_REGISTERED;
1318  /* ... otherwise create a new one and add it in. */
1319  map = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcObjTypeMap));
1320  map->Object = *ObjUuid;
1321  map->Type = *TypeUuid;
1322  map->next = NULL;
1323  if (prev)
1324  prev->next = map; /* prev is the last map in the linklist */
1325  else
1326  RpcObjTypeMaps = map;
1327  }
1328 
1329  return RPC_S_OK;
1330 }
1331 
1333 {
1334  struct list entry;
1339 };
1340 
1341 static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
1342 {
1343  SECURITY_STATUS sec_status;
1344  SecPkgInfoW *packages;
1345  ULONG package_count;
1346  ULONG i;
1347 
1348  sec_status = EnumerateSecurityPackagesW(&package_count, &packages);
1349  if (sec_status != SEC_E_OK)
1350  {
1351  ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", sec_status);
1352  return RPC_S_SEC_PKG_ERROR;
1353  }
1354 
1355  for (i = 0; i < package_count; i++)
1356  if (packages[i].wRPCID == auth_type)
1357  break;
1358 
1359  if (i == package_count)
1360  {
1361  WARN("unsupported AuthnSvc %u\n", auth_type);
1362  FreeContextBuffer(packages);
1364  }
1365 
1366  TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), auth_type);
1367  *packages_buf = packages;
1368  *ret = packages + i;
1369  return RPC_S_OK;
1370 }
1371 
1373  USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
1374 {
1376  struct rpc_server_registered_auth_info *auth_info;
1377  SECURITY_STATUS sec_status;
1378 
1381  {
1382  if (auth_info->auth_type == auth_type)
1383  {
1384  sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, auth_info->package_name,
1386  cred, exp);
1387  if (sec_status != SEC_E_OK)
1388  {
1390  break;
1391  }
1392 
1393  *max_token = auth_info->max_token;
1394  status = RPC_S_OK;
1395  break;
1396  }
1397  }
1399 
1400  return status;
1401 }
1402 
1404 {
1405  struct rpc_server_registered_auth_info *auth_info, *cursor2;
1406 
1409  {
1410  HeapFree(GetProcessHeap(), 0, auth_info->package_name);
1411  HeapFree(GetProcessHeap(), 0, auth_info->principal);
1412  HeapFree(GetProcessHeap(), 0, auth_info);
1413  }
1416 }
1417 
1418 /***********************************************************************
1419  * RpcServerRegisterAuthInfoA (RPCRT4.@)
1420  */
1422  LPVOID Arg )
1423 {
1424  WCHAR *principal_name = NULL;
1426 
1427  TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
1428 
1429  if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName)))
1430  return RPC_S_OUT_OF_RESOURCES;
1431 
1432  status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg);
1433 
1434  HeapFree(GetProcessHeap(), 0, principal_name);
1435  return status;
1436 }
1437 
1438 /***********************************************************************
1439  * RpcServerRegisterAuthInfoW (RPCRT4.@)
1440  */
1442  LPVOID Arg )
1443 {
1444  struct rpc_server_registered_auth_info *auth_info;
1445  SecPkgInfoW *packages, *package;
1447  ULONG max_token;
1449 
1450  TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
1451 
1452  status = find_security_package(AuthnSvc, &packages, &package);
1453  if (status != RPC_S_OK)
1454  return status;
1455 
1456  package_name = RPCRT4_strdupW(package->Name);
1457  max_token = package->cbMaxToken;
1458  FreeContextBuffer(packages);
1459  if (!package_name)
1460  return RPC_S_OUT_OF_RESOURCES;
1461 
1462  auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
1463  if (!auth_info) {
1465  return RPC_S_OUT_OF_RESOURCES;
1466  }
1467 
1468  if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
1470  HeapFree(GetProcessHeap(), 0, auth_info);
1471  return RPC_S_OUT_OF_RESOURCES;
1472  }
1473 
1474  auth_info->auth_type = AuthnSvc;
1475  auth_info->package_name = package_name;
1476  auth_info->max_token = max_token;
1477 
1481 
1482  return RPC_S_OK;
1483 }
1484 
1485 /******************************************************************************
1486  * RpcServerInqDefaultPrincNameA (rpcrt4.@)
1487  */
1489 {
1490  RPC_STATUS ret;
1491  RPC_WSTR principalW;
1492 
1493  TRACE("%u, %p\n", AuthnSvc, PrincName);
1494 
1495  if ((ret = RpcServerInqDefaultPrincNameW( AuthnSvc, &principalW )) == RPC_S_OK)
1496  {
1497  if (!(*PrincName = (RPC_CSTR)RPCRT4_strdupWtoA( principalW ))) return RPC_S_OUT_OF_MEMORY;
1498  RpcStringFreeW( &principalW );
1499  }
1500  return ret;
1501 }
1502 
1503 /******************************************************************************
1504  * RpcServerInqDefaultPrincNameW (rpcrt4.@)
1505  */
1507 {
1508  ULONG len = 0;
1509 
1510  FIXME("%u, %p\n", AuthnSvc, PrincName);
1511 
1512  if (AuthnSvc != RPC_C_AUTHN_WINNT) return RPC_S_UNKNOWN_AUTHN_SERVICE;
1513 
1514  GetUserNameExW( NameSamCompatible, NULL, &len );
1516 
1517  if (!(*PrincName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
1518  return RPC_S_OUT_OF_MEMORY;
1519 
1520  GetUserNameExW( NameSamCompatible, *PrincName, &len );
1521  return RPC_S_OK;
1522 }
1523 
1524 /***********************************************************************
1525  * RpcServerListen (RPCRT4.@)
1526  */
1527 RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait )
1528 {
1530 
1531  TRACE("(%u,%u,%u)\n", MinimumCallThreads, MaxCalls, DontWait);
1532 
1533  if (list_empty(&protseqs))
1535 
1537 
1538  if (DontWait || (status != RPC_S_OK)) return status;
1539 
1540  return RpcMgmtWaitServerListen();
1541 }
1542 
1543 /***********************************************************************
1544  * RpcMgmtServerWaitListen (RPCRT4.@)
1545  */
1547 {
1548  RpcServerProtseq *protseq;
1549  HANDLE event, wait_thread;
1550 
1551  TRACE("()\n");
1552 
1554  event = listen_done_event;
1556 
1557  if (!event)
1558  return RPC_S_NOT_LISTENING;
1559 
1560  TRACE( "waiting for server calls to finish\n" );
1562  TRACE( "done waiting\n" );
1563 
1565  /* wait for server threads to finish */
1566  while(1)
1567  {
1568  if (listen_count)
1569  break;
1570 
1571  wait_thread = NULL;
1574  {
1575  if ((wait_thread = protseq->server_thread))
1576  break;
1577  }
1579  if (!wait_thread)
1580  break;
1581 
1582  TRACE("waiting for thread %u\n", GetThreadId(wait_thread));
1584  WaitForSingleObject(wait_thread, INFINITE);
1586  }
1587  if (listen_done_event == event)
1588  {
1590  CloseHandle( event );
1591  }
1593  return RPC_S_OK;
1594 }
1595 
1596 /***********************************************************************
1597  * RpcMgmtStopServerListening (RPCRT4.@)
1598  */
1600 {
1601  TRACE("(Binding == (RPC_BINDING_HANDLE)^%p)\n", Binding);
1602 
1603  if (Binding) {
1604  FIXME("client-side invocation not implemented.\n");
1606  }
1607 
1608  return RPCRT4_stop_listen(FALSE);
1609 }
1610 
1611 /***********************************************************************
1612  * RpcMgmtEnableIdleCleanup (RPCRT4.@)
1613  */
1615 {
1616  FIXME("(): stub\n");
1617  return RPC_S_OK;
1618 }
1619 
1620 /***********************************************************************
1621  * I_RpcServerStartListening (RPCRT4.@)
1622  */
1624 {
1625  FIXME( "(%p): stub\n", hWnd );
1626 
1627  return RPC_S_OK;
1628 }
1629 
1630 /***********************************************************************
1631  * I_RpcServerStopListening (RPCRT4.@)
1632  */
1634 {
1635  FIXME( "(): stub\n" );
1636 
1637  return RPC_S_OK;
1638 }
1639 
1640 /***********************************************************************
1641  * I_RpcWindowProc (RPCRT4.@)
1642  */
1644 {
1645  FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
1646 
1647  return 0;
1648 }
1649 
1650 /***********************************************************************
1651  * RpcMgmtInqIfIds (RPCRT4.@)
1652  */
1654 {
1655  FIXME("(%p,%p): stub\n", Binding, IfIdVector);
1656  return RPC_S_INVALID_BINDING;
1657 }
1658 
1659 /***********************************************************************
1660  * RpcMgmtInqStats (RPCRT4.@)
1661  */
1663 {
1664  RPC_STATS_VECTOR *stats;
1665 
1666  FIXME("(%p,%p)\n", Binding, Statistics);
1667 
1668  if ((stats = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_STATS_VECTOR))))
1669  {
1670  stats->Count = 1;
1671  stats->Stats[0] = 0;
1672  *Statistics = stats;
1673  return RPC_S_OK;
1674  }
1675  return RPC_S_OUT_OF_RESOURCES;
1676 }
1677 
1678 /***********************************************************************
1679  * RpcMgmtStatsVectorFree (RPCRT4.@)
1680  */
1682 {
1683  FIXME("(%p)\n", StatsVector);
1684 
1685  if (StatsVector)
1686  {
1687  HeapFree(GetProcessHeap(), 0, *StatsVector);
1688  *StatsVector = NULL;
1689  }
1690  return RPC_S_OK;
1691 }
1692 
1693 /***********************************************************************
1694  * RpcMgmtEpEltInqBegin (RPCRT4.@)
1695  */
1697  RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
1698 {
1699  FIXME("(%p,%u,%p,%u,%p,%p): stub\n",
1700  Binding, InquiryType, IfId, VersOption, ObjectUuid, InquiryContext);
1701  return RPC_S_INVALID_BINDING;
1702 }
1703 
1704 /***********************************************************************
1705  * RpcMgmtIsServerListening (RPCRT4.@)
1706  */
1708 {
1710 
1711  TRACE("(%p)\n", Binding);
1712 
1713  if (Binding) {
1714  RpcBinding *rpc_binding = (RpcBinding*)Binding;
1715  status = RPCRT4_IsServerListening(rpc_binding->Protseq, rpc_binding->Endpoint);
1716  }else {
1720  }
1721 
1722  return status;
1723 }
1724 
1725 /***********************************************************************
1726  * RpcMgmtSetAuthorizationFn (RPCRT4.@)
1727  */
1729 {
1730  FIXME("(%p): stub\n", fn);
1731  return RPC_S_OK;
1732 }
1733 
1734 /***********************************************************************
1735  * RpcMgmtSetServerStackSize (RPCRT4.@)
1736  */
1738 {
1739  FIXME("(0x%x): stub\n", ThreadStackSize);
1740  return RPC_S_OK;
1741 }
1742 
1743 /***********************************************************************
1744  * I_RpcGetCurrentCallHandle (RPCRT4.@)
1745  */
1747 {
1748  TRACE("\n");
1750 }
static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
Definition: rpc_server.c:994
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
void const * InterpreterInfo
Definition: rpcdcep.h:110
#define RPC_S_UNKNOWN_IF
Definition: winerror.h:1028
GLenum func
Definition: glext.h:6028
RPC_STATUS RPC_ENTRY RPC_IF_CALLBACK_FN(RPC_IF_HANDLE InterfaceUuid, void *Context)
Definition: rpcdce.h:211
WINE_DEFAULT_DEBUG_CHANNEL(rpc)
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
HANDLE server_ready_event
Definition: rpc_server.h:45
RPC_STATUS WINAPI RpcServerUseProtseqEpExA(RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
Definition: rpc_server.c:1020
#define RESULT_PROVIDER_REJECTION
Definition: rpc_defs.h:213
RpcPktHdr * RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor, unsigned short RejectReason)
Definition: rpc_message.c:231
#define REASON_NONE
Definition: rpc_defs.h:215
static struct list protseqs
Definition: rpc_server.c:71
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
static RpcServerInterface * RPCRT4_find_interface(UUID *object, const RPC_SYNTAX_IDENTIFIER *if_id, const RPC_SYNTAX_IDENTIFIER *transfer_syntax, BOOL check_object)
Definition: rpc_server.c:133
RPC_STATUS WINAPI I_RpcServerStopListening(void)
Definition: rpc_server.c:1633
char hdr[14]
Definition: iptest.cpp:33
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
PRPC_DISPATCH_TABLE DispatchTable
Definition: rpcdcep.h:106
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1599
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1043
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
RpcServerProtseq *(* alloc)(void)
Definition: rpc_server.h:51
unsigned int Count
Definition: rpcdce.h:84
LPSTR Protseq
Definition: rpc_binding.h:130
#define NCA_S_UNK_IF
Definition: ncastatus.h:25
#define DWORD_PTR
Definition: treelist.c:76
SECURITY_STATUS WINAPI AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:105
#define error(str)
Definition: mkdosfs.c:1605
UCHAR packet[_PAGE_SIZE]
Definition: serial.c:53
RPC_STATUS WINAPI RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR **IfIdVector)
Definition: rpc_server.c:1653
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
unsigned short MajorVersion
Definition: rpcdcep.h:27
unsigned char * auth_data
Definition: rpc_server.c:56
WCHAR SEC_WCHAR
Definition: sspi.h:29
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
struct list listeners
Definition: rpc_server.h:36
#define MAKEWORD(a, b)
Definition: typedefs.h:247
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq *ps, const char *endpoint)
Definition: rpc_server.c:839
struct _RpcPacket RpcPacket
#define RESULT_ACCEPT
Definition: rpc_defs.h:211
_In_ USHORT _In_ ULONG _In_ PSOCKADDR _In_ PSOCKADDR _Reserved_ ULONG _In_opt_ PVOID _In_opt_ const WSK_CLIENT_CONNECTION_DISPATCH _In_opt_ PEPROCESS _In_opt_ PETHREAD _In_opt_ PSECURITY_DESCRIPTOR SecurityDescriptor
Definition: wsk.h:182
static void RPCRT4_process_packet(RpcConnection *conn, RpcPktHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
Definition: rpc_server.c:503
#define exception
Definition: math.h:26
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define REJECT_LOCAL_LIMIT_EXCEEDED
Definition: rpc_defs.h:222
static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint)
Definition: rpc_server.c:824
void(__RPC_STUB * RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message)
Definition: rpcdcep.h:82
#define RPC_S_NO_BINDINGS
Definition: winerror.h:1029
#define RPC_S_NO_PROTSEQS_REGISTERED
Definition: winerror.h:1025
#define WARN(fmt,...)
Definition: debug.h:111
#define RPC_S_WRONG_KIND_OF_BINDING
Definition: winerror.h:1012
#define NCA_S_OP_RNG_ERROR
Definition: ncastatus.h:24
static CRITICAL_SECTION server_auth_info_cs
Definition: rpc_server.c:93
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN fn)
Definition: rpc_server.c:1728
ULONG auth_length
Definition: rpc_server.c:57
#define CALLBACK
Definition: compat.h:27
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
HWND hWnd
Definition: settings.c:17
RPC_STATUS WINAPI I_RpcServerStartListening(HWND hWnd)
Definition: rpc_server.c:1623
ULONG NICFlags
Definition: rpcdce.h:218
void RPCRT4_new_client(RpcConnection *conn)
Definition: rpc_server.c:628
RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
Definition: rpc_server.c:1084
static RPC_STATUS RPCRT4_start_listen_protseq(RpcServerProtseq *ps, BOOL auto_listen)
Definition: rpc_server.c:730
#define assert(x)
Definition: debug.h:53
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define REJECT_UNKNOWN_AUTHN_SERVICE
Definition: rpc_defs.h:228
#define RPC_IF_OLE
Definition: rpcdce.h:314
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:912
struct list entry
Definition: rpc_server.h:32
SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, PSecPkgInfoW *ppPackageInfo)
Definition: sspi.c:709
int(__RPC_API * RPC_MGMT_AUTHORIZATION_FN)(RPC_BINDING_HANDLE, ULONG, RPC_STATUS *)
Definition: rpcdce.h:412
int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:253
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RpcPktHdr * RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status)
Definition: rpc_message.c:170
char * LPSTR
Definition: xmlstorage.h:182
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
unsigned int Length
Definition: rpcdce.h:216
RPC_STATUS WINAPI RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
Definition: rpc_server.c:1209
WPARAM wParam
Definition: combotst.c:138
static CRITICAL_SECTION server_cs
Definition: rpc_server.c:75
RPC_STATUS WINAPI RpcMgmtSetServerStackSize(ULONG ThreadStackSize)
Definition: rpc_server.c:1737
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:59
static UUID * LookupObjType(UUID *ObjUuid)
Definition: rpc_server.c:124
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
RPC_STATUS WINAPI RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
Definition: rpc_server.c:1441
#define REJECT_TEMPORARY_CONGESTION
Definition: rpc_defs.h:221
int WINAPI UuidCompare(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:210
RPC_DISPATCH_FUNCTION * DispatchTable
Definition: rpcdcep.h:88
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:1132
RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
Definition: rpc_server.c:1067
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
Definition: rpc_server.c:536
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
RPC_MESSAGE * msg
Definition: rpc_server.c:55
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:269
RpcConnection * RPCRT4_GrabConnection(RpcConnection *conn) DECLSPEC_HIDDEN
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
void RPCRT4_destroy_all_protseqs(void)
Definition: rpc_server.c:1101
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
#define ERROR_NOACCESS
Definition: winerror.h:578
#define RPC_S_INVALID_OBJECT
Definition: winerror.h:1142
const struct protseq_ops * rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN
HANDLE CallsCompletedEvent
Definition: rpc_server.h:76
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:105
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
RPC_STATUS WINAPI RpcServerUseProtseqEpExW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
Definition: rpc_server.c:1040
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct _RpcConnection * conn
Definition: rpc_server.c:53
static void rpcrt4_conn_close_read(RpcConnection *connection)
Definition: rpc_binding.h:205
ULONG cbMaxToken
Definition: sspi.h:104
const struct protseq_ops * ops
Definition: rpc_server.h:31
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1527
#define debugstr_w
Definition: kernel32.h:32
#define REJECT_REASON_NOT_SPECIFIED
Definition: rpc_defs.h:220
static CRITICAL_SECTION_DEBUG server_cs_debug
Definition: rpc_server.c:76
#define FIXME(fmt,...)
Definition: debug.h:110
unsigned char num_syntaxes
Definition: rpc_defs.h:69
RPC_STATUS WINAPI RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, int RundownContextHandles)
Definition: rpc_server.c:1260
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
RPC_MGR_EPV * DefaultManagerEpv
Definition: rpcdcep.h:109
#define SECPKG_CRED_INBOUND
Definition: sspi.h:276
#define RPC_S_SEC_PKG_ERROR
Definition: winerror.h:1132
SEC_WCHAR * Name
Definition: sspi.h:105
RPC_IF_CALLBACK_FN * IfCallbackFn
Definition: rpc_server.h:72
#define MAKELONG(a, b)
Definition: typedefs.h:248
unsigned int DispatchTableCount
Definition: rpcdcep.h:87
#define RPC_VER_MAJOR
Definition: rpc_defs.h:176
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
smooth NULL
Definition: ftsmooth.c:416
struct list connections
Definition: rpc_server.h:37
UINT WINAPI I_RpcWindowProc(void *hWnd, UINT Message, UINT wParam, ULONG lParam)
Definition: rpc_server.c:1643
static CRITICAL_SECTION_DEBUG listen_cs_debug
Definition: rpc_server.c:85
switch(r->id)
Definition: btrfs.c:2932
#define __TRY
Definition: compat.h:70
LPSTR Endpoint
Definition: rpc_binding.h:132
#define debugstr_guid
Definition: kernel32.h:35
LONG SECURITY_STATUS
Definition: sspi.h:34
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1026
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 GLint GLint j
Definition: glfuncs.h:250
static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *hdr, RPC_MESSAGE *msg)
Definition: rpc_server.c:365
static struct list server_registered_auth_info
Definition: rpc_server.c:73
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
Definition: dhcpd.h:135
#define GetExceptionCode()
Definition: exception.h:65
RPC_SYNTAX_IDENTIFIER TransferSyntax
Definition: rpcdcep.h:105
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
void(__RPC_USER * RPC_AUTH_KEY_RETRIEVAL_FN)(void *, RPC_WSTR, ULONG, void **, RPC_STATUS *)
Definition: rpcdce.h:212
CRITICAL_SECTION cs
Definition: rpc_server.h:38
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1076
#define TRACE(s)
Definition: solgame.cpp:4
void rpcrt4_conn_release_and_wait(RpcConnection *connection) DECLSPEC_HIDDEN
RPC_STATUS WINAPI RpcMgmtEnableIdleCleanup(void)
Definition: rpc_server.c:1614
RPC_STATUS WINAPI RpcServerInqBindings(RPC_BINDING_VECTOR **BindingVector)
Definition: rpc_server.c:868
#define GetProcessHeap()
Definition: compat.h:395
static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
Definition: rpc_server.c:644
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status)
Definition: rpc_message.c:408
#define LIST_INIT(head)
Definition: queue.h:197
__wchar_t WCHAR
Definition: xmlstorage.h:180
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
RpcPktHdr * RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR ServerAddress, unsigned char ResultCount, const RpcResult *Results)
Definition: rpc_message.c:253
#define debugstr_a
Definition: kernel32.h:31
RPC_MGR_EPV * MgrEpv
Definition: rpc_server.h:68
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:1017
RPC_STATUS WINAPI RpcServerUseProtseqEpA(RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:917
#define RPC_MIN_PACKET_SIZE
Definition: rpc_defs.h:183
#define REJECT_INVALID_CHECKSUM
Definition: rpc_defs.h:229
static CRITICAL_SECTION_DEBUG server_auth_info_cs_debug
Definition: rpc_server.c:94
RPC_STATUS WINAPI RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
Definition: rpc_server.c:1662
struct list entry
Definition: rpc_server.h:65
LONG_PTR Reserved
Definition: rpcdcep.h:89
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RPC_FLG_OBJECT_UUID
Definition: rpc_defs.h:181
LPSTR NetworkAddr
Definition: rpc_binding.h:67
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1123
struct _RpcObjTypeMap RpcObjTypeMap
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out)
Definition: rpc_message.c:1376
static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
Definition: rpc_server.c:786
static void RPCRT4_sync_with_server_thread(RpcServerProtseq *ps)
Definition: rpc_server.c:715
Definition: _map.h:44
struct _test_info results[8]
Definition: SetCursorPos.c:29
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
HANDLE server_thread
Definition: rpc_server.h:41
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:70
CHAR Message[80]
Definition: alive.c:5
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618
static HANDLE thread
Definition: service.c:33
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1064
static RpcPktHdr * handle_bind_error(RpcConnection *conn, RPC_STATUS error)
Definition: rpc_server.c:174
#define __ENDTRY
Definition: compat.h:72
int ret
RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection *conn, BOOL start, RpcAuthVerifier *auth_data_in, ULONG auth_length_in, unsigned char **auth_data_out, ULONG *auth_length_out)
Definition: rpc_message.c:1025
#define InterlockedDecrement
Definition: armddk.h:52
static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
Definition: rpc_server.c:340
struct _RpcObjTypeMap * next
Definition: rpc_server.c:63
unsigned short MinorVersion
Definition: rpcdcep.h:28
#define RPC_S_UNKNOWN_AUTHN_SERVICE
Definition: winerror.h:1055
static LONG listen_count
Definition: rpc_server.c:105
uint32_t entry
Definition: isohybrid.c:63
RPC_STATUS RPCRT4_MakeBinding(RpcBinding **Binding, RpcConnection *Connection)
Definition: rpc_binding.c:233
RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength, const void *Auth, unsigned int AuthLength)
Definition: rpc_message.c:761
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
static void RPCRT4_release_server_interface(RpcServerInterface *sif)
Definition: rpc_server.c:162
#define err(...)
static CRITICAL_SECTION listen_cs
Definition: rpc_server.c:84
struct _cl_event * event
Definition: glext.h:7739
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define SEC_E_OK
Definition: winerror.h:2356
RPC_SERVER_INTERFACE * If
Definition: rpc_server.h:66
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle(void)
Definition: rpc_server.c:1746
struct _RpcBinding * server_binding
Definition: rpc_binding.h:96
static RPC_STATUS process_auth3_packet(RpcConnection *conn, RpcPktCommonHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
Definition: rpc_server.c:478
#define RPC_S_ALREADY_LISTENING
Definition: winerror.h:1024
static HANDLE listen_done_event
Definition: rpc_server.c:107
#define RPC_S_SERVER_TOO_BUSY
Definition: winerror.h:1034
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:934
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
Definition: rpc_server.c:1372
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
Definition: rpc_assoc.c:564
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
#define S_OK
Definition: intsafe.h:59
Definition: nis.h:10
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
RPC_SYNTAX_IDENTIFIER transfer_syntaxes[ANYSIZE_ARRAY]
Definition: rpc_defs.h:72
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:225
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
#define InterlockedIncrement
Definition: armddk.h:53
static RpcObjTypeMap * LookupObjTypeMap(UUID *ObjUuid)
Definition: rpc_server.c:111
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
unsigned short USHORT
Definition: pedump.c:61
unsigned char dummy
Definition: maze.c:118
#define RPC_ENTRY
Definition: rpc.h:67
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength)
Definition: rpc_message.c:1223
void RPCRT4_ServerFreeAllRegisteredAuthInfo(void)
Definition: rpc_server.c:1403
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
unsigned int UINT
Definition: ndis.h:50
DWORD exp
Definition: msg.c:15681
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
ULONG EndpointFlags
Definition: rpcdce.h:217
RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1707
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *PrincName)
Definition: rpc_server.c:1506
ULONG Stats[1]
Definition: rpcdce.h:85
BOOLEAN WINAPI GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:1079
#define msg(x)
Definition: auth_time.c:54
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:138
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED
Definition: rpc_defs.h:216
#define RPC_MGR_EPV
Definition: rpcdce.h:53
GLuint res
Definition: glext.h:9613
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED
Definition: rpc_defs.h:217
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
RPC_STATUS WINAPI RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
Definition: rpc_server.c:1681
static BOOL std_listen
Definition: rpc_server.c:103
static struct list server_interfaces
Definition: rpc_server.c:72
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
unsigned int ULONG
Definition: retypes.h:1
RPC_STATUS WINAPI RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE Binding, ULONG InquiryType, RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE *InquiryContext)
Definition: rpc_server.c:1696
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
RPC_STATUS WINAPI RpcMgmtWaitServerListen(void)
Definition: rpc_server.c:1546
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:965
RPC_SYNTAX_IDENTIFIER abstract_syntax
Definition: rpc_defs.h:71
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50
static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
Definition: rpc_server.c:748
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void exit(int exitcode)
Definition: _exit.c:33
#define LIST_ENTRY(type)
Definition: queue.h:175
static RPC_STATUS process_bind_packet_no_send(RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length, RpcPktHdr **ack_response, unsigned char **auth_data_out, ULONG *auth_length_out)
Definition: rpc_server.c:207
RPC_STATUS WINAPI RpcServerRegisterIf3(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN *IfCallbackFn, void *SecurityDescriptor)
Definition: rpc_server.c:1151
RPC_STATUS WINAPI RpcObjectSetType(UUID *ObjUuid, UUID *TypeUuid)
Definition: rpc_server.c:1288
#define INFINITE
Definition: serial.h:102
#define memset(x, y, z)
Definition: compat.h:39
static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
Definition: rpc_server.c:953
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
Definition: rpc_server.c:546
static SERVICE_STATUS status
Definition: service.c:31
static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
Definition: rpc_server.c:1341
static void destroy_serverprotoseq(RpcServerProtseq *ps)
Definition: rpc_server.c:982
RPC_STATUS WINAPI RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
Definition: rpc_server.c:1421
RpcBinding * RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:973
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED
Definition: rpc_defs.h:224
LPARAM lParam
Definition: combotst.c:139
#define HeapFree(x, y, z)
Definition: compat.h:394
RpcPktHdr * RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength)
Definition: rpc_message.c:154
RPC_STATUS WINAPI RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN *IfCallbackFn)
Definition: rpc_server.c:1142
#define RPC_VER_MINOR
Definition: rpc_defs.h:177
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA(ULONG AuthnSvc, RPC_CSTR *PrincName)
Definition: rpc_server.c:1488
#define RPC_S_ALREADY_REGISTERED
Definition: winerror.h:1022
#define RPC_S_OK
Definition: rpcnterr.h:22
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852
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 GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262
RPC_SYNTAX_IDENTIFIER ActiveInterface
Definition: rpc_binding.h:92
static RpcObjTypeMap * RpcObjTypeMaps
Definition: rpc_server.c:68
unsigned int RpcProtseqEndpointCount
Definition: rpcdcep.h:107
#define __EXCEPT_ALL
Definition: exception.h:60
static UUID uuid_nil
Definition: rpc_server.c:109
Definition: ps.c:97
RpcPktHdr * hdr
Definition: rpc_server.c:54