ReactOS  0.4.14-dev-593-g1793dcc
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 <stdarg.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <assert.h>
27 
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winerror.h"
31 
32 #include "rpc.h"
33 #include "rpcndr.h"
34 #include "excpt.h"
35 
36 #include "wine/debug.h"
37 #include "wine/exception.h"
38 
39 #include "rpc_server.h"
40 #include "rpc_assoc.h"
41 #include "rpc_message.h"
42 #include "rpc_defs.h"
43 #include "ncastatus.h"
44 #include "secext.h"
45 
47 
48 typedef struct _RpcPacket
49 {
53  unsigned char *auth_data;
55 } RpcPacket;
56 
57 typedef struct _RpcObjTypeMap
58 {
59  /* FIXME: a hash table would be better. */
64 
66 
67 /* list of type RpcServerProtseq */
68 static struct list protseqs = LIST_INIT(protseqs);
71 
74 {
75  0, 0, &server_cs,
77  0, 0, { (DWORD_PTR)(__FILE__ ": server_cs") }
78 };
79 static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 };
80 
83 {
84  0, 0, &listen_cs,
86  0, 0, { (DWORD_PTR)(__FILE__ ": listen_cs") }
87 };
88 static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 };
89 
92 {
93  0, 0, &server_auth_info_cs,
95  0, 0, { (DWORD_PTR)(__FILE__ ": server_auth_info_cs") }
96 };
98 
99 /* whether the server is currently listening */
101 /* total listeners including auto listeners */
103 /* event set once all manual listening is finished */
105 
106 static UUID uuid_nil;
107 
108 static inline RpcObjTypeMap *LookupObjTypeMap(UUID *ObjUuid)
109 {
112 
113  while (rslt) {
114  if (! UuidCompare(ObjUuid, &rslt->Object, &dummy)) break;
115  rslt = rslt->next;
116  }
117 
118  return rslt;
119 }
120 
121 static inline UUID *LookupObjType(UUID *ObjUuid)
122 {
123  RpcObjTypeMap *map = LookupObjTypeMap(ObjUuid);
124  if (map)
125  return &map->Type;
126  else
127  return &uuid_nil;
128 }
129 
131  const RPC_SYNTAX_IDENTIFIER *if_id,
132  const RPC_SYNTAX_IDENTIFIER *transfer_syntax,
133  BOOL check_object)
134 {
135  UUID* MgrType = NULL;
136  RpcServerInterface* cif;
138 
139  if (check_object)
140  MgrType = LookupObjType(object);
143  if (!memcmp(if_id, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)) &&
144  (!transfer_syntax || !memcmp(transfer_syntax, &cif->If->TransferSyntax, sizeof(RPC_SYNTAX_IDENTIFIER))) &&
145  (check_object == FALSE || UuidEqual(MgrType, &cif->MgrTypeUuid, &status)) &&
146  std_listen) {
148  break;
149  }
150  }
152  if (&cif->entry == &server_interfaces) cif = NULL;
153  TRACE("returning %p for object %s, if_id { %d.%d %s }\n", cif,
154  debugstr_guid(object), if_id->SyntaxVersion.MajorVersion,
156  return cif;
157 }
158 
160 {
161  if (!InterlockedDecrement(&sif->CurrentCalls) &&
162  sif->Delete) {
163  /* sif must have been removed from server_interfaces before
164  * CallsCompletedEvent is set */
165  if (sif->CallsCompletedEvent)
167  HeapFree(GetProcessHeap(), 0, sif);
168  }
169 }
170 
172 {
173  unsigned int reject_reason;
174  switch (error)
175  {
177  reject_reason = REJECT_TEMPORARY_CONGESTION;
178  break;
179  case ERROR_OUTOFMEMORY:
181  reject_reason = REJECT_LOCAL_LIMIT_EXCEEDED;
182  break;
185  break;
187  reject_reason = REJECT_UNKNOWN_AUTHN_SERVICE;
188  break;
189  case ERROR_ACCESS_DENIED:
190  reject_reason = REJECT_INVALID_CHECKSUM;
191  break;
192  default:
193  FIXME("unexpected status value %d\n", error);
194  /* fall through */
195  case RPC_S_INVALID_BOUND:
196  reject_reason = REJECT_REASON_NOT_SPECIFIED;
197  break;
198  }
201  reject_reason);
202 }
203 
206  unsigned char *auth_data, ULONG auth_length, RpcPktHdr **ack_response,
207  unsigned char **auth_data_out, ULONG *auth_length_out)
208 {
210  RpcContextElement *ctxt_elem;
211  unsigned int i;
213 
214  /* validate data */
215  for (i = 0, ctxt_elem = msg->Buffer;
216  i < hdr->num_elements;
217  i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes])
218  {
219  if (((char *)ctxt_elem - (char *)msg->Buffer) > msg->BufferLength ||
220  ((char *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes] - (char *)msg->Buffer) > msg->BufferLength)
221  {
222  ERR("inconsistent data in packet - packet length %d, num elements %d\n",
223  msg->BufferLength, hdr->num_elements);
224  return RPC_S_INVALID_BOUND;
225  }
226  }
227 
228  if (hdr->max_tsize < RPC_MIN_PACKET_SIZE ||
230  conn->server_binding)
231  {
232  TRACE("packet size less than min size, or active interface syntax guid non-null\n");
233 
234  return RPC_S_INVALID_BOUND;
235  }
236 
238  hdr->num_elements * sizeof(*results));
239  if (!results)
240  return RPC_S_OUT_OF_RESOURCES;
241 
242  for (i = 0, ctxt_elem = (RpcContextElement *)msg->Buffer;
243  i < hdr->num_elements;
244  i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes])
245  {
246  RpcServerInterface* sif = NULL;
247  unsigned int j;
248 
249  for (j = 0; !sif && j < ctxt_elem->num_syntaxes; j++)
250  {
251  sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax,
252  &ctxt_elem->transfer_syntaxes[j], FALSE);
253  if (sif)
254  break;
255  }
256  if (sif)
257  {
259  TRACE("accepting bind request on connection %p for %s\n", conn,
261  results[i].result = RESULT_ACCEPT;
262  results[i].reason = REASON_NONE;
263  results[i].transfer_syntax = ctxt_elem->transfer_syntaxes[j];
264 
265  /* save the interface for later use */
266  /* FIXME: save linked list */
267  conn->ActiveInterface = ctxt_elem->abstract_syntax;
268  }
269  else if ((sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax,
270  NULL, FALSE)) != NULL)
271  {
273  TRACE("not accepting bind request on connection %p for %s - no transfer syntaxes supported\n",
274  conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID));
277  memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax));
278  }
279  else
280  {
281  TRACE("not accepting bind request on connection %p for %s - abstract syntax not supported\n",
282  conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID));
285  memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax));
286  }
287  }
288 
289  /* create temporary binding */
290  status = RPCRT4_MakeBinding(&conn->server_binding, conn);
291  if (status != RPC_S_OK)
292  {
294  return status;
295  }
296 
298  conn->NetworkAddr, conn->Endpoint,
299  conn->NetworkOptions,
300  hdr->assoc_gid,
301  &conn->server_binding->Assoc);
302  if (status != RPC_S_OK)
303  {
305  return status;
306  }
307 
308  if (auth_length)
309  {
311  (RpcAuthVerifier *)auth_data,
312  auth_length, auth_data_out,
313  auth_length_out);
314  if (status != RPC_S_OK)
315  {
317  return status;
318  }
319  }
320 
324  conn->server_binding->Assoc->assoc_group_id,
325  conn->Endpoint, hdr->num_elements,
326  results);
328 
329  if (*ack_response)
330  conn->MaxTransmissionSize = hdr->max_tsize;
331  else
333 
334  return status;
335 }
336 
338  RPC_MESSAGE *msg,
339  unsigned char *auth_data,
340  ULONG auth_length)
341 {
343  RpcPktHdr *response = NULL;
344  unsigned char *auth_data_out = NULL;
345  ULONG auth_length_out = 0;
346 
347  status = process_bind_packet_no_send(conn, hdr, msg, auth_data, auth_length,
348  &response, &auth_data_out,
349  &auth_length_out);
350  if (status != RPC_S_OK)
351  response = handle_bind_error(conn, status);
352  if (response)
353  status = RPCRT4_SendWithAuth(conn, response, NULL, 0, auth_data_out, auth_length_out);
354  else
356  RPCRT4_FreeHeader(response);
357 
358  return status;
359 }
360 
361 
363 {
365  RpcPktHdr *response = NULL;
366  RpcServerInterface* sif;
368  BOOL exception;
369  UUID *object_uuid;
370  NDR_SCONTEXT context_handle;
371  void *buf = msg->Buffer;
372 
373  /* fail if the connection isn't bound with an interface */
374  if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status)) {
375  /* FIXME: should send BindNack instead */
377  status);
378 
379  RPCRT4_Send(conn, response, NULL, 0);
380  RPCRT4_FreeHeader(response);
381  return RPC_S_OK;
382  }
383 
384  if (hdr->common.flags & RPC_FLG_OBJECT_UUID) {
385  object_uuid = (UUID*)(hdr + 1);
386  } else {
387  object_uuid = NULL;
388  }
389 
390  sif = RPCRT4_find_interface(object_uuid, &conn->ActiveInterface, NULL, TRUE);
391  if (!sif) {
392  WARN("interface %s no longer registered, returning fault packet\n", debugstr_guid(&conn->ActiveInterface.SyntaxGUID));
394  NCA_S_UNK_IF);
395 
396  RPCRT4_Send(conn, response, NULL, 0);
397  RPCRT4_FreeHeader(response);
398  return RPC_S_OK;
399  }
400  msg->RpcInterfaceInformation = sif->If;
401  /* copy the endpoint vector from sif to msg so that midl-generated code will use it */
402  msg->ManagerEpv = sif->MgrEpv;
403  if (object_uuid != NULL) {
404  RPCRT4_SetBindingObject(msg->Handle, object_uuid);
405  }
406 
407  /* find dispatch function */
408  msg->ProcNum = hdr->opnum;
409  if (sif->Flags & RPC_IF_OLE) {
410  /* native ole32 always gives us a dispatch table with a single entry
411  * (I assume that's a wrapper for IRpcStubBuffer::Invoke) */
413  } else {
414  if (msg->ProcNum >= sif->If->DispatchTable->DispatchTableCount) {
415  WARN("invalid procnum (%d/%d)\n", msg->ProcNum, sif->If->DispatchTable->DispatchTableCount);
418 
419  RPCRT4_Send(conn, response, NULL, 0);
420  RPCRT4_FreeHeader(response);
421  }
422  func = sif->If->DispatchTable->DispatchTable[msg->ProcNum];
423  }
424 
425  /* put in the drep. FIXME: is this more universally applicable?
426  perhaps we should move this outward... */
427  msg->DataRepresentation =
428  MAKELONG( MAKEWORD(hdr->common.drep[0], hdr->common.drep[1]),
429  MAKEWORD(hdr->common.drep[2], hdr->common.drep[3]));
430 
431  exception = FALSE;
432 
433  /* dispatch */
435  __TRY {
436  if (func) func(msg);
437  } __EXCEPT_ALL {
438  WARN("exception caught with code 0x%08x = %d\n", GetExceptionCode(), GetExceptionCode());
439  exception = TRUE;
442  else
444  response = RPCRT4_BuildFaultHeader(msg->DataRepresentation,
446  } __ENDTRY
448 
449  /* release any unmarshalled context handles */
450  while ((context_handle = RPCRT4_PopThreadContextHandle()) != NULL)
451  RpcServerAssoc_ReleaseContextHandle(conn->server_binding->Assoc, context_handle, TRUE);
452 
453  if (!exception)
454  response = RPCRT4_BuildResponseHeader(msg->DataRepresentation,
455  msg->BufferLength);
456 
457  /* send response packet */
458  if (response) {
459  status = RPCRT4_Send(conn, response, exception ? NULL : msg->Buffer,
460  exception ? 0 : msg->BufferLength);
461  RPCRT4_FreeHeader(response);
462  } else
463  ERR("out of memory\n");
464 
465  msg->RpcInterfaceInformation = NULL;
467 
468  if (msg->Buffer == buf) buf = NULL;
469  TRACE("freeing Buffer=%p\n", buf);
470  I_RpcFree(buf);
471 
472  return status;
473 }
474 
477  RPC_MESSAGE *msg,
478  unsigned char *auth_data,
479  ULONG auth_length)
480 {
482 
483  if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status) ||
484  !auth_length || msg->BufferLength != 0)
486  else
487  {
489  (RpcAuthVerifier *)auth_data,
490  auth_length, NULL, NULL);
491  }
492 
493  /* FIXME: client doesn't expect a response to this message so must store
494  * status in connection so that fault packet can be returned when next
495  * packet is received */
496 
497  return RPC_S_OK;
498 }
499 
501  RPC_MESSAGE* msg, unsigned char *auth_data,
502  ULONG auth_length)
503 {
504  msg->Handle = (RPC_BINDING_HANDLE)conn->server_binding;
505 
506  switch (hdr->common.ptype) {
507  case PKT_BIND:
508  TRACE("got bind packet\n");
509  process_bind_packet(conn, &hdr->bind, msg, auth_data, auth_length);
510  break;
511 
512  case PKT_REQUEST:
513  TRACE("got request packet\n");
514  process_request_packet(conn, &hdr->request, msg);
515  break;
516 
517  case PKT_AUTH3:
518  TRACE("got auth3 packet\n");
519  process_auth3_packet(conn, &hdr->common, msg, auth_data, auth_length);
520  break;
521  default:
522  FIXME("unhandled packet type %u\n", hdr->common.ptype);
523  break;
524  }
525 
526  /* clean up */
527  I_RpcFree(msg->Buffer);
529  HeapFree(GetProcessHeap(), 0, msg);
530  HeapFree(GetProcessHeap(), 0, auth_data);
531 }
532 
534 {
535  RpcPacket *pkt = the_arg;
536  RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg, pkt->auth_data,
537  pkt->auth_length);
539  HeapFree(GetProcessHeap(), 0, pkt);
540  return 0;
541 }
542 
544 {
545  RpcConnection* conn = the_arg;
546  RpcPktHdr *hdr;
547  RPC_MESSAGE *msg;
549  RpcPacket *packet;
550  unsigned char *auth_data;
551  ULONG auth_length;
552 
553  TRACE("(%p)\n", conn);
554 
555  for (;;) {
557  if (!msg) break;
558 
559  status = RPCRT4_ReceiveWithAuth(conn, &hdr, msg, &auth_data, &auth_length);
560  if (status != RPC_S_OK) {
561  WARN("receive failed with error %x\n", status);
562  HeapFree(GetProcessHeap(), 0, msg);
563  break;
564  }
565 
566  switch (hdr->common.ptype) {
567  case PKT_BIND:
568  TRACE("got bind packet\n");
569 
570  status = process_bind_packet(conn, &hdr->bind, msg, auth_data,
571  auth_length);
572  break;
573 
574  case PKT_REQUEST:
575  TRACE("got request packet\n");
576 
577  packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket));
578  if (!packet) {
579  I_RpcFree(msg->Buffer);
581  HeapFree(GetProcessHeap(), 0, msg);
582  HeapFree(GetProcessHeap(), 0, auth_data);
583  goto exit;
584  }
585  packet->conn = RPCRT4_GrabConnection( conn );
586  packet->hdr = hdr;
587  packet->msg = msg;
588  packet->auth_data = auth_data;
589  packet->auth_length = auth_length;
591  ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError());
594  } else {
595  continue;
596  }
597  break;
598 
599  case PKT_AUTH3:
600  TRACE("got auth3 packet\n");
601 
602  status = process_auth3_packet(conn, &hdr->common, msg, auth_data,
603  auth_length);
604  break;
605  default:
606  FIXME("unhandled packet type %u\n", hdr->common.ptype);
607  break;
608  }
609 
610  I_RpcFree(msg->Buffer);
612  HeapFree(GetProcessHeap(), 0, msg);
613  HeapFree(GetProcessHeap(), 0, auth_data);
614 
615  if (status != RPC_S_OK) {
616  WARN("processing packet failed with error %u\n", status);
617  break;
618  }
619  }
620 exit:
622  return 0;
623 }
624 
626 {
628  if (!thread) {
629  DWORD err = GetLastError();
630  ERR("failed to create thread, error=%08x\n", err);
632  }
633  /* we could set conn->thread, but then we'd have to make the io_thread wait
634  * for that, otherwise the thread might finish, destroy the connection, and
635  * free the memory we'd write to before we did, causing crashes and stuff -
636  * so let's implement that later, when we really need conn->thread */
637 
638  CloseHandle( thread );
639 }
640 
642 {
643  int res;
644  unsigned int count;
645  void *objs = NULL;
646  RpcServerProtseq* cps = the_arg;
647  RpcConnection* conn;
648  BOOL set_ready_event = FALSE;
649 
650  TRACE("(the_arg == ^%p)\n", the_arg);
651 
652  for (;;) {
653  objs = cps->ops->get_wait_array(cps, objs, &count);
654 
655  if (set_ready_event)
656  {
657  /* signal to function that changed state that we are now sync'ed */
659  set_ready_event = FALSE;
660  }
661 
662  /* start waiting */
663  res = cps->ops->wait_for_new_connection(cps, count, objs);
664 
665  if (res == -1 || (res == 0 && !std_listen))
666  {
667  /* cleanup */
668  cps->ops->free_wait_array(cps, objs);
669  break;
670  }
671  else if (res == 0)
672  set_ready_event = TRUE;
673  }
674 
675  TRACE("closing connections\n");
676 
677  EnterCriticalSection(&cps->cs);
678  LIST_FOR_EACH_ENTRY(conn, &cps->listeners, RpcConnection, protseq_entry)
680  LIST_FOR_EACH_ENTRY(conn, &cps->connections, RpcConnection, protseq_entry)
681  {
682  RPCRT4_GrabConnection(conn);
684  }
685  LeaveCriticalSection(&cps->cs);
686 
687  if (res == 0 && !std_listen)
689 
690  TRACE("waiting for active connections to close\n");
691 
692  EnterCriticalSection(&cps->cs);
693  while (!list_empty(&cps->connections))
694  {
695  conn = LIST_ENTRY(list_head(&cps->connections), RpcConnection, protseq_entry);
696  LeaveCriticalSection(&cps->cs);
698  EnterCriticalSection(&cps->cs);
699  }
700  LeaveCriticalSection(&cps->cs);
701 
702  TRACE("done\n");
703  return 0;
704 }
705 
706 /* tells the server thread that the state has changed and waits for it to
707  * make the changes */
709 {
710  /* make sure we are the only thread sync'ing the server state, otherwise
711  * there is a race with the server thread setting an older state and setting
712  * the server_ready_event when the new state hasn't yet been applied */
714 
715  ps->ops->signal_state_changed(ps);
716 
717  /* wait for server thread to make the requested changes before returning */
719 
720  ReleaseMutex(ps->mgr_mutex);
721 }
722 
724 {
726 
728  if (ps->server_thread) goto done;
729 
730  if (!ps->mgr_mutex) ps->mgr_mutex = CreateMutexW(NULL, FALSE, NULL);
733  if (!ps->server_thread)
735 
736 done:
738  return status;
739 }
740 
742 {
744  RpcServerProtseq *cps;
745 
746  TRACE("\n");
747 
749  if (auto_listen || !listen_done_event)
750  {
751  status = RPC_S_OK;
752  if(!auto_listen)
754  if (++listen_count == 1)
755  std_listen = TRUE;
756  }
758  if (status) return status;
759 
760  if (std_listen)
761  {
764  {
766  if (status != RPC_S_OK)
767  break;
768 
769  /* make sure server is actually listening on the interface before
770  * returning */
772  }
774  }
775 
776  return status;
777 }
778 
779 static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
780 {
781  BOOL stop_listen = FALSE;
783 
785  if (!std_listen && (auto_listen || !listen_done_event))
786  {
788  }
789  else
790  {
791  stop_listen = listen_count != 0 && --listen_count == 0;
792  assert(listen_count >= 0);
793  if (stop_listen)
794  std_listen = FALSE;
795  }
797 
798  if (status) return status;
799 
800  if (stop_listen) {
801  RpcServerProtseq *cps;
806  }
807 
808  if (!auto_listen)
809  {
813  }
814  return RPC_S_OK;
815 }
816 
818 {
819  RpcConnection *conn;
820  BOOL registered = FALSE;
821  EnterCriticalSection(&protseq->cs);
822  LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection, protseq_entry) {
823  if (!endpoint || !strcmp(endpoint, conn->Endpoint)) {
824  registered = TRUE;
825  break;
826  }
827  }
828  LeaveCriticalSection(&protseq->cs);
829  return registered;
830 }
831 
833 {
835 
836  EnterCriticalSection(&ps->cs);
837 
839  status = RPC_S_OK;
840  else
841  status = ps->ops->open_endpoint(ps, endpoint);
842 
843  LeaveCriticalSection(&ps->cs);
844 
845  if (status != RPC_S_OK)
846  return status;
847 
848  if (std_listen)
849  {
851  if (status == RPC_S_OK)
853  }
854 
855  return status;
856 }
857 
858 /***********************************************************************
859  * RpcServerInqBindings (RPCRT4.@)
860  */
862 {
864  DWORD count;
865  RpcServerProtseq* ps;
866  RpcConnection* conn;
867 
868  if (BindingVector)
869  TRACE("(*BindingVector == ^%p)\n", *BindingVector);
870  else
871  ERR("(BindingVector == NULL!!?)\n");
872 
874  /* count connections */
875  count = 0;
877  EnterCriticalSection(&ps->cs);
878  LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry)
879  count++;
880  LeaveCriticalSection(&ps->cs);
881  }
882  if (count) {
883  /* export bindings */
884  *BindingVector = HeapAlloc(GetProcessHeap(), 0,
885  sizeof(RPC_BINDING_VECTOR) +
886  sizeof(RPC_BINDING_HANDLE)*(count-1));
887  (*BindingVector)->Count = count;
888  count = 0;
890  EnterCriticalSection(&ps->cs);
891  LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry) {
892  RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count],
893  conn);
894  count++;
895  }
896  LeaveCriticalSection(&ps->cs);
897  }
898  status = RPC_S_OK;
899  } else {
900  *BindingVector = NULL;
902  }
904  return status;
905 }
906 
907 /***********************************************************************
908  * RpcServerUseProtseqEpA (RPCRT4.@)
909  */
911 {
912  RPC_POLICY policy;
913 
914  TRACE( "(%s,%u,%s,%p)\n", Protseq, MaxCalls, Endpoint, SecurityDescriptor );
915 
916  /* This should provide the default behaviour */
917  policy.Length = sizeof( policy );
918  policy.EndpointFlags = 0;
919  policy.NICFlags = 0;
920 
921  return RpcServerUseProtseqEpExA( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
922 }
923 
924 /***********************************************************************
925  * RpcServerUseProtseqEpW (RPCRT4.@)
926  */
928 {
929  RPC_POLICY policy;
930 
931  TRACE( "(%s,%u,%s,%p)\n", debugstr_w( Protseq ), MaxCalls, debugstr_w( Endpoint ), SecurityDescriptor );
932 
933  /* This should provide the default behaviour */
934  policy.Length = sizeof( policy );
935  policy.EndpointFlags = 0;
936  policy.NICFlags = 0;
937 
938  return RpcServerUseProtseqEpExW( Protseq, MaxCalls, Endpoint, SecurityDescriptor, &policy );
939 }
940 
941 /***********************************************************************
942  * alloc_serverprotoseq (internal)
943  *
944  * Must be called with server_cs held.
945  */
946 static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
947 {
948  const struct protseq_ops *ops = rpcrt4_get_protseq_ops(Protseq);
949 
950  if (!ops)
951  {
952  FIXME("protseq %s not supported\n", debugstr_a(Protseq));
954  }
955 
956  *ps = ops->alloc();
957  if (!*ps)
958  return RPC_S_OUT_OF_RESOURCES;
959  (*ps)->MaxCalls = MaxCalls;
960  (*ps)->Protseq = RPCRT4_strdupA(Protseq);
961  (*ps)->ops = ops;
962  list_init(&(*ps)->listeners);
963  list_init(&(*ps)->connections);
964  InitializeCriticalSection(&(*ps)->cs);
965  (*ps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcServerProtseq.cs");
966 
967  list_add_head(&protseqs, &(*ps)->entry);
968 
969  TRACE("new protseq %p created for %s\n", *ps, Protseq);
970 
971  return RPC_S_OK;
972 }
973 
974 /* must be called with server_cs held */
976 {
977  RPCRT4_strfree(ps->Protseq);
978  ps->cs.DebugInfo->Spare[0] = 0;
980  CloseHandle(ps->mgr_mutex);
982  list_remove(&ps->entry);
983  HeapFree(GetProcessHeap(), 0, ps);
984 }
985 
986 /* Finds a given protseq or creates a new one if one doesn't already exist */
987 static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
988 {
990  RpcServerProtseq *cps;
991 
993 
995  if (!strcmp(cps->Protseq, Protseq))
996  {
997  TRACE("found existing protseq object for %s\n", Protseq);
998  *ps = cps;
1000  return S_OK;
1001  }
1002 
1003  status = alloc_serverprotoseq(MaxCalls, Protseq, ps);
1004 
1006 
1007  return status;
1008 }
1009 
1010 /***********************************************************************
1011  * RpcServerUseProtseqEpExA (RPCRT4.@)
1012  */
1014  PRPC_POLICY lpPolicy )
1015 {
1016  RpcServerProtseq* ps;
1018 
1019  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a((const char *)Protseq),
1020  MaxCalls, debugstr_a((const char *)Endpoint), SecurityDescriptor,
1021  lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
1022 
1023  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps);
1024  if (status != RPC_S_OK)
1025  return status;
1026 
1027  return RPCRT4_use_protseq(ps, (const char *)Endpoint);
1028 }
1029 
1030 /***********************************************************************
1031  * RpcServerUseProtseqEpExW (RPCRT4.@)
1032  */
1034  PRPC_POLICY lpPolicy )
1035 {
1036  RpcServerProtseq* ps;
1038  LPSTR ProtseqA;
1039  LPSTR EndpointA;
1040 
1041  TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls,
1042  debugstr_w( Endpoint ), SecurityDescriptor,
1043  lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags );
1044 
1045  ProtseqA = RPCRT4_strdupWtoA(Protseq);
1046  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
1047  RPCRT4_strfree(ProtseqA);
1048  if (status != RPC_S_OK)
1049  return status;
1050 
1051  EndpointA = RPCRT4_strdupWtoA(Endpoint);
1052  status = RPCRT4_use_protseq(ps, EndpointA);
1053  RPCRT4_strfree(EndpointA);
1054  return status;
1055 }
1056 
1057 /***********************************************************************
1058  * RpcServerUseProtseqA (RPCRT4.@)
1059  */
1060 RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
1061 {
1063  RpcServerProtseq* ps;
1064 
1065  TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor);
1066 
1067  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps);
1068  if (status != RPC_S_OK)
1069  return status;
1070 
1071  return RPCRT4_use_protseq(ps, NULL);
1072 }
1073 
1074 /***********************************************************************
1075  * RpcServerUseProtseqW (RPCRT4.@)
1076  */
1077 RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
1078 {
1080  RpcServerProtseq* ps;
1081  LPSTR ProtseqA;
1082 
1083  TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor);
1084 
1085  ProtseqA = RPCRT4_strdupWtoA(Protseq);
1086  status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps);
1087  RPCRT4_strfree(ProtseqA);
1088  if (status != RPC_S_OK)
1089  return status;
1090 
1091  return RPCRT4_use_protseq(ps, NULL);
1092 }
1093 
1095 {
1096  RpcServerProtseq *cps, *cursor2;
1097 
1098  if (listen_count != 0)
1099  std_listen = FALSE;
1100 
1103  {
1104  if (listen_count != 0)
1107  }
1111 }
1112 
1113 /***********************************************************************
1114  * RpcServerRegisterIf (RPCRT4.@)
1115  */
1117 {
1118  TRACE("(%p,%s,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv);
1119  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, 0, RPC_C_LISTEN_MAX_CALLS_DEFAULT, (UINT)-1, NULL, NULL );
1120 }
1121 
1122 /***********************************************************************
1123  * RpcServerRegisterIfEx (RPCRT4.@)
1124  */
1126  UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN* IfCallbackFn )
1127 {
1128  TRACE("(%p,%s,%p,%u,%u,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls, IfCallbackFn);
1129  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, (UINT)-1, IfCallbackFn, NULL );
1130 }
1131 
1132 /***********************************************************************
1133  * RpcServerRegisterIf2 (RPCRT4.@)
1134  */
1136  UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn )
1137 {
1138  return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, MaxRpcSize, IfCallbackFn, NULL );
1139 }
1140 
1141 /***********************************************************************
1142  * RpcServerRegisterIf3 (RPCRT4.@)
1143  */
1145  UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn, void* SecurityDescriptor)
1146 {
1147  PRPC_SERVER_INTERFACE If = IfSpec;
1148  RpcServerInterface* sif;
1149  unsigned int i;
1150 
1151  TRACE("(%p,%s,%p,%u,%u,%u,%p,%p)\n", IfSpec, debugstr_guid(MgrTypeUuid), MgrEpv, Flags, MaxCalls,
1152  MaxRpcSize, IfCallbackFn, SecurityDescriptor);
1153 
1154  if (SecurityDescriptor)
1155  FIXME("Unsupported SecurityDescriptor argument.\n");
1156 
1157  TRACE(" interface id: %s %d.%d\n", debugstr_guid(&If->InterfaceId.SyntaxGUID),
1160  TRACE(" transfer syntax: %s %d.%d\n", debugstr_guid(&If->TransferSyntax.SyntaxGUID),
1163  TRACE(" dispatch table: %p\n", If->DispatchTable);
1164  if (If->DispatchTable) {
1165  TRACE(" dispatch table count: %d\n", If->DispatchTable->DispatchTableCount);
1166  for (i=0; i<If->DispatchTable->DispatchTableCount; i++) {
1167  TRACE(" entry %d: %p\n", i, If->DispatchTable->DispatchTable[i]);
1168  }
1169  TRACE(" reserved: %ld\n", If->DispatchTable->Reserved);
1170  }
1171  TRACE(" protseq endpoint count: %d\n", If->RpcProtseqEndpointCount);
1172  TRACE(" default manager epv: %p\n", If->DefaultManagerEpv);
1173  TRACE(" interpreter info: %p\n", If->InterpreterInfo);
1174 
1176  sif->If = If;
1177  if (MgrTypeUuid) {
1178  sif->MgrTypeUuid = *MgrTypeUuid;
1179  sif->MgrEpv = MgrEpv;
1180  } else {
1181  memset(&sif->MgrTypeUuid, 0, sizeof(UUID));
1182  sif->MgrEpv = If->DefaultManagerEpv;
1183  }
1184  sif->Flags = Flags;
1185  sif->MaxCalls = MaxCalls;
1186  sif->MaxRpcSize = MaxRpcSize;
1187  sif->IfCallbackFn = IfCallbackFn;
1188 
1192 
1193  if (sif->Flags & RPC_IF_AUTOLISTEN)
1195 
1196  return RPC_S_OK;
1197 }
1198 
1199 /***********************************************************************
1200  * RpcServerUnregisterIf (RPCRT4.@)
1201  */
1202 RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, UINT WaitForCallsToComplete )
1203 {
1204  PRPC_SERVER_INTERFACE If = IfSpec;
1205  HANDLE event = NULL;
1206  BOOL found = FALSE;
1207  BOOL completed = TRUE;
1208  RpcServerInterface *cif;
1210 
1211  TRACE("(IfSpec == (RPC_IF_HANDLE)^%p (%s), MgrTypeUuid == %s, WaitForCallsToComplete == %u)\n",
1212  IfSpec, debugstr_guid(&If->InterfaceId.SyntaxGUID), debugstr_guid(MgrTypeUuid), WaitForCallsToComplete);
1213 
1216  if (((!IfSpec && !(cif->Flags & RPC_IF_AUTOLISTEN)) ||
1217  (IfSpec && !memcmp(&If->InterfaceId, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)))) &&
1218  UuidEqual(MgrTypeUuid, &cif->MgrTypeUuid, &status)) {
1219  list_remove(&cif->entry);
1220  TRACE("unregistering cif %p\n", cif);
1221  if (cif->CurrentCalls) {
1222  completed = FALSE;
1223  cif->Delete = TRUE;
1224  if (WaitForCallsToComplete)
1225  cif->CallsCompletedEvent = event = CreateEventW(NULL, FALSE, FALSE, NULL);
1226  }
1227  found = TRUE;
1228  break;
1229  }
1230  }
1232 
1233  if (!found) {
1234  ERR("not found for object %s\n", debugstr_guid(MgrTypeUuid));
1235  return RPC_S_UNKNOWN_IF;
1236  }
1237 
1238  if (completed)
1239  HeapFree(GetProcessHeap(), 0, cif);
1240  else if (event) {
1241  /* sif will be freed when the last call is completed, so be careful not to
1242  * touch that memory here as that could happen before we get here */
1244  CloseHandle(event);
1245  }
1246 
1247  return RPC_S_OK;
1248 }
1249 
1250 /***********************************************************************
1251  * RpcServerUnregisterIfEx (RPCRT4.@)
1252  */
1253 RPC_STATUS WINAPI RpcServerUnregisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles )
1254 {
1255  FIXME("(IfSpec == (RPC_IF_HANDLE)^%p, MgrTypeUuid == %s, RundownContextHandles == %d): stub\n",
1256  IfSpec, debugstr_guid(MgrTypeUuid), RundownContextHandles);
1257 
1258  return RPC_S_OK;
1259 }
1260 
1261 /***********************************************************************
1262  * RpcObjectSetType (RPCRT4.@)
1263  *
1264  * PARAMS
1265  * ObjUuid [I] "Object" UUID
1266  * TypeUuid [I] "Type" UUID
1267  *
1268  * RETURNS
1269  * RPC_S_OK The call succeeded
1270  * RPC_S_INVALID_OBJECT The provided object (nil) is not valid
1271  * RPC_S_ALREADY_REGISTERED The provided object is already registered
1272  *
1273  * Maps "Object" UUIDs to "Type" UUIDs. Passing the nil UUID as the type
1274  * resets the mapping for the specified object UUID to nil (the default).
1275  * The nil object is always associated with the nil type and cannot be
1276  * reassigned. Servers can support multiple implementations on the same
1277  * interface by registering different end-point vectors for the different
1278  * types. There's no need to call this if a server only supports the nil
1279  * type, as is typical.
1280  */
1282 {
1283  RpcObjTypeMap *map = RpcObjTypeMaps, *prev = NULL;
1284  RPC_STATUS dummy;
1285 
1286  TRACE("(ObjUUID == %s, TypeUuid == %s).\n", debugstr_guid(ObjUuid), debugstr_guid(TypeUuid));
1287  if ((! ObjUuid) || UuidIsNil(ObjUuid, &dummy)) {
1288  /* nil uuid cannot be remapped */
1289  return RPC_S_INVALID_OBJECT;
1290  }
1291 
1292  /* find the mapping for this object if there is one ... */
1293  while (map) {
1294  if (! UuidCompare(ObjUuid, &map->Object, &dummy)) break;
1295  prev = map;
1296  map = map->next;
1297  }
1298  if ((! TypeUuid) || UuidIsNil(TypeUuid, &dummy)) {
1299  /* ... and drop it from the list */
1300  if (map) {
1301  if (prev)
1302  prev->next = map->next;
1303  else
1304  RpcObjTypeMaps = map->next;
1305  HeapFree(GetProcessHeap(), 0, map);
1306  }
1307  } else {
1308  /* ... , fail if we found it ... */
1309  if (map)
1310  return RPC_S_ALREADY_REGISTERED;
1311  /* ... otherwise create a new one and add it in. */
1312  map = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcObjTypeMap));
1313  map->Object = *ObjUuid;
1314  map->Type = *TypeUuid;
1315  map->next = NULL;
1316  if (prev)
1317  prev->next = map; /* prev is the last map in the linklist */
1318  else
1319  RpcObjTypeMaps = map;
1320  }
1321 
1322  return RPC_S_OK;
1323 }
1324 
1326 {
1327  struct list entry;
1332 };
1333 
1334 static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
1335 {
1336  SECURITY_STATUS sec_status;
1337  SecPkgInfoW *packages;
1338  ULONG package_count;
1339  ULONG i;
1340 
1341  sec_status = EnumerateSecurityPackagesW(&package_count, &packages);
1342  if (sec_status != SEC_E_OK)
1343  {
1344  ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", sec_status);
1345  return RPC_S_SEC_PKG_ERROR;
1346  }
1347 
1348  for (i = 0; i < package_count; i++)
1349  if (packages[i].wRPCID == auth_type)
1350  break;
1351 
1352  if (i == package_count)
1353  {
1354  WARN("unsupported AuthnSvc %u\n", auth_type);
1355  FreeContextBuffer(packages);
1357  }
1358 
1359  TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), auth_type);
1360  *packages_buf = packages;
1361  *ret = packages + i;
1362  return RPC_S_OK;
1363 }
1364 
1366  USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
1367 {
1369  struct rpc_server_registered_auth_info *auth_info;
1370  SECURITY_STATUS sec_status;
1371 
1374  {
1375  if (auth_info->auth_type == auth_type)
1376  {
1377  sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)auth_info->principal, auth_info->package_name,
1379  cred, exp);
1380  if (sec_status != SEC_E_OK)
1381  {
1383  break;
1384  }
1385 
1386  *max_token = auth_info->max_token;
1387  status = RPC_S_OK;
1388  break;
1389  }
1390  }
1392 
1393  return status;
1394 }
1395 
1397 {
1398  struct rpc_server_registered_auth_info *auth_info, *cursor2;
1399 
1402  {
1403  HeapFree(GetProcessHeap(), 0, auth_info->package_name);
1404  HeapFree(GetProcessHeap(), 0, auth_info->principal);
1405  HeapFree(GetProcessHeap(), 0, auth_info);
1406  }
1409 }
1410 
1411 /***********************************************************************
1412  * RpcServerRegisterAuthInfoA (RPCRT4.@)
1413  */
1415  LPVOID Arg )
1416 {
1417  WCHAR *principal_name = NULL;
1419 
1420  TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg);
1421 
1422  if(ServerPrincName && !(principal_name = RPCRT4_strdupAtoW((const char*)ServerPrincName)))
1423  return RPC_S_OUT_OF_RESOURCES;
1424 
1425  status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg);
1426 
1427  HeapFree(GetProcessHeap(), 0, principal_name);
1428  return status;
1429 }
1430 
1431 /***********************************************************************
1432  * RpcServerRegisterAuthInfoW (RPCRT4.@)
1433  */
1435  LPVOID Arg )
1436 {
1437  struct rpc_server_registered_auth_info *auth_info;
1438  SecPkgInfoW *packages, *package;
1440  ULONG max_token;
1442 
1443  TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg);
1444 
1445  status = find_security_package(AuthnSvc, &packages, &package);
1446  if (status != RPC_S_OK)
1447  return status;
1448 
1449  package_name = RPCRT4_strdupW(package->Name);
1450  max_token = package->cbMaxToken;
1451  FreeContextBuffer(packages);
1452  if (!package_name)
1453  return RPC_S_OUT_OF_RESOURCES;
1454 
1455  auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
1456  if (!auth_info) {
1458  return RPC_S_OUT_OF_RESOURCES;
1459  }
1460 
1461  if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
1463  HeapFree(GetProcessHeap(), 0, auth_info);
1464  return RPC_S_OUT_OF_RESOURCES;
1465  }
1466 
1467  auth_info->auth_type = AuthnSvc;
1468  auth_info->package_name = package_name;
1469  auth_info->max_token = max_token;
1470 
1474 
1475  return RPC_S_OK;
1476 }
1477 
1478 /******************************************************************************
1479  * RpcServerInqDefaultPrincNameA (rpcrt4.@)
1480  */
1482 {
1483  RPC_STATUS ret;
1484  RPC_WSTR principalW;
1485 
1486  TRACE("%u, %p\n", AuthnSvc, PrincName);
1487 
1488  if ((ret = RpcServerInqDefaultPrincNameW( AuthnSvc, &principalW )) == RPC_S_OK)
1489  {
1490  if (!(*PrincName = (RPC_CSTR)RPCRT4_strdupWtoA( principalW ))) return RPC_S_OUT_OF_MEMORY;
1491  RpcStringFreeW( &principalW );
1492  }
1493  return ret;
1494 }
1495 
1496 /******************************************************************************
1497  * RpcServerInqDefaultPrincNameW (rpcrt4.@)
1498  */
1500 {
1501  ULONG len = 0;
1502 
1503  FIXME("%u, %p\n", AuthnSvc, PrincName);
1504 
1505  if (AuthnSvc != RPC_C_AUTHN_WINNT) return RPC_S_UNKNOWN_AUTHN_SERVICE;
1506 
1507  GetUserNameExW( NameSamCompatible, NULL, &len );
1509 
1510  if (!(*PrincName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
1511  return RPC_S_OUT_OF_MEMORY;
1512 
1513  GetUserNameExW( NameSamCompatible, *PrincName, &len );
1514  return RPC_S_OK;
1515 }
1516 
1517 /***********************************************************************
1518  * RpcServerListen (RPCRT4.@)
1519  */
1520 RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait )
1521 {
1523 
1524  TRACE("(%u,%u,%u)\n", MinimumCallThreads, MaxCalls, DontWait);
1525 
1526  if (list_empty(&protseqs))
1528 
1530 
1531  if (DontWait || (status != RPC_S_OK)) return status;
1532 
1533  return RpcMgmtWaitServerListen();
1534 }
1535 
1536 /***********************************************************************
1537  * RpcMgmtServerWaitListen (RPCRT4.@)
1538  */
1540 {
1541  RpcServerProtseq *protseq;
1542  HANDLE event, wait_thread;
1543 
1544  TRACE("()\n");
1545 
1547  event = listen_done_event;
1549 
1550  if (!event)
1551  return RPC_S_NOT_LISTENING;
1552 
1553  TRACE( "waiting for server calls to finish\n" );
1555  TRACE( "done waiting\n" );
1556 
1558  /* wait for server threads to finish */
1559  while(1)
1560  {
1561  if (listen_count)
1562  break;
1563 
1564  wait_thread = NULL;
1567  {
1568  if ((wait_thread = protseq->server_thread))
1569  {
1570  protseq->server_thread = NULL;
1571  break;
1572  }
1573  }
1575  if (!wait_thread)
1576  break;
1577 
1578  TRACE("waiting for thread %u\n", GetThreadId(wait_thread));
1580  WaitForSingleObject(wait_thread, INFINITE);
1581  CloseHandle(wait_thread);
1583  }
1584  if (listen_done_event == event)
1585  {
1587  CloseHandle( event );
1588  }
1590  return RPC_S_OK;
1591 }
1592 
1593 /***********************************************************************
1594  * RpcMgmtStopServerListening (RPCRT4.@)
1595  */
1597 {
1598  TRACE("(Binding == (RPC_BINDING_HANDLE)^%p)\n", Binding);
1599 
1600  if (Binding) {
1601  FIXME("client-side invocation not implemented.\n");
1603  }
1604 
1605  return RPCRT4_stop_listen(FALSE);
1606 }
1607 
1608 /***********************************************************************
1609  * RpcMgmtEnableIdleCleanup (RPCRT4.@)
1610  */
1612 {
1613  FIXME("(): stub\n");
1614  return RPC_S_OK;
1615 }
1616 
1617 /***********************************************************************
1618  * I_RpcServerStartListening (RPCRT4.@)
1619  */
1621 {
1622  FIXME( "(%p): stub\n", hWnd );
1623 
1624  return RPC_S_OK;
1625 }
1626 
1627 /***********************************************************************
1628  * I_RpcServerStopListening (RPCRT4.@)
1629  */
1631 {
1632  FIXME( "(): stub\n" );
1633 
1634  return RPC_S_OK;
1635 }
1636 
1637 /***********************************************************************
1638  * I_RpcWindowProc (RPCRT4.@)
1639  */
1641 {
1642  FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
1643 
1644  return 0;
1645 }
1646 
1647 /***********************************************************************
1648  * RpcMgmtInqIfIds (RPCRT4.@)
1649  */
1651 {
1652  FIXME("(%p,%p): stub\n", Binding, IfIdVector);
1653  return RPC_S_INVALID_BINDING;
1654 }
1655 
1656 /***********************************************************************
1657  * RpcMgmtInqStats (RPCRT4.@)
1658  */
1660 {
1661  RPC_STATS_VECTOR *stats;
1662 
1663  FIXME("(%p,%p)\n", Binding, Statistics);
1664 
1665  if ((stats = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_STATS_VECTOR))))
1666  {
1667  stats->Count = 1;
1668  stats->Stats[0] = 0;
1669  *Statistics = stats;
1670  return RPC_S_OK;
1671  }
1672  return RPC_S_OUT_OF_RESOURCES;
1673 }
1674 
1675 /***********************************************************************
1676  * RpcMgmtStatsVectorFree (RPCRT4.@)
1677  */
1679 {
1680  FIXME("(%p)\n", StatsVector);
1681 
1682  if (StatsVector)
1683  {
1684  HeapFree(GetProcessHeap(), 0, *StatsVector);
1685  *StatsVector = NULL;
1686  }
1687  return RPC_S_OK;
1688 }
1689 
1690 /***********************************************************************
1691  * RpcMgmtEpEltInqBegin (RPCRT4.@)
1692  */
1694  RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
1695 {
1696  FIXME("(%p,%u,%p,%u,%p,%p): stub\n",
1697  Binding, InquiryType, IfId, VersOption, ObjectUuid, InquiryContext);
1698  return RPC_S_INVALID_BINDING;
1699 }
1700 
1701 /***********************************************************************
1702  * RpcMgmtIsServerListening (RPCRT4.@)
1703  */
1705 {
1707 
1708  TRACE("(%p)\n", Binding);
1709 
1710  if (Binding) {
1711  RpcBinding *rpc_binding = (RpcBinding*)Binding;
1712  status = RPCRT4_IsServerListening(rpc_binding->Protseq, rpc_binding->Endpoint);
1713  }else {
1717  }
1718 
1719  return status;
1720 }
1721 
1722 /***********************************************************************
1723  * RpcMgmtSetAuthorizationFn (RPCRT4.@)
1724  */
1726 {
1727  FIXME("(%p): stub\n", fn);
1728  return RPC_S_OK;
1729 }
1730 
1731 /***********************************************************************
1732  * RpcMgmtSetServerStackSize (RPCRT4.@)
1733  */
1735 {
1736  FIXME("(0x%x): stub\n", ThreadStackSize);
1737  return RPC_S_OK;
1738 }
1739 
1740 /***********************************************************************
1741  * I_RpcGetCurrentCallHandle (RPCRT4.@)
1742  */
1744 {
1745  TRACE("\n");
1747 }
static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
Definition: rpc_server.c:987
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:1013
#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:68
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
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:130
RPC_STATUS WINAPI I_RpcServerStopListening(void)
Definition: rpc_server.c:1630
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:1596
#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:1650
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
unsigned short MajorVersion
Definition: rpcdcep.h:27
unsigned char * auth_data
Definition: rpc_server.c:53
WCHAR SEC_WCHAR
Definition: sspi.h:29
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
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:832
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:500
#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:817
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:90
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN fn)
Definition: rpc_server.c:1725
ULONG auth_length
Definition: rpc_server.c:54
#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:1620
ULONG NICFlags
Definition: rpcdce.h:218
void RPCRT4_new_client(RpcConnection *conn)
Definition: rpc_server.c:625
RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
Definition: rpc_server.c:1077
static RPC_STATUS RPCRT4_start_listen_protseq(RpcServerProtseq *ps, BOOL auto_listen)
Definition: rpc_server.c:723
#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:250
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:1202
WPARAM wParam
Definition: combotst.c:138
static CRITICAL_SECTION server_cs
Definition: rpc_server.c:72
RPC_STATUS WINAPI RpcMgmtSetServerStackSize(ULONG ThreadStackSize)
Definition: rpc_server.c:1734
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
static UUID * LookupObjType(UUID *ObjUuid)
Definition: rpc_server.c:121
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:1434
#define REJECT_TEMPORARY_CONGESTION
Definition: rpc_defs.h:221
int WINAPI UuidCompare(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:207
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:1125
RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
Definition: rpc_server.c:1060
__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:533
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:52
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:266
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:1094
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:104
#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:1033
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
struct _RpcConnection * conn
Definition: rpc_server.c:50
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:1520
#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:73
#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:1253
#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:277
#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:1640
static CRITICAL_SECTION_DEBUG listen_cs_debug
Definition: rpc_server.c:82
switch(r->id)
Definition: btrfs.c:2904
#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:362
static struct list server_registered_auth_info
Definition: rpc_server.c:70
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
Definition: dhcpd.h:135
#define GetExceptionCode()
Definition: exception.h:66
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:1611
RPC_STATUS WINAPI RpcServerInqBindings(RPC_BINDING_VECTOR **BindingVector)
Definition: rpc_server.c:861
#define GetProcessHeap()
Definition: compat.h:403
static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
Definition: rpc_server.c:641
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:1014
RPC_STATUS WINAPI RpcServerUseProtseqEpA(RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:910
#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:91
RPC_STATUS WINAPI RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
Definition: rpc_server.c:1659
struct list entry
Definition: rpc_server.h:65
LONG_PTR Reserved
Definition: rpcdcep.h:89
#define WINAPI
Definition: msvc.h:6
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:1116
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:779
static void RPCRT4_sync_with_server_thread(RpcServerProtseq *ps)
Definition: rpc_server.c:708
Definition: _map.h:44
struct _test_info results[8]
Definition: SetCursorPos.c:29
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:866
HANDLE server_thread
Definition: rpc_server.h:41
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
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:171
#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:337
struct _RpcObjTypeMap * next
Definition: rpc_server.c:60
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:102
uint32_t entry
Definition: isohybrid.c:63
RPC_STATUS RPCRT4_MakeBinding(RpcBinding **Binding, RpcConnection *Connection)
Definition: rpc_binding.c:232
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:159
#define err(...)
static CRITICAL_SECTION listen_cs
Definition: rpc_server.c:81
struct _cl_event * event
Definition: glext.h:7739
LIST_ENTRY ProcessLocksList
Definition: winbase.h:855
#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:1743
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:475
#define RPC_S_ALREADY_LISTENING
Definition: winerror.h:1024
static HANDLE listen_done_event
Definition: rpc_server.c:104
#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:927
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
Definition: rpc_server.c:1365
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
Definition: rpc_assoc.c:563
__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:224
#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:108
#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:1396
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
unsigned int UINT
Definition: ndis.h:50
DWORD exp
Definition: msg.c:16038
#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:1704
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *PrincName)
Definition: rpc_server.c:1499
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:137
#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:1678
static BOOL std_listen
Definition: rpc_server.c:100
static struct list server_interfaces
Definition: rpc_server.c:69
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:1693
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
RPC_STATUS WINAPI RpcMgmtWaitServerListen(void)
Definition: rpc_server.c:1539
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:962
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:741
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:204
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:1144
RPC_STATUS WINAPI RpcObjectSetType(UUID *ObjUuid, UUID *TypeUuid)
Definition: rpc_server.c:1281
#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:946
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
Definition: rpc_server.c:543
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:1334
static void destroy_serverprotoseq(RpcServerProtseq *ps)
Definition: rpc_server.c:975
RPC_STATUS WINAPI RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
Definition: rpc_server.c:1414
RpcBinding * RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:970
#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:402
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:1135
#define RPC_VER_MINOR
Definition: rpc_defs.h:177
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA(ULONG AuthnSvc, RPC_CSTR *PrincName)
Definition: rpc_server.c:1481
#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:859
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:65
unsigned int RpcProtseqEndpointCount
Definition: rpcdcep.h:107
#define __EXCEPT_ALL
Definition: exception.h:60
static UUID uuid_nil
Definition: rpc_server.c:106
Definition: ps.c:97
RpcPktHdr * hdr
Definition: rpc_server.c:51