ReactOS  0.4.13-dev-73-gcfe54aa
rpc_assoc.h File Reference
#include "rpc_binding.h"
#include "wine/list.h"
Include dependency graph for rpc_assoc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RpcAssoc
 

Typedefs

typedef struct _RpcAssoc RpcAssoc
 

Functions

RPC_STATUS RPCRT4_GetAssociation (LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc) DECLSPEC_HIDDEN
 
RPC_STATUS RpcAssoc_GetClientConnection (RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth, RpcConnection **Connection, BOOL *from_cache) DECLSPEC_HIDDEN
 
void RpcAssoc_ReleaseIdleConnection (RpcAssoc *assoc, RpcConnection *Connection) DECLSPEC_HIDDEN
 
ULONG RpcAssoc_Release (RpcAssoc *assoc) DECLSPEC_HIDDEN
 
RPC_STATUS RpcServerAssoc_GetAssociation (LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out) DECLSPEC_HIDDEN
 
RPC_STATUS RpcServerAssoc_AllocateContextHandle (RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN
 
RPC_STATUS RpcServerAssoc_FindContextHandle (RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN
 
RPC_STATUS RpcServerAssoc_UpdateContextHandle (RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine) DECLSPEC_HIDDEN
 
unsigned int RpcServerAssoc_ReleaseContextHandle (RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock) DECLSPEC_HIDDEN
 
void RpcContextHandle_GetUuid (NDR_SCONTEXT SContext, UUID *uuid) DECLSPEC_HIDDEN
 
BOOL RpcContextHandle_IsGuardCorrect (NDR_SCONTEXT SContext, void *CtxGuard) DECLSPEC_HIDDEN
 
void RpcAssoc_ConnectionReleased (RpcAssoc *assoc) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ RpcAssoc

Function Documentation

◆ RpcAssoc_ConnectionReleased()

void RpcAssoc_ConnectionReleased ( RpcAssoc assoc)

Definition at line 448 of file rpc_assoc.c.

449 {
451  return;
452 
453  TRACE("Last %p connection released\n", assoc);
454  assoc->assoc_group_id = 0;
455 }
LONG connection_cnt
Definition: rpc_assoc.h:46
ULONG assoc_group_id
Definition: rpc_assoc.h:38
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52

Referenced by RPCRT4_ReleaseConnection().

◆ RpcAssoc_GetClientConnection()

RPC_STATUS RpcAssoc_GetClientConnection ( RpcAssoc assoc,
const RPC_SYNTAX_IDENTIFIER InterfaceId,
const RPC_SYNTAX_IDENTIFIER TransferSyntax,
RpcAuthInfo AuthInfo,
RpcQualityOfService QOS,
LPCWSTR  CookieAuth,
RpcConnection **  Connection,
BOOL from_cache 
)

Definition at line 391 of file rpc_assoc.c.

396 {
397  RpcConnection *NewConnection;
399 
400  *Connection = RpcAssoc_GetIdleConnection(assoc, InterfaceId, TransferSyntax, AuthInfo, QOS);
401  if (*Connection) {
402  TRACE("return idle connection %p for association %p\n", *Connection, assoc);
403  if (from_cache) *from_cache = TRUE;
404  return RPC_S_OK;
405  }
406 
407  /* create a new connection */
408  status = RPCRT4_CreateConnection(&NewConnection, FALSE /* is this a server connection? */,
409  assoc->Protseq, assoc->NetworkAddr,
410  assoc->Endpoint, assoc->NetworkOptions,
411  AuthInfo, QOS, CookieAuth);
412  if (status != RPC_S_OK)
413  return status;
414 
415  NewConnection->assoc = assoc;
416  status = RPCRT4_OpenClientConnection(NewConnection);
417  if (status != RPC_S_OK)
418  {
419  RPCRT4_ReleaseConnection(NewConnection);
420  return status;
421  }
422 
423  status = RpcAssoc_BindConnection(assoc, NewConnection, InterfaceId, TransferSyntax);
424  if (status != RPC_S_OK)
425  {
426  RPCRT4_ReleaseConnection(NewConnection);
427  return status;
428  }
429 
431 
432  TRACE("return new connection %p for association %p\n", *Connection, assoc);
433  *Connection = NewConnection;
434  if (from_cache) *from_cache = FALSE;
435  return RPC_S_OK;
436 }
#define TRUE
Definition: types.h:120
long RPC_STATUS
Definition: rpc.h:52
LPSTR Endpoint
Definition: rpc_assoc.h:34
LONG connection_cnt
Definition: rpc_assoc.h:46
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
static RpcConnection * RpcAssoc_GetIdleConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RpcAuthInfo *AuthInfo, const RpcQualityOfService *QOS)
Definition: rpc_assoc.c:365
#define InterlockedIncrement
Definition: armddk.h:53
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *conn, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax)
Definition: rpc_assoc.c:230
static SERVICE_STATUS status
Definition: service.c:31
struct _RpcAssoc * assoc
Definition: rpc_binding.h:88
#define RPC_S_OK
Definition: rpcnterr.h:22
LPSTR Protseq
Definition: rpc_assoc.h:32
Definition: ps.c:97

Referenced by RPCRT4_OpenBinding().

◆ RpcAssoc_Release()

ULONG RpcAssoc_Release ( RpcAssoc assoc)

Definition at line 188 of file rpc_assoc.c.

189 {
190  ULONG refs;
191 
193  refs = --assoc->refs;
194  if (!refs)
195  list_remove(&assoc->entry);
197 
198  if (!refs)
199  {
200  RpcConnection *Connection, *cursor2;
201  RpcContextHandle *context_handle, *context_handle_cursor;
202 
203  TRACE("destroying assoc %p\n", assoc);
204 
205  LIST_FOR_EACH_ENTRY_SAFE(Connection, cursor2, &assoc->free_connection_pool, RpcConnection, conn_pool_entry)
206  {
207  list_remove(&Connection->conn_pool_entry);
208  RPCRT4_ReleaseConnection(Connection);
209  }
210 
211  LIST_FOR_EACH_ENTRY_SAFE(context_handle, context_handle_cursor, &assoc->context_handle_list, RpcContextHandle, entry)
212  RpcContextHandle_Destroy(context_handle);
213 
214  HeapFree(GetProcessHeap(), 0, assoc->NetworkOptions);
215  HeapFree(GetProcessHeap(), 0, assoc->Endpoint);
216  HeapFree(GetProcessHeap(), 0, assoc->NetworkAddr);
217  HeapFree(GetProcessHeap(), 0, assoc->Protseq);
218 
219  assoc->cs.DebugInfo->Spare[0] = 0;
220  DeleteCriticalSection(&assoc->cs);
221 
222  HeapFree(GetProcessHeap(), 0, assoc);
223  }
224 
225  return refs;
226 }
struct list entry
Definition: rpc_assoc.h:29
uint8_t entry
Definition: isohybrid.c:63
struct list context_handle_list
Definition: rpc_assoc.h:49
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct list conn_pool_entry
Definition: rpc_binding.h:85
LPSTR Endpoint
Definition: rpc_assoc.h:34
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
LONG refs
Definition: rpc_assoc.h:30
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list free_connection_pool
Definition: rpc_assoc.h:45
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
unsigned int ULONG
Definition: retypes.h:1
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
Definition: rpc_assoc.c:548
#define HeapFree(x, y, z)
Definition: compat.h:394
static CRITICAL_SECTION assoc_list_cs
Definition: rpc_assoc.c:38
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852
LPSTR Protseq
Definition: rpc_assoc.h:32

Referenced by RpcBindingReset(), RPCRT4_ReleaseBinding(), and RPCRT4_ResolveBinding().

◆ RpcAssoc_ReleaseIdleConnection()

void RpcAssoc_ReleaseIdleConnection ( RpcAssoc assoc,
RpcConnection Connection 
)

Definition at line 438 of file rpc_assoc.c.

439 {
440  assert(!Connection->server);
441  Connection->async_state = NULL;
442  EnterCriticalSection(&assoc->cs);
443  if (!assoc->assoc_group_id) assoc->assoc_group_id = Connection->assoc_group_id;
444  list_add_head(&assoc->free_connection_pool, &Connection->conn_pool_entry);
445  LeaveCriticalSection(&assoc->cs);
446 }
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
struct list conn_pool_entry
Definition: rpc_binding.h:85
ULONG assoc_group_id
Definition: rpc_assoc.h:38
smooth NULL
Definition: ftsmooth.c:416
ULONG assoc_group_id
Definition: rpc_binding.h:86
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
RPC_ASYNC_STATE * async_state
Definition: rpc_binding.h:87
struct list free_connection_pool
Definition: rpc_assoc.h:45
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by RPCRT4_CloseBinding().

◆ RpcContextHandle_GetUuid()

void RpcContextHandle_GetUuid ( NDR_SCONTEXT  SContext,
UUID uuid 
)

Definition at line 542 of file rpc_assoc.c.

543 {
544  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
545  *uuid = context_handle->uuid;
546 }
Definition: msctf.idl:510

Referenced by NDRSContextMarshall2().

◆ RpcContextHandle_IsGuardCorrect()

BOOL RpcContextHandle_IsGuardCorrect ( NDR_SCONTEXT  SContext,
void CtxGuard 
)

Definition at line 482 of file rpc_assoc.c.

483 {
484  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
485  return context_handle->ctx_guard == CtxGuard;
486 }
void * ctx_guard
Definition: rpc_assoc.c:57

Referenced by NDRSContextMarshall2(), RpcServerAssoc_FindContextHandle(), and RpcServerAssoc_UpdateContextHandle().

◆ RPCRT4_GetAssociation()

RPC_STATUS RPCRT4_GetAssociation ( LPCSTR  Protseq,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCWSTR  NetworkOptions,
RpcAssoc **  assoc 
)

Definition at line 99 of file rpc_assoc.c.

102 {
103  RpcAssoc *assoc;
105 
108  {
109  if (!strcmp(Protseq, assoc->Protseq) &&
110  !strcmp(NetworkAddr, assoc->NetworkAddr) &&
111  !strcmp(Endpoint, assoc->Endpoint) &&
112  compare_networkoptions(NetworkOptions, assoc->NetworkOptions))
113  {
114  assoc->refs++;
115  *assoc_out = assoc;
117  TRACE("using existing assoc %p\n", assoc);
118  return RPC_S_OK;
119  }
120  }
121 
122  status = RpcAssoc_Alloc(Protseq, NetworkAddr, Endpoint, NetworkOptions, &assoc);
123  if (status != RPC_S_OK)
124  {
126  return status;
127  }
129  *assoc_out = assoc;
130 
132 
133  TRACE("new assoc %p\n", assoc);
134 
135  return RPC_S_OK;
136 }
struct list entry
Definition: rpc_assoc.h:29
uint8_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
LPSTR Endpoint
Definition: rpc_assoc.h:34
static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
Definition: rpc_assoc.c:90
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
LONG refs
Definition: rpc_assoc.h:30
static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:65
static struct list client_assoc_list
Definition: rpc_assoc.c:47
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
static CRITICAL_SECTION assoc_list_cs
Definition: rpc_assoc.c:38
LPSTR Protseq
Definition: rpc_assoc.h:32
Definition: ps.c:97

Referenced by RPCRT4_CompleteBindingA(), RPCRT4_CompleteBindingW(), and RPCRT4_ResolveBinding().

◆ RpcServerAssoc_AllocateContextHandle()

RPC_STATUS RpcServerAssoc_AllocateContextHandle ( RpcAssoc assoc,
void CtxGuard,
NDR_SCONTEXT SContext 
)

Definition at line 457 of file rpc_assoc.c.

459 {
460  RpcContextHandle *context_handle;
461 
462  context_handle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context_handle));
463  if (!context_handle)
464  return RPC_S_OUT_OF_MEMORY;
465 
466  context_handle->ctx_guard = CtxGuard;
467  RtlInitializeResource(&context_handle->rw_lock);
468  context_handle->refs = 1;
469 
470  /* lock here to mirror unmarshall, so we don't need to special-case the
471  * freeing of a non-marshalled context handle */
472  RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
473 
474  EnterCriticalSection(&assoc->cs);
475  list_add_tail(&assoc->context_handle_list, &context_handle->entry);
476  LeaveCriticalSection(&assoc->cs);
477 
478  *SContext = (NDR_SCONTEXT)context_handle;
479  return RPC_S_OK;
480 }
#define TRUE
Definition: types.h:120
struct list context_handle_list
Definition: rpc_assoc.h:49
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
struct tagNDR_SCONTEXT * NDR_SCONTEXT
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
RTL_RWLOCK rw_lock
Definition: rpc_assoc.c:59
unsigned int refs
Definition: rpc_assoc.c:60
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
struct list entry
Definition: rpc_assoc.c:54
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void * ctx_guard
Definition: rpc_assoc.c:57
#define RPC_S_OK
Definition: rpcnterr.h:22
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

Referenced by NDRSContextUnmarshall2().

◆ RpcServerAssoc_FindContextHandle()

RPC_STATUS RpcServerAssoc_FindContextHandle ( RpcAssoc assoc,
const UUID uuid,
void CtxGuard,
ULONG  Flags,
NDR_SCONTEXT SContext 
)

Definition at line 488 of file rpc_assoc.c.

490 {
491  RpcContextHandle *context_handle;
492 
493  EnterCriticalSection(&assoc->cs);
495  {
496  if (RpcContextHandle_IsGuardCorrect((NDR_SCONTEXT)context_handle, CtxGuard) &&
497  !memcmp(&context_handle->uuid, uuid, sizeof(*uuid)))
498  {
499  *SContext = (NDR_SCONTEXT)context_handle;
500  if (context_handle->refs++)
501  {
502  LeaveCriticalSection(&assoc->cs);
503  TRACE("found %p\n", context_handle);
504  RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
505  return RPC_S_OK;
506  }
507  }
508  }
509  LeaveCriticalSection(&assoc->cs);
510 
511  ERR("no context handle found for uuid %s, guard %p\n",
512  debugstr_guid(uuid), CtxGuard);
513  return ERROR_INVALID_HANDLE;
514 }
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
uint8_t entry
Definition: isohybrid.c:63
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
struct list context_handle_list
Definition: rpc_assoc.h:49
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
struct tagNDR_SCONTEXT * NDR_SCONTEXT
#define ERR(fmt,...)
Definition: debug.h:109
Definition: msctf.idl:510
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard)
Definition: rpc_assoc.c:482
#define RPC_S_OK
Definition: rpcnterr.h:22
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)

Referenced by NDRSContextUnmarshall2().

◆ RpcServerAssoc_GetAssociation()

RPC_STATUS RpcServerAssoc_GetAssociation ( LPCSTR  Protseq,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCWSTR  NetworkOptions,
ULONG  assoc_gid,
RpcAssoc **  assoc_out 
)

Definition at line 138 of file rpc_assoc.c.

142 {
143  RpcAssoc *assoc;
145 
147  if (assoc_gid)
148  {
150  {
151  /* FIXME: NetworkAddr shouldn't be NULL */
152  if (assoc->assoc_group_id == assoc_gid &&
153  !strcmp(Protseq, assoc->Protseq) &&
154  (!NetworkAddr || !assoc->NetworkAddr || !strcmp(NetworkAddr, assoc->NetworkAddr)) &&
155  !strcmp(Endpoint, assoc->Endpoint) &&
156  ((!assoc->NetworkOptions == !NetworkOptions) &&
157  (!NetworkOptions || !strcmpW(NetworkOptions, assoc->NetworkOptions))))
158  {
159  assoc->refs++;
160  *assoc_out = assoc;
162  TRACE("using existing assoc %p\n", assoc);
163  return RPC_S_OK;
164  }
165  }
166  *assoc_out = NULL;
169  }
170 
171  status = RpcAssoc_Alloc(Protseq, NetworkAddr, Endpoint, NetworkOptions, &assoc);
172  if (status != RPC_S_OK)
173  {
175  return status;
176  }
179  *assoc_out = assoc;
180 
182 
183  TRACE("new assoc %p\n", assoc);
184 
185  return RPC_S_OK;
186 }
struct list entry
Definition: rpc_assoc.h:29
static LONG last_assoc_group_id
Definition: rpc_assoc.c:50
#define RPC_S_NO_CONTEXT_AVAILABLE
Definition: winerror.h:1073
static struct list server_assoc_list
Definition: rpc_assoc.c:48
uint8_t entry
Definition: isohybrid.c:63
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
LPSTR Endpoint
Definition: rpc_assoc.h:34
ULONG assoc_group_id
Definition: rpc_assoc.h:38
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
LONG refs
Definition: rpc_assoc.h:30
static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:65
#define InterlockedIncrement
Definition: armddk.h:53
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
static CRITICAL_SECTION assoc_list_cs
Definition: rpc_assoc.c:38
LPSTR Protseq
Definition: rpc_assoc.h:32
Definition: ps.c:97

Referenced by process_bind_packet_no_send().

◆ RpcServerAssoc_ReleaseContextHandle()

unsigned int RpcServerAssoc_ReleaseContextHandle ( RpcAssoc assoc,
NDR_SCONTEXT  SContext,
BOOL  release_lock 
)

Definition at line 564 of file rpc_assoc.c.

565 {
566  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
567  unsigned int refs;
568 
569  if (release_lock)
570  RtlReleaseResource(&context_handle->rw_lock);
571 
572  EnterCriticalSection(&assoc->cs);
573  refs = --context_handle->refs;
574  if (!refs)
575  list_remove(&context_handle->entry);
576  LeaveCriticalSection(&assoc->cs);
577 
578  if (!refs)
579  RpcContextHandle_Destroy(context_handle);
580 
581  return refs;
582 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
RTL_RWLOCK rw_lock
Definition: rpc_assoc.c:59
unsigned int refs
Definition: rpc_assoc.c:60
struct list entry
Definition: rpc_assoc.c:54
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
Definition: rpc_assoc.c:548

Referenced by NDRSContextMarshall2(), and process_request_packet().

◆ RpcServerAssoc_UpdateContextHandle()

RPC_STATUS RpcServerAssoc_UpdateContextHandle ( RpcAssoc assoc,
NDR_SCONTEXT  SContext,
void CtxGuard,
NDR_RUNDOWN  rundown_routine 
)

Definition at line 516 of file rpc_assoc.c.

520 {
521  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
523 
524  if (!RpcContextHandle_IsGuardCorrect((NDR_SCONTEXT)context_handle, CtxGuard))
525  return ERROR_INVALID_HANDLE;
526 
527  EnterCriticalSection(&assoc->cs);
528  if (UuidIsNil(&context_handle->uuid, &status))
529  {
530  /* add a ref for the data being valid */
531  context_handle->refs++;
532  UuidCreate(&context_handle->uuid);
533  context_handle->rundown_routine = rundown_routine;
534  TRACE("allocated uuid %s for context handle %p\n",
535  debugstr_guid(&context_handle->uuid), context_handle);
536  }
537  LeaveCriticalSection(&assoc->cs);
538 
539  return RPC_S_OK;
540 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:269
long RPC_STATUS
Definition: rpc.h:52
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:306
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static SERVICE_STATUS status
Definition: service.c:31
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard)
Definition: rpc_assoc.c:482
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by NDRSContextMarshall2().