ReactOS 0.4.15-dev-7958-gcd0bb1a
rpc_server.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "rpc.h"
#include "rpcndr.h"
#include "excpt.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "rpc_server.h"
#include "rpc_assoc.h"
#include "rpc_message.h"
#include "rpc_defs.h"
#include "ncastatus.h"
#include "secext.h"
Include dependency graph for rpc_server.c:

Go to the source code of this file.

Classes

struct  _RpcPacket
 
struct  _RpcObjTypeMap
 
struct  rpc_server_registered_auth_info
 

Typedefs

typedef struct _RpcPacket RpcPacket
 
typedef struct _RpcObjTypeMap RpcObjTypeMap
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (rpc)
 
static RpcObjTypeMapLookupObjTypeMap (UUID *ObjUuid)
 
static UUIDLookupObjType (UUID *ObjUuid)
 
static RpcServerInterfaceRPCRT4_find_interface (UUID *object, const RPC_SYNTAX_IDENTIFIER *if_id, const RPC_SYNTAX_IDENTIFIER *transfer_syntax, BOOL check_object)
 
static void RPCRT4_release_server_interface (RpcServerInterface *sif)
 
static RpcPktHdrhandle_bind_error (RpcConnection *conn, RPC_STATUS error)
 
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)
 
static RPC_STATUS process_bind_packet (RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
 
static RPC_STATUS process_request_packet (RpcConnection *conn, RpcPktRequestHdr *hdr, RPC_MESSAGE *msg)
 
static RPC_STATUS process_auth3_packet (RpcConnection *conn, RpcPktCommonHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
 
static void RPCRT4_process_packet (RpcConnection *conn, RpcPktHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
 
static DWORD CALLBACK RPCRT4_worker_thread (LPVOID the_arg)
 
static DWORD CALLBACK RPCRT4_io_thread (LPVOID the_arg)
 
void RPCRT4_new_client (RpcConnection *conn)
 
static DWORD CALLBACK RPCRT4_server_thread (LPVOID the_arg)
 
static void RPCRT4_sync_with_server_thread (RpcServerProtseq *ps)
 
static RPC_STATUS RPCRT4_start_listen_protseq (RpcServerProtseq *ps, BOOL auto_listen)
 
static RPC_STATUS RPCRT4_start_listen (BOOL auto_listen)
 
static RPC_STATUS RPCRT4_stop_listen (BOOL auto_listen)
 
static BOOL RPCRT4_protseq_is_endpoint_registered (RpcServerProtseq *protseq, const char *endpoint)
 
static RPC_STATUS RPCRT4_use_protseq (RpcServerProtseq *ps, const char *endpoint)
 
RPC_STATUS WINAPI RpcServerInqBindings (RPC_BINDING_VECTOR **BindingVector)
 
RPC_STATUS WINAPI RpcServerUseProtseqEpA (RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor)
 
RPC_STATUS WINAPI RpcServerUseProtseqEpW (RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
 
static RPC_STATUS alloc_serverprotoseq (UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
 
static void destroy_serverprotoseq (RpcServerProtseq *ps)
 
static RPC_STATUS RPCRT4_get_or_create_serverprotseq (UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
 
RPC_STATUS WINAPI RpcServerUseProtseqEpExA (RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
 
RPC_STATUS WINAPI RpcServerUseProtseqEpExW (RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
 
RPC_STATUS WINAPI RpcServerUseProtseqA (RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
 
RPC_STATUS WINAPI RpcServerUseProtseqW (RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
 
void RPCRT4_destroy_all_protseqs (void)
 
RPC_STATUS WINAPI RpcServerRegisterIf (RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
 
RPC_STATUS WINAPI RpcServerRegisterIfEx (RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv, UINT Flags, UINT MaxCalls, RPC_IF_CALLBACK_FN *IfCallbackFn)
 
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)
 
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)
 
RPC_STATUS WINAPI RpcServerUnregisterIf (RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, UINT WaitForCallsToComplete)
 
RPC_STATUS WINAPI RpcServerUnregisterIfEx (RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, int RundownContextHandles)
 
RPC_STATUS WINAPI RpcObjectSetType (UUID *ObjUuid, UUID *TypeUuid)
 
static RPC_STATUS find_security_package (ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
 
RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo (USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token)
 
void RPCRT4_ServerFreeAllRegisteredAuthInfo (void)
 
RPC_STATUS WINAPI RpcServerRegisterAuthInfoA (RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
 
RPC_STATUS WINAPI RpcServerRegisterAuthInfoW (RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
 
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA (ULONG AuthnSvc, RPC_CSTR *PrincName)
 
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW (ULONG AuthnSvc, RPC_WSTR *PrincName)
 
RPC_STATUS WINAPI RpcServerListen (UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
 
RPC_STATUS WINAPI RpcMgmtWaitServerListen (void)
 
RPC_STATUS WINAPI RpcMgmtStopServerListening (RPC_BINDING_HANDLE Binding)
 
RPC_STATUS WINAPI RpcMgmtEnableIdleCleanup (void)
 
RPC_STATUS WINAPI I_RpcServerStartListening (HWND hWnd)
 
RPC_STATUS WINAPI I_RpcServerStopListening (void)
 
UINT WINAPI I_RpcWindowProc (void *hWnd, UINT Message, UINT wParam, ULONG lParam)
 
RPC_STATUS WINAPI RpcMgmtInqIfIds (RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR **IfIdVector)
 
RPC_STATUS WINAPI RpcMgmtInqStats (RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
 
RPC_STATUS WINAPI RpcMgmtStatsVectorFree (RPC_STATS_VECTOR **StatsVector)
 
RPC_STATUS WINAPI RpcMgmtEpEltInqBegin (RPC_BINDING_HANDLE Binding, ULONG InquiryType, RPC_IF_ID *IfId, ULONG VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE *InquiryContext)
 
RPC_STATUS WINAPI RpcMgmtIsServerListening (RPC_BINDING_HANDLE Binding)
 
RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn (RPC_MGMT_AUTHORIZATION_FN fn)
 
RPC_STATUS WINAPI RpcMgmtSetServerStackSize (ULONG ThreadStackSize)
 
RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle (void)
 

Variables

static RpcObjTypeMapRpcObjTypeMaps
 
static struct list protseqs = LIST_INIT(protseqs)
 
static struct list server_interfaces = LIST_INIT(server_interfaces)
 
static struct list server_registered_auth_info = LIST_INIT(server_registered_auth_info)
 
static CRITICAL_SECTION server_cs = { &server_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG server_cs_debug
 
static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG listen_cs_debug
 
static CRITICAL_SECTION server_auth_info_cs = { &server_auth_info_cs_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG server_auth_info_cs_debug
 
static BOOL std_listen
 
static LONG listen_count
 
static HANDLE listen_done_event
 
static UUID uuid_nil
 

Typedef Documentation

◆ RpcObjTypeMap

◆ RpcPacket

Function Documentation

◆ alloc_serverprotoseq()

static RPC_STATUS alloc_serverprotoseq ( UINT  MaxCalls,
const char Protseq,
RpcServerProtseq **  ps 
)
static

Definition at line 946 of file rpc_server.c.

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)
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}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
static struct list protseqs
Definition: rpc_server.c:68
const struct protseq_ops * rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN
#define RPC_S_OK
Definition: rpcnterr.h:22
#define TRACE(s)
Definition: solgame.cpp:4
RpcServerProtseq *(* alloc)(void)
Definition: rpc_server.h:51
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032

Referenced by RPCRT4_get_or_create_serverprotseq().

◆ destroy_serverprotoseq()

static void destroy_serverprotoseq ( RpcServerProtseq ps)
static

Definition at line 975 of file rpc_server.c.

976{
978 ps->cs.DebugInfo->Spare[0] = 0;
982 list_remove(&ps->entry);
983 HeapFree(GetProcessHeap(), 0, ps);
984}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:887
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:894
struct list entry
Definition: rpc_server.h:32
CRITICAL_SECTION cs
Definition: rpc_server.h:38
HANDLE server_ready_event
Definition: rpc_server.h:45
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

Referenced by RPCRT4_destroy_all_protseqs().

◆ find_security_package()

static RPC_STATUS find_security_package ( ULONG  auth_type,
SecPkgInfoW **  packages_buf,
SecPkgInfoW **  ret 
)
static

Definition at line 1334 of file rpc_server.c.

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}
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
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 debugstr_w
Definition: kernel32.h:32
LONG SECURITY_STATUS
Definition: sspi.h:34
SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, PSecPkgInfoW *ppPackageInfo)
Definition: sspi.c:709
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define SEC_E_OK
Definition: winerror.h:2356
#define RPC_S_UNKNOWN_AUTHN_SERVICE
Definition: winerror.h:1055
#define RPC_S_SEC_PKG_ERROR
Definition: winerror.h:1132

Referenced by RpcServerRegisterAuthInfoW().

◆ handle_bind_error()

static RpcPktHdr * handle_bind_error ( RpcConnection conn,
RPC_STATUS  error 
)
static

Definition at line 171 of file rpc_server.c.

172{
173 unsigned int reject_reason;
174 switch (error)
175 {
177 reject_reason = REJECT_TEMPORARY_CONGESTION;
178 break;
181 reject_reason = REJECT_LOCAL_LIMIT_EXCEEDED;
182 break;
185 break;
187 reject_reason = REJECT_UNKNOWN_AUTHN_SERVICE;
188 break;
190 reject_reason = REJECT_INVALID_CHECKSUM;
191 break;
192 default:
193 FIXME("unexpected status value %d\n", error);
194 /* fall through */
196 reject_reason = REJECT_REASON_NOT_SPECIFIED;
197 break;
198 }
201 reject_reason);
202}
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define error(str)
Definition: mkdosfs.c:1605
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED
Definition: rpc_defs.h:224
#define RPC_VER_MAJOR
Definition: rpc_defs.h:176
#define REJECT_INVALID_CHECKSUM
Definition: rpc_defs.h:229
#define REJECT_LOCAL_LIMIT_EXCEEDED
Definition: rpc_defs.h:222
#define REJECT_REASON_NOT_SPECIFIED
Definition: rpc_defs.h:220
#define REJECT_UNKNOWN_AUTHN_SERVICE
Definition: rpc_defs.h:228
#define REJECT_TEMPORARY_CONGESTION
Definition: rpc_defs.h:221
#define RPC_VER_MINOR
Definition: rpc_defs.h:177
RpcPktHdr * RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor, unsigned short RejectReason)
Definition: rpc_message.c:231
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
#define RPC_S_SERVER_TOO_BUSY
Definition: winerror.h:1034
#define RPC_S_INVALID_BOUND
Definition: winerror.h:1043
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039

Referenced by process_bind_packet().

◆ I_RpcGetCurrentCallHandle()

RPC_BINDING_HANDLE WINAPI I_RpcGetCurrentCallHandle ( void  )

◆ I_RpcServerStartListening()

RPC_STATUS WINAPI I_RpcServerStartListening ( HWND  hWnd)

Definition at line 1620 of file rpc_server.c.

1621{
1622 FIXME( "(%p): stub\n", hWnd );
1623
1624 return RPC_S_OK;
1625}
HWND hWnd
Definition: settings.c:17

◆ I_RpcServerStopListening()

RPC_STATUS WINAPI I_RpcServerStopListening ( void  )

Definition at line 1630 of file rpc_server.c.

1631{
1632 FIXME( "(): stub\n" );
1633
1634 return RPC_S_OK;
1635}

◆ I_RpcWindowProc()

UINT WINAPI I_RpcWindowProc ( void hWnd,
UINT  Message,
UINT  wParam,
ULONG  lParam 
)

Definition at line 1640 of file rpc_server.c.

1641{
1642 FIXME( "(%p,%08x,%08x,%08x): stub\n", hWnd, Message, wParam, lParam );
1643
1644 return 0;
1645}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static const WCHAR Message[]
Definition: register.c:74

◆ LookupObjType()

static UUID * LookupObjType ( UUID ObjUuid)
inlinestatic

Definition at line 121 of file rpc_server.c.

122{
124 if (map)
125 return &map->Type;
126 else
127 return &uuid_nil;
128}
Definition: _map.h:48
static RpcObjTypeMap * LookupObjTypeMap(UUID *ObjUuid)
Definition: rpc_server.c:108
static UUID uuid_nil
Definition: rpc_server.c:106

Referenced by RPCRT4_find_interface().

◆ LookupObjTypeMap()

static RpcObjTypeMap * LookupObjTypeMap ( UUID ObjUuid)
inlinestatic

Definition at line 108 of file rpc_server.c.

109{
112
113 while (rslt) {
114 if (! UuidCompare(ObjUuid, &rslt->Object, &dummy)) break;
115 rslt = rslt->next;
116 }
117
118 return rslt;
119}
static RpcObjTypeMap * RpcObjTypeMaps
Definition: rpc_server.c:65
int WINAPI UuidCompare(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:209
long RPC_STATUS
Definition: rpc.h:52
struct _RpcObjTypeMap * next
Definition: rpc_server.c:60

Referenced by LookupObjType().

◆ process_auth3_packet()

static RPC_STATUS process_auth3_packet ( RpcConnection conn,
RpcPktCommonHdr hdr,
RPC_MESSAGE msg,
unsigned char auth_data,
ULONG  auth_length 
)
static

Definition at line 475 of file rpc_server.c.

480{
482
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}
#define msg(x)
Definition: auth_time.c:54
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
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
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:268
RPC_SYNTAX_IDENTIFIER ActiveInterface
Definition: rpc_binding.h:92
Definition: ps.c:97

Referenced by RPCRT4_io_thread(), and RPCRT4_process_packet().

◆ process_bind_packet()

static RPC_STATUS process_bind_packet ( RpcConnection conn,
RpcPktBindHdr hdr,
RPC_MESSAGE msg,
unsigned char auth_data,
ULONG  auth_length 
)
static

Definition at line 337 of file rpc_server.c.

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}
char hdr[14]
Definition: iptest.cpp:33
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength, const void *Auth, unsigned int AuthLength)
Definition: rpc_message.c:761
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
static RpcPktHdr * handle_bind_error(RpcConnection *conn, RPC_STATUS error)
Definition: rpc_server.c:171

Referenced by RPCRT4_io_thread(), and RPCRT4_process_packet().

◆ process_bind_packet_no_send()

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 
)
static

Definition at line 204 of file rpc_server.c.

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)
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 {
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 */
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}
static struct _test_info results[8]
Definition: SetCursorPos.c:31
#define TRUE
Definition: types.h:120
#define HeapAlloc
Definition: compat.h:733
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
#define debugstr_guid
Definition: kernel32.h:35
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:137
RPC_STATUS RPCRT4_MakeBinding(RpcBinding **Binding, RpcConnection *Connection)
Definition: rpc_binding.c:232
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED
Definition: rpc_defs.h:216
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED
Definition: rpc_defs.h:217
#define RESULT_ACCEPT
Definition: rpc_defs.h:211
#define REASON_NONE
Definition: rpc_defs.h:215
#define RESULT_PROVIDER_REJECTION
Definition: rpc_defs.h:213
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
#define RPC_MIN_PACKET_SIZE
Definition: rpc_defs.h:183
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
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
static void RPCRT4_release_server_interface(RpcServerInterface *sif)
Definition: rpc_server.c:159
#define memset(x, y, z)
Definition: compat.h:39
RPC_SYNTAX_IDENTIFIER transfer_syntaxes[ANYSIZE_ARRAY]
Definition: rpc_defs.h:72
RPC_SYNTAX_IDENTIFIER abstract_syntax
Definition: rpc_defs.h:71
unsigned char num_syntaxes
Definition: rpc_defs.h:69
LPSTR NetworkAddr
Definition: rpc_binding.h:67
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
struct _RpcBinding * server_binding
Definition: rpc_binding.h:96
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71

Referenced by process_bind_packet().

◆ process_request_packet()

static RPC_STATUS process_request_packet ( RpcConnection conn,
RpcPktRequestHdr hdr,
RPC_MESSAGE msg 
)
static

Definition at line 362 of file rpc_server.c.

363{
365 RpcPktHdr *response = NULL;
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 */
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));
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
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}
#define __TRY
Definition: compat.h:80
#define __ENDTRY
Definition: compat.h:82
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum func
Definition: glext.h:6028
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define exception
Definition: math.h:26
#define NCA_S_UNK_IF
Definition: ncastatus.h:25
#define NCA_S_OP_RNG_ERROR
Definition: ncastatus.h:24
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define __EXCEPT_ALL
Definition: exception.h:87
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
Definition: rpc_assoc.c:563
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid)
Definition: rpc_binding.c:224
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:1016
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:964
#define RPC_FLG_OBJECT_UUID
Definition: rpc_defs.h:181
RpcPktHdr * RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status)
Definition: rpc_message.c:170
NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status)
Definition: rpc_message.c:408
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength)
Definition: rpc_message.c:1223
RpcPktHdr * RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength)
Definition: rpc_message.c:154
#define RPC_IF_OLE
Definition: rpcdce.h:314
void(__RPC_STUB * RPC_DISPATCH_FUNCTION)(PRPC_MESSAGE Message)
Definition: rpcdcep.h:82
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:724
#define GetExceptionCode()
Definition: seh.h:27
unsigned int DispatchTableCount
Definition: rpcdcep.h:87
RPC_DISPATCH_FUNCTION * DispatchTable
Definition: rpcdcep.h:88
PRPC_DISPATCH_TABLE DispatchTable
Definition: rpcdcep.h:106
RPC_SERVER_INTERFACE * If
Definition: rpc_server.h:66
RPC_MGR_EPV * MgrEpv
Definition: rpc_server.h:68
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define ERROR_NOACCESS
Definition: winerror.h:578

Referenced by RPCRT4_process_packet().

◆ RpcMgmtEnableIdleCleanup()

RPC_STATUS WINAPI RpcMgmtEnableIdleCleanup ( void  )

Definition at line 1611 of file rpc_server.c.

1612{
1613 FIXME("(): stub\n");
1614 return RPC_S_OK;
1615}

◆ RpcMgmtEpEltInqBegin()

RPC_STATUS WINAPI RpcMgmtEpEltInqBegin ( RPC_BINDING_HANDLE  Binding,
ULONG  InquiryType,
RPC_IF_ID IfId,
ULONG  VersOption,
UUID ObjectUuid,
RPC_EP_INQ_HANDLE InquiryContext 
)

Definition at line 1693 of file rpc_server.c.

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}
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013

◆ RpcMgmtInqIfIds()

RPC_STATUS WINAPI RpcMgmtInqIfIds ( RPC_BINDING_HANDLE  Binding,
RPC_IF_ID_VECTOR **  IfIdVector 
)

Definition at line 1650 of file rpc_server.c.

1651{
1652 FIXME("(%p,%p): stub\n", Binding, IfIdVector);
1653 return RPC_S_INVALID_BINDING;
1654}

◆ RpcMgmtInqStats()

RPC_STATUS WINAPI RpcMgmtInqStats ( RPC_BINDING_HANDLE  Binding,
RPC_STATS_VECTOR **  Statistics 
)

Definition at line 1659 of file rpc_server.c.

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 }
1673}
unsigned int Count
Definition: rpcdce.h:84
ULONG Stats[1]
Definition: rpcdce.h:85

◆ RpcMgmtIsServerListening()

RPC_STATUS WINAPI RpcMgmtIsServerListening ( RPC_BINDING_HANDLE  Binding)

Definition at line 1704 of file rpc_server.c.

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}
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN
static BOOL std_listen
Definition: rpc_server.c:100
static HANDLE listen_done_event
Definition: rpc_server.c:104
static CRITICAL_SECTION listen_cs
Definition: rpc_server.c:81
LPSTR Endpoint
Definition: rpc_binding.h:132
LPSTR Protseq
Definition: rpc_binding.h:130
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1026

Referenced by _test_is_server_listening(), and _test_is_server_listening2().

◆ RpcMgmtSetAuthorizationFn()

RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn ( RPC_MGMT_AUTHORIZATION_FN  fn)

Definition at line 1725 of file rpc_server.c.

1726{
1727 FIXME("(%p): stub\n", fn);
1728 return RPC_S_OK;
1729}
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159

◆ RpcMgmtSetServerStackSize()

RPC_STATUS WINAPI RpcMgmtSetServerStackSize ( ULONG  ThreadStackSize)

Definition at line 1734 of file rpc_server.c.

1735{
1736 FIXME("(0x%x): stub\n", ThreadStackSize);
1737 return RPC_S_OK;
1738}

Referenced by CallPerInstanceInitFunctions().

◆ RpcMgmtStatsVectorFree()

RPC_STATUS WINAPI RpcMgmtStatsVectorFree ( RPC_STATS_VECTOR **  StatsVector)

Definition at line 1678 of file rpc_server.c.

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}

◆ RpcMgmtStopServerListening()

RPC_STATUS WINAPI RpcMgmtStopServerListening ( RPC_BINDING_HANDLE  Binding)

Definition at line 1596 of file rpc_server.c.

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}
static RPC_STATUS RPCRT4_stop_listen(BOOL auto_listen)
Definition: rpc_server.c:779
#define RPC_S_WRONG_KIND_OF_BINDING
Definition: winerror.h:1012

Referenced by _ServiceControlHandlerEx(), RpcpStopRpcServer(), RpcpStopRpcServerEx(), s_stop(), SamrShutdownSamServer(), service_handler(), ServiceControlHandler(), test_rpc_ncacn_ip_tcp(), test_server_listening(), and test_stop_wait_for_call().

◆ RpcMgmtWaitServerListen()

RPC_STATUS WINAPI RpcMgmtWaitServerListen ( void  )

Definition at line 1539 of file rpc_server.c.

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}
DWORD WINAPI GetThreadId(IN HANDLE Thread)
Definition: thread.c:913
#define INFINITE
Definition: serial.h:102
struct _cl_event * event
Definition: glext.h:7739
uint32_t entry
Definition: isohybrid.c:63
static LONG listen_count
Definition: rpc_server.c:102
static CRITICAL_SECTION server_cs
Definition: rpc_server.c:72
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
HANDLE server_thread
Definition: rpc_server.h:41
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82

Referenced by RpcpStopRpcServer(), RpcpStopRpcServerEx(), RpcServerListen(), run_server(), server(), test_rpc_ncacn_ip_tcp(), test_server_listening(), and wait_listen_proc().

◆ RpcObjectSetType()

RPC_STATUS WINAPI RpcObjectSetType ( UUID ObjUuid,
UUID TypeUuid 
)

Definition at line 1281 of file rpc_server.c.

1282{
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;
1306 }
1307 } else {
1308 /* ... , fail if we found it ... */
1309 if (map)
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
1320 }
1321
1322 return RPC_S_OK;
1323}
struct define * next
Definition: compiler.c:65
#define RPC_S_ALREADY_REGISTERED
Definition: winerror.h:1022
#define RPC_S_INVALID_OBJECT
Definition: winerror.h:1142

◆ RPCRT4_destroy_all_protseqs()

void RPCRT4_destroy_all_protseqs ( void  )

Definition at line 1094 of file rpc_server.c.

1095{
1096 RpcServerProtseq *cps, *cursor2;
1097
1098 if (listen_count != 0)
1099 std_listen = FALSE;
1100
1103 {
1104 if (listen_count != 0)
1107 }
1111}
static void RPCRT4_sync_with_server_thread(RpcServerProtseq *ps)
Definition: rpc_server.c:708
static void destroy_serverprotoseq(RpcServerProtseq *ps)
Definition: rpc_server.c:975
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by DllMain().

◆ RPCRT4_find_interface()

static RpcServerInterface * RPCRT4_find_interface ( UUID object,
const RPC_SYNTAX_IDENTIFIER if_id,
const RPC_SYNTAX_IDENTIFIER transfer_syntax,
BOOL  check_object 
)
static

Definition at line 130 of file rpc_server.c.

134{
135 UUID* MgrType = NULL;
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,
156 return cif;
157}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define InterlockedIncrement
Definition: armddk.h:53
static struct list server_interfaces
Definition: rpc_server.c:69
static UUID * LookupObjType(UUID *ObjUuid)
Definition: rpc_server.c:121
int WINAPI UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
Definition: rpcrt4_main.c:252
RPC_SYNTAX_IDENTIFIER InterfaceId
Definition: rpcdcep.h:104
RPC_SYNTAX_IDENTIFIER TransferSyntax
Definition: rpcdcep.h:105
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
unsigned short MajorVersion
Definition: rpcdcep.h:27
unsigned short MinorVersion
Definition: rpcdcep.h:28
struct list entry
Definition: rpc_server.h:65

Referenced by process_bind_packet_no_send(), and process_request_packet().

◆ RPCRT4_get_or_create_serverprotseq()

static RPC_STATUS RPCRT4_get_or_create_serverprotseq ( UINT  MaxCalls,
const char Protseq,
RpcServerProtseq **  ps 
)
static

Definition at line 987 of file rpc_server.c.

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}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define S_OK
Definition: intsafe.h:52
static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
Definition: rpc_server.c:946

Referenced by RpcServerUseProtseqA(), RpcServerUseProtseqEpExA(), RpcServerUseProtseqEpExW(), and RpcServerUseProtseqW().

◆ RPCRT4_io_thread()

static DWORD CALLBACK RPCRT4_io_thread ( LPVOID  the_arg)
static

Definition at line 543 of file rpc_server.c.

544{
545 RpcConnection* conn = the_arg;
546 RpcPktHdr *hdr;
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);
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);
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);
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 }
620exit:
622 return 0;
623}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI QueueUserWorkItem(IN LPTHREAD_START_ROUTINE Function, IN PVOID Context, IN ULONG Flags)
Definition: thread.c:1076
RpcConnection * RPCRT4_GrabConnection(RpcConnection *conn) DECLSPEC_HIDDEN
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
@ PKT_REQUEST
Definition: rpc_defs.h:188
@ PKT_BIND
Definition: rpc_defs.h:199
@ PKT_AUTH3
Definition: rpc_defs.h:204
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 process_auth3_packet(RpcConnection *conn, RpcPktCommonHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
Definition: rpc_server.c:475
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
static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
Definition: rpc_server.c:533
#define exit(n)
Definition: config.h:202
Definition: dhcpd.h:135
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WT_EXECUTELONGFUNCTION
Definition: winnt_old.h:1043

Referenced by RPCRT4_new_client().

◆ RPCRT4_new_client()

void RPCRT4_new_client ( RpcConnection conn)

Definition at line 625 of file rpc_server.c.

626{
628 if (!thread) {
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
639}
static HANDLE thread
Definition: service.c:33
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:137
unsigned long DWORD
Definition: ntddk_ex.h:95
#define err(...)
static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
Definition: rpc_server.c:543

Referenced by rpcrt4_protseq_np_wait_for_new_connection(), and rpcrt4_protseq_sock_wait_for_new_connection().

◆ RPCRT4_process_packet()

static void RPCRT4_process_packet ( RpcConnection conn,
RpcPktHdr hdr,
RPC_MESSAGE msg,
unsigned char auth_data,
ULONG  auth_length 
)
static

Definition at line 500 of file rpc_server.c.

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);
530 HeapFree(GetProcessHeap(), 0, auth_data);
531}
switch(r->id)
Definition: btrfs.c:3046
static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *hdr, RPC_MESSAGE *msg)
Definition: rpc_server.c:362
I_RPC_HANDLE RPC_BINDING_HANDLE
Definition: rpcdce.h:50

Referenced by RPCRT4_worker_thread().

◆ RPCRT4_protseq_is_endpoint_registered()

static BOOL RPCRT4_protseq_is_endpoint_registered ( RpcServerProtseq protseq,
const char endpoint 
)
static

Definition at line 817 of file rpc_server.c.

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}
struct list listeners
Definition: rpc_server.h:36
Definition: nis.h:10

Referenced by RPCRT4_use_protseq().

◆ RPCRT4_release_server_interface()

static void RPCRT4_release_server_interface ( RpcServerInterface sif)
static

Definition at line 159 of file rpc_server.c.

160{
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}
#define InterlockedDecrement
Definition: armddk.h:52
HANDLE CallsCompletedEvent
Definition: rpc_server.h:76
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733

Referenced by process_bind_packet_no_send(), and process_request_packet().

◆ RPCRT4_server_thread()

static DWORD CALLBACK RPCRT4_server_thread ( LPVOID  the_arg)
static

Definition at line 641 of file rpc_server.c.

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
678 LIST_FOR_EACH_ENTRY(conn, &cps->listeners, RpcConnection, protseq_entry)
680 LIST_FOR_EACH_ENTRY(conn, &cps->connections, RpcConnection, protseq_entry)
681 {
684 }
686
687 if (res == 0 && !std_listen)
689
690 TRACE("waiting for active connections to close\n");
691
693 while (!list_empty(&cps->connections))
694 {
695 conn = LIST_ENTRY(list_head(&cps->connections), RpcConnection, protseq_entry);
699 }
701
702 TRACE("done\n");
703 return 0;
704}
static int list_empty(struct list_entry *head)
Definition: list.h:58
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint res
Definition: glext.h:9613
static void rpcrt4_conn_close_read(RpcConnection *connection)
Definition: rpc_binding.h:205
void rpcrt4_conn_release_and_wait(RpcConnection *connection) DECLSPEC_HIDDEN
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
const struct protseq_ops * ops
Definition: rpc_server.h:31
struct list connections
Definition: rpc_server.h:37
Definition: list.h:15
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by RPCRT4_start_listen_protseq().

◆ RPCRT4_ServerFreeAllRegisteredAuthInfo()

void RPCRT4_ServerFreeAllRegisteredAuthInfo ( void  )

Definition at line 1396 of file rpc_server.c.

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}
static struct list server_registered_auth_info
Definition: rpc_server.c:70
static CRITICAL_SECTION server_auth_info_cs
Definition: rpc_server.c:90

Referenced by DllMain().

◆ RPCRT4_ServerGetRegisteredAuthInfo()

RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo ( USHORT  auth_type,
CredHandle cred,
TimeStamp exp,
ULONG max_token 
)

Definition at line 1365 of file rpc_server.c.

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}
DWORD exp
Definition: msg.c:16058
#define SECPKG_CRED_INBOUND
Definition: sspi.h:290
WCHAR SEC_WCHAR
Definition: sspi.h:29
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

Referenced by RPCRT4_ServerConnectionAuth().

◆ RPCRT4_start_listen()

static RPC_STATUS RPCRT4_start_listen ( BOOL  auto_listen)
static

Definition at line 741 of file rpc_server.c.

742{
744 RpcServerProtseq *cps;
745
746 TRACE("\n");
747
749 if (auto_listen || !listen_done_event)
750 {
752 if(!auto_listen)
754 if (++listen_count == 1)
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}
static RPC_STATUS RPCRT4_start_listen_protseq(RpcServerProtseq *ps, BOOL auto_listen)
Definition: rpc_server.c:723
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define RPC_S_ALREADY_LISTENING
Definition: winerror.h:1024

Referenced by RpcServerListen(), and RpcServerRegisterIf3().

◆ RPCRT4_start_listen_protseq()

static RPC_STATUS RPCRT4_start_listen_protseq ( RpcServerProtseq ps,
BOOL  auto_listen 
)
static

Definition at line 723 of file rpc_server.c.

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
736done:
738 return status;
739}
static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg)
Definition: rpc_server.c:641
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576

Referenced by RPCRT4_start_listen(), and RPCRT4_use_protseq().

◆ RPCRT4_stop_listen()

static RPC_STATUS RPCRT4_stop_listen ( BOOL  auto_listen)
static

Definition at line 779 of file rpc_server.c.

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)
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}
#define assert(x)
Definition: debug.h:53

Referenced by RpcMgmtStopServerListening().

◆ RPCRT4_sync_with_server_thread()

static void RPCRT4_sync_with_server_thread ( RpcServerProtseq ps)
static

Definition at line 708 of file rpc_server.c.

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
721}
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:618

Referenced by RPCRT4_destroy_all_protseqs(), RPCRT4_start_listen(), RPCRT4_stop_listen(), and RPCRT4_use_protseq().

◆ RPCRT4_use_protseq()

static RPC_STATUS RPCRT4_use_protseq ( RpcServerProtseq ps,
const char endpoint 
)
static

Definition at line 832 of file rpc_server.c.

833{
835
837
840 else
841 status = ps->ops->open_endpoint(ps, endpoint);
842
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}
static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint)
Definition: rpc_server.c:817

Referenced by RpcServerUseProtseqA(), RpcServerUseProtseqEpExA(), RpcServerUseProtseqEpExW(), and RpcServerUseProtseqW().

◆ RPCRT4_worker_thread()

static DWORD CALLBACK RPCRT4_worker_thread ( LPVOID  the_arg)
static

Definition at line 533 of file rpc_server.c.

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}
static void RPCRT4_process_packet(RpcConnection *conn, RpcPktHdr *hdr, RPC_MESSAGE *msg, unsigned char *auth_data, ULONG auth_length)
Definition: rpc_server.c:500
ULONG auth_length
Definition: rpc_server.c:54
struct _RpcConnection * conn
Definition: rpc_server.c:50
RPC_MESSAGE * msg
Definition: rpc_server.c:52
RpcPktHdr * hdr
Definition: rpc_server.c:51
unsigned char * auth_data
Definition: rpc_server.c:53

Referenced by RPCRT4_io_thread().

◆ RpcServerInqBindings()

RPC_STATUS WINAPI RpcServerInqBindings ( RPC_BINDING_VECTOR **  BindingVector)

Definition at line 861 of file rpc_server.c.

862{
864 DWORD count;
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;
878 LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry)
879 count++;
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;
891 LIST_FOR_EACH_ENTRY(conn, &ps->listeners, RpcConnection, protseq_entry) {
892 RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count],
893 conn);
894 count++;
895 }
897 }
899 } else {
900 *BindingVector = NULL;
902 }
904 return status;
905}
#define RPC_S_NO_BINDINGS
Definition: winerror.h:1029

Referenced by test_endpoint_mapper(), and test_RpcServerUseProtseq().

◆ RpcServerInqDefaultPrincNameA()

RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameA ( ULONG  AuthnSvc,
RPC_CSTR PrincName 
)

Definition at line 1481 of file rpc_server.c.

1482{
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}
LPSTR RPCRT4_strdupWtoA(LPCWSTR src)
Definition: rpc_binding.c:58
RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW(ULONG AuthnSvc, RPC_WSTR *PrincName)
Definition: rpc_server.c:1499
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
unsigned char * RPC_CSTR
Definition: rpcdce.h:45
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:175

Referenced by test_RpcServerInqDefaultPrincName().

◆ RpcServerInqDefaultPrincNameW()

RPC_STATUS RPC_ENTRY RpcServerInqDefaultPrincNameW ( ULONG  AuthnSvc,
RPC_WSTR PrincName 
)

Definition at line 1499 of file rpc_server.c.

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}
#define ERROR_MORE_DATA
Definition: dderror.h:13
GLenum GLsizei len
Definition: glext.h:6722
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158
BOOLEAN WINAPI GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:1079
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1074
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by RpcServerInqDefaultPrincNameA().

◆ RpcServerListen()

RPC_STATUS WINAPI RpcServerListen ( UINT  MinimumCallThreads,
UINT  MaxCalls,
UINT  DontWait 
)

Definition at line 1520 of file rpc_server.c.

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}
RPC_STATUS WINAPI RpcMgmtWaitServerListen(void)
Definition: rpc_server.c:1539
static RPC_STATUS RPCRT4_start_listen(BOOL auto_listen)
Definition: rpc_server.c:741
#define RPC_S_NO_PROTSEQS_REGISTERED
Definition: winerror.h:1025

Referenced by LrpcThreadProc(), LsarStartRpcServer(), main(), RpcpStartRpcServer(), RpcServerThread(), RPCSS_Initialize(), RpcThreadRoutine(), run_server(), SampStartRpcServer(), ScmStartRpcServer(), server(), StartRpcServer(), test_ndr_buffer(), test_rpc_ncacn_ip_tcp(), test_server_listening(), and test_stop_wait_for_call().

◆ RpcServerRegisterAuthInfoA()

RPC_STATUS WINAPI RpcServerRegisterAuthInfoA ( RPC_CSTR  ServerPrincName,
ULONG  AuthnSvc,
RPC_AUTH_KEY_RETRIEVAL_FN  GetKeyFn,
LPVOID  Arg 
)

Definition at line 1414 of file rpc_server.c.

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)))
1424
1425 status = RpcServerRegisterAuthInfoW(principal_name, AuthnSvc, GetKeyFn, Arg);
1426
1427 HeapFree(GetProcessHeap(), 0, principal_name);
1428 return status;
1429}
LPWSTR RPCRT4_strdupAtoW(LPCSTR src)
Definition: rpc_binding.c:69
RPC_STATUS WINAPI RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg)
Definition: rpc_server.c:1434

Referenced by test_RpcServerInqDefaultPrincName().

◆ RpcServerRegisterAuthInfoW()

RPC_STATUS WINAPI RpcServerRegisterAuthInfoW ( RPC_WSTR  ServerPrincName,
ULONG  AuthnSvc,
RPC_AUTH_KEY_RETRIEVAL_FN  GetKeyFn,
LPVOID  Arg 
)

Definition at line 1434 of file rpc_server.c.

1436{
1437 struct rpc_server_registered_auth_info *auth_info;
1438 SecPkgInfoW *packages, *package;
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)
1454
1455 auth_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*auth_info));
1456 if (!auth_info) {
1459 }
1460
1461 if (ServerPrincName && !(auth_info->principal = RPCRT4_strdupW(ServerPrincName))) {
1463 HeapFree(GetProcessHeap(), 0, auth_info);
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}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static RPC_STATUS find_security_package(ULONG auth_type, SecPkgInfoW **packages_buf, SecPkgInfoW **ret)
Definition: rpc_server.c:1334
ULONG cbMaxToken
Definition: sspi.h:117
SEC_WCHAR * Name
Definition: sspi.h:118

Referenced by RpcServerRegisterAuthInfoA(), and test_RpcServerRegisterAuthInfo().

◆ RpcServerRegisterIf()

RPC_STATUS WINAPI RpcServerRegisterIf ( RPC_IF_HANDLE  IfSpec,
UUID MgrTypeUuid,
RPC_MGR_EPV MgrEpv 
)

Definition at line 1116 of file rpc_server.c.

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}
unsigned int UINT
Definition: ndis.h:50
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
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122

Referenced by DsSetupInit(), LrpcThreadProc(), LsarStartRpcServer(), main(), RpcpAddInterface(), RpcServerThread(), RPCSS_Initialize(), RpcThreadRoutine(), run_server(), SampStartRpcServer(), ScmStartRpcServer(), server(), StartRpcServer(), test_endpoint_mapper(), test_ndr_buffer(), test_rpc_ncacn_ip_tcp(), and test_server_listening().

◆ RpcServerRegisterIf2()

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 at line 1135 of file rpc_server.c.

1137{
1138 return RpcServerRegisterIf3( IfSpec, MgrTypeUuid, MgrEpv, Flags, MaxCalls, MaxRpcSize, IfCallbackFn, NULL );
1139}
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

◆ RpcServerRegisterIf3()

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 at line 1144 of file rpc_server.c.

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
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}
#define RPC_IF_AUTOLISTEN
Definition: rpcdce.h:313
LONG_PTR Reserved
Definition: rpcdcep.h:89
unsigned int RpcProtseqEndpointCount
Definition: rpcdcep.h:107
RPC_MGR_EPV * DefaultManagerEpv
Definition: rpcdcep.h:109
void const * InterpreterInfo
Definition: rpcdcep.h:110
RPC_IF_CALLBACK_FN * IfCallbackFn
Definition: rpc_server.h:72
_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:191

Referenced by RpcServerRegisterIf(), RpcServerRegisterIf2(), and RpcServerRegisterIfEx().

◆ RpcServerRegisterIfEx()

RPC_STATUS WINAPI RpcServerRegisterIfEx ( RPC_IF_HANDLE  IfSpec,
UUID MgrTypeUuid,
RPC_MGR_EPV MgrEpv,
UINT  Flags,
UINT  MaxCalls,
RPC_IF_CALLBACK_FN IfCallbackFn 
)

Definition at line 1125 of file rpc_server.c.

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}

Referenced by do_msidbCustomActionTypeDll(), and RPC_RegisterInterface().

◆ RpcServerUnregisterIf()

RPC_STATUS WINAPI RpcServerUnregisterIf ( RPC_IF_HANDLE  IfSpec,
UUID MgrTypeUuid,
UINT  WaitForCallsToComplete 
)

Definition at line 1202 of file rpc_server.c.

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)
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 */
1245 }
1246
1247 return RPC_S_OK;
1248}
#define RPC_S_UNKNOWN_IF
Definition: winerror.h:1028

Referenced by MSI_FreePackage(), RPC_UnregisterInterface(), RpcpStopRpcServer(), RPCSS_Initialize(), s_stop(), s_stop_autolisten(), server(), service_handler(), test_endpoint_mapper(), test_ndr_buffer(), and test_rpc_ncacn_ip_tcp().

◆ RpcServerUnregisterIfEx()

RPC_STATUS WINAPI RpcServerUnregisterIfEx ( RPC_IF_HANDLE  IfSpec,
UUID MgrTypeUuid,
int  RundownContextHandles 
)

Definition at line 1253 of file rpc_server.c.

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}

Referenced by RpcpStopRpcServerEx().

◆ RpcServerUseProtseqA()

RPC_STATUS WINAPI RpcServerUseProtseqA ( RPC_CSTR  Protseq,
unsigned int  MaxCalls,
void SecurityDescriptor 
)

Definition at line 1060 of file rpc_server.c.

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}
static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps)
Definition: rpc_server.c:987
static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq *ps, const char *endpoint)
Definition: rpc_server.c:832

Referenced by test_RpcServerUseProtseq().

◆ RpcServerUseProtseqEpA()

RPC_STATUS WINAPI RpcServerUseProtseqEpA ( RPC_CSTR  Protseq,
UINT  MaxCalls,
RPC_CSTR  Endpoint,
LPVOID  SecurityDescriptor 
)

Definition at line 910 of file rpc_server.c.

911{
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}
WDF_INTERRUPT_POLICY policy
RPC_STATUS WINAPI RpcServerUseProtseqEpExA(RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
Definition: rpc_server.c:1013

Referenced by run_server(), server(), test_ndr_buffer(), test_rpc_ncacn_ip_tcp(), test_RpcServerUseProtseq(), and test_server_listening().

◆ RpcServerUseProtseqEpExA()

RPC_STATUS WINAPI RpcServerUseProtseqEpExA ( RPC_CSTR  Protseq,
UINT  MaxCalls,
RPC_CSTR  Endpoint,
LPVOID  SecurityDescriptor,
PRPC_POLICY  lpPolicy 
)

Definition at line 1013 of file rpc_server.c.

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}
unsigned int Length
Definition: rpcdce.h:216
ULONG EndpointFlags
Definition: rpcdce.h:217
ULONG NICFlags
Definition: rpcdce.h:218

Referenced by RpcServerUseProtseqEpA().

◆ RpcServerUseProtseqEpExW()

RPC_STATUS WINAPI RpcServerUseProtseqEpExW ( RPC_WSTR  Protseq,
UINT  MaxCalls,
RPC_WSTR  Endpoint,
LPVOID  SecurityDescriptor,
PRPC_POLICY  lpPolicy 
)

Definition at line 1033 of file rpc_server.c.

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}
char * LPSTR
Definition: xmlstorage.h:182

Referenced by RpcServerUseProtseqEpW().

◆ RpcServerUseProtseqEpW()

RPC_STATUS WINAPI RpcServerUseProtseqEpW ( RPC_WSTR  Protseq,
UINT  MaxCalls,
RPC_WSTR  Endpoint,
LPVOID  SecurityDescriptor 
)

Definition at line 927 of file rpc_server.c.

928{
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}
RPC_STATUS WINAPI RpcServerUseProtseqEpExW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy)
Definition: rpc_server.c:1033

Referenced by do_msidbCustomActionTypeDll(), LrpcThreadProc(), LsarStartRpcServer(), RPC_StartRemoting(), RpcpAddInterface(), RpcServerThread(), RPCSS_Initialize(), RpcThreadRoutine(), SampStartRpcServer(), ScmStartRpcServer(), and StartRpcServer().

◆ RpcServerUseProtseqW()

RPC_STATUS WINAPI RpcServerUseProtseqW ( RPC_WSTR  Protseq,
unsigned int  MaxCalls,
void SecurityDescriptor 
)

Definition at line 1077 of file rpc_server.c.

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}

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( rpc  )

Variable Documentation

◆ listen_count

LONG listen_count
static

◆ listen_cs

◆ listen_cs_debug

CRITICAL_SECTION_DEBUG listen_cs_debug
static
Initial value:
=
{
0, 0, &listen_cs,
0, 0, { (DWORD_PTR)(__FILE__ ": listen_cs") }
}
static CRITICAL_SECTION_DEBUG listen_cs_debug
Definition: rpc_server.c:82
LIST_ENTRY ProcessLocksList
Definition: winbase.h:883

Definition at line 82 of file rpc_server.c.

◆ listen_done_event

HANDLE listen_done_event
static

◆ protseqs

◆ RpcObjTypeMaps

RpcObjTypeMap* RpcObjTypeMaps
static

Definition at line 65 of file rpc_server.c.

Referenced by LookupObjTypeMap(), and RpcObjectSetType().

◆ server_auth_info_cs

static CRITICAL_SECTION server_auth_info_cs = { &server_auth_info_cs_debug, -1, 0, 0, 0, 0 }
static

◆ server_auth_info_cs_debug

CRITICAL_SECTION_DEBUG server_auth_info_cs_debug
static
Initial value:
=
{
0, 0, { (DWORD_PTR)(__FILE__ ": server_auth_info_cs") }
}
static CRITICAL_SECTION_DEBUG server_auth_info_cs_debug
Definition: rpc_server.c:91

Definition at line 91 of file rpc_server.c.

◆ server_cs

◆ server_cs_debug

CRITICAL_SECTION_DEBUG server_cs_debug
static
Initial value:
=
{
0, 0, &server_cs,
0, 0, { (DWORD_PTR)(__FILE__ ": server_cs") }
}
static CRITICAL_SECTION_DEBUG server_cs_debug
Definition: rpc_server.c:73

Definition at line 73 of file rpc_server.c.

◆ server_interfaces

struct list server_interfaces = LIST_INIT(server_interfaces)
static

Definition at line 69 of file rpc_server.c.

Referenced by RPCRT4_find_interface(), RpcServerRegisterIf3(), and RpcServerUnregisterIf().

◆ server_registered_auth_info

struct list server_registered_auth_info = LIST_INIT(server_registered_auth_info)
static

◆ std_listen

◆ uuid_nil

UUID uuid_nil
static

Definition at line 106 of file rpc_server.c.

Referenced by LookupObjType().