ReactOS  0.4.14-dev-593-g1793dcc
rpc_transport.c File Reference
#include "ntstatus.h"
#include "ws2tcpip.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wininet.h"
#include "wine/winternl.h"
#include "winioctl.h"
#include "rpc.h"
#include "rpcndr.h"
#include "wine/debug.h"
#include "rpc_binding.h"
#include "rpc_assoc.h"
#include "rpc_message.h"
#include "rpc_server.h"
#include "epm_towers.h"
Include dependency graph for rpc_transport.c:

Go to the source code of this file.

Classes

struct  _RpcConnection_np
 
struct  _RpcServerProtseq_np
 
struct  _RpcConnection_tcp
 
struct  _RpcServerProtseq_sock
 
struct  _RpcHttpAsyncData
 
struct  authinfo
 
struct  _RpcConnection_http
 
struct  _HttpTimerThreadData
 

Macros

#define WIN32_NO_STATUS
 
#define DEFAULT_NCACN_HTTP_TIMEOUT   (60 * 1000)
 
#define HTTP_IDLE_TIME   60000
 

Typedefs

typedef struct _RpcConnection_np RpcConnection_np
 
typedef struct _RpcServerProtseq_np RpcServerProtseq_np
 
typedef struct _RpcConnection_tcp RpcConnection_tcp
 
typedef struct _RpcServerProtseq_sock RpcServerProtseq_sock
 
typedef struct _RpcHttpAsyncData RpcHttpAsyncData
 
typedef struct _RpcConnection_http RpcConnection_http
 
typedef struct _HttpTimerThreadData HttpTimerThreadData
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (rpc)
 
static RpcConnectionrpcrt4_spawn_connection (RpcConnection *old_connection)
 
static RpcConnectionrpcrt4_conn_np_alloc (void)
 
static HANDLE get_np_event (RpcConnection_np *connection)
 
static void release_np_event (RpcConnection_np *connection, HANDLE event)
 
static RPC_STATUS rpcrt4_conn_create_pipe (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_conn_open_pipe (RpcConnection *Connection, LPCSTR pname, BOOL wait)
 
static charncalrpc_pipe_name (const char *endpoint)
 
static RPC_STATUS rpcrt4_ncalrpc_open (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint (RpcServerProtseq *protseq, const char *endpoint)
 
static charncacn_pipe_name (const char *endpoint)
 
static RPC_STATUS rpcrt4_ncacn_np_open (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint (RpcServerProtseq *protseq, const char *endpoint)
 
static void rpcrt4_conn_np_handoff (RpcConnection_np *old_npc, RpcConnection_np *new_npc)
 
static RPC_STATUS rpcrt4_ncacn_np_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static RPC_STATUS is_pipe_listening (const char *pipe_name)
 
static RPC_STATUS rpcrt4_ncacn_np_is_server_listening (const char *endpoint)
 
static RPC_STATUS rpcrt4_ncalrpc_np_is_server_listening (const char *endpoint)
 
static RPC_STATUS rpcrt4_ncalrpc_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static int rpcrt4_conn_np_read (RpcConnection *conn, void *buffer, unsigned int count)
 
static int rpcrt4_conn_np_write (RpcConnection *conn, const void *buffer, unsigned int count)
 
static int rpcrt4_conn_np_close (RpcConnection *conn)
 
static void rpcrt4_conn_np_close_read (RpcConnection *conn)
 
static void rpcrt4_conn_np_cancel_call (RpcConnection *conn)
 
static int rpcrt4_conn_np_wait_for_incoming_data (RpcConnection *conn)
 
static size_t rpcrt4_ncacn_np_get_top_of_tower (unsigned char *tower_data, const char *networkaddr, const char *endpoint)
 
static RPC_STATUS rpcrt4_ncacn_np_parse_top_of_tower (const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
 
static RPC_STATUS rpcrt4_conn_np_impersonate_client (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_conn_np_revert_to_self (RpcConnection *conn)
 
static RpcServerProtseqrpcrt4_protseq_np_alloc (void)
 
static void rpcrt4_protseq_np_signal_state_changed (RpcServerProtseq *protseq)
 
static voidrpcrt4_protseq_np_get_wait_array (RpcServerProtseq *protseq, void *prev_array, unsigned int *count)
 
static void rpcrt4_protseq_np_free_wait_array (RpcServerProtseq *protseq, void *array)
 
static int rpcrt4_protseq_np_wait_for_new_connection (RpcServerProtseq *protseq, unsigned int count, void *wait_array)
 
static size_t rpcrt4_ncalrpc_get_top_of_tower (unsigned char *tower_data, const char *networkaddr, const char *endpoint)
 
static RPC_STATUS rpcrt4_ncalrpc_parse_top_of_tower (const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
 
static BOOL rpcrt4_ncalrpc_is_authorized (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_ncalrpc_authorize (RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_size, unsigned char *out_buffer, unsigned int *out_size)
 
static RPC_STATUS rpcrt4_ncalrpc_secure_packet (RpcConnection *conn, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size)
 
static RPC_STATUS rpcrt4_ncalrpc_inquire_auth_client (RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
 
static size_t rpcrt4_ip_tcp_get_top_of_tower (unsigned char *tower_data, const char *networkaddr, unsigned char tcp_protid, const char *endpoint)
 
static RPC_STATUS rpcrt4_ip_tcp_parse_top_of_tower (const unsigned char *tower_data, size_t tower_size, char **networkaddr, unsigned char tcp_protid, char **endpoint)
 
static BOOL rpcrt4_sock_wait_init (RpcConnection_tcp *tcpc)
 
static BOOL rpcrt4_sock_wait_for_recv (RpcConnection_tcp *tcpc)
 
static BOOL rpcrt4_sock_wait_for_send (RpcConnection_tcp *tcpc)
 
static RpcConnectionrpcrt4_conn_tcp_alloc (void)
 
static RPC_STATUS rpcrt4_ncacn_ip_tcp_open (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint (RpcServerProtseq *protseq, const char *endpoint)
 
static RPC_STATUS rpcrt4_conn_tcp_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static int rpcrt4_conn_tcp_read (RpcConnection *Connection, void *buffer, unsigned int count)
 
static int rpcrt4_conn_tcp_write (RpcConnection *Connection, const void *buffer, unsigned int count)
 
static int rpcrt4_conn_tcp_close (RpcConnection *conn)
 
static void rpcrt4_conn_tcp_close_read (RpcConnection *conn)
 
static void rpcrt4_conn_tcp_cancel_call (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_conn_tcp_is_server_listening (const char *endpoint)
 
static int rpcrt4_conn_tcp_wait_for_incoming_data (RpcConnection *Connection)
 
static size_t rpcrt4_ncacn_ip_tcp_get_top_of_tower (unsigned char *tower_data, const char *networkaddr, const char *endpoint)
 
static RpcServerProtseqrpcrt4_protseq_sock_alloc (void)
 
static void rpcrt4_protseq_sock_signal_state_changed (RpcServerProtseq *protseq)
 
static voidrpcrt4_protseq_sock_get_wait_array (RpcServerProtseq *protseq, void *prev_array, unsigned int *count)
 
static void rpcrt4_protseq_sock_free_wait_array (RpcServerProtseq *protseq, void *array)
 
static int rpcrt4_protseq_sock_wait_for_new_connection (RpcServerProtseq *protseq, unsigned int count, void *wait_array)
 
static RPC_STATUS rpcrt4_ncacn_ip_tcp_parse_top_of_tower (const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
 
static ULONG RpcHttpAsyncData_AddRef (RpcHttpAsyncData *data)
 
static ULONG RpcHttpAsyncData_Release (RpcHttpAsyncData *data)
 
static void prepare_async_request (RpcHttpAsyncData *async_data)
 
static RPC_STATUS wait_async_request (RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
 
static RpcConnectionrpcrt4_ncacn_http_alloc (void)
 
static VOID rpcrt4_http_keep_connection_active_timer_proc (PVOID param, BOOLEAN dummy)
 
static DWORD rpcrt4_http_timer_calc_timeout (DWORD *last_sent_time)
 
static DWORD CALLBACK rpcrt4_http_timer_thread (PVOID param)
 
static VOID WINAPI rpcrt4_http_internet_callback (HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
 
static RPC_STATUS rpcrt4_http_check_response (HINTERNET hor)
 
static RPC_STATUS rpcrt4_http_internet_connect (RpcConnection_http *httpc)
 
static int rpcrt4_http_async_read (HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event, void *buffer, unsigned int count)
 
static RPC_STATUS send_echo_request (HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event)
 
static RPC_STATUS insert_content_length_header (HINTERNET request, DWORD len)
 
static RPC_STATUS rpcrt4_http_prepare_in_pipe (HINTERNET in_request, RpcHttpAsyncData *async_data, HANDLE cancel_event, const UUID *connection_uuid, const UUID *in_pipe_uuid, const UUID *association_uuid, BOOL authorized)
 
static RPC_STATUS rpcrt4_http_read_http_packet (HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event, RpcPktHdr *hdr, BYTE **data)
 
static RPC_STATUS rpcrt4_http_prepare_out_pipe (HINTERNET out_request, RpcHttpAsyncData *async_data, HANDLE cancel_event, const UUID *connection_uuid, const UUID *out_pipe_uuid, ULONG *flow_control_increment, BOOL authorized)
 
static UINT encode_base64 (const char *bin, unsigned int len, WCHAR *base64)
 
static char decode_char (WCHAR c)
 
static unsigned int decode_base64 (const WCHAR *base64, unsigned int len, char *buf)
 
static struct authinfoalloc_authinfo (void)
 
static void destroy_authinfo (struct authinfo *info)
 
static DWORD auth_scheme_from_header (const WCHAR *header)
 
static BOOL get_authvalue (HINTERNET request, DWORD scheme, WCHAR *buffer, DWORD buflen)
 
static RPC_STATUS do_authorization (HINTERNET request, SEC_WCHAR *servername, const RPC_HTTP_TRANSPORT_CREDENTIALS_W *creds, struct authinfo **auth_ptr)
 
static RPC_STATUS insert_authorization_header (HINTERNET request, ULONG scheme, char *data, int data_len)
 
static void drain_content (HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event)
 
static RPC_STATUS authorize_request (RpcConnection_http *httpc, HINTERNET request)
 
static BOOL has_credentials (RpcConnection_http *httpc)
 
static BOOL is_secure (RpcConnection_http *httpc)
 
static RPC_STATUS set_auth_cookie (RpcConnection_http *httpc, const WCHAR *value)
 
static RPC_STATUS rpcrt4_ncacn_http_open (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_ncacn_http_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static int rpcrt4_ncacn_http_read (RpcConnection *Connection, void *buffer, unsigned int count)
 
static RPC_STATUS rpcrt4_ncacn_http_receive_fragment (RpcConnection *Connection, RpcPktHdr **Header, void **Payload)
 
static int rpcrt4_ncacn_http_write (RpcConnection *Connection, const void *buffer, unsigned int count)
 
static int rpcrt4_ncacn_http_close (RpcConnection *Connection)
 
static void rpcrt4_ncacn_http_close_read (RpcConnection *conn)
 
static void rpcrt4_ncacn_http_cancel_call (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_ncacn_http_is_server_listening (const char *endpoint)
 
static int rpcrt4_ncacn_http_wait_for_incoming_data (RpcConnection *Connection)
 
static size_t rpcrt4_ncacn_http_get_top_of_tower (unsigned char *tower_data, const char *networkaddr, const char *endpoint)
 
static RPC_STATUS rpcrt4_ncacn_http_parse_top_of_tower (const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
 
const struct protseq_opsrpcrt4_get_protseq_ops (const char *protseq)
 
static const struct connection_opsrpcrt4_get_conn_protseq_ops (const char *protseq)
 
RPC_STATUS RPCRT4_OpenClientConnection (RpcConnection *Connection)
 
RPC_STATUS RPCRT4_CloseConnection (RpcConnection *Connection)
 
RPC_STATUS RPCRT4_CreateConnection (RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth)
 
void rpcrt4_conn_release_and_wait (RpcConnection *connection)
 
RpcConnectionRPCRT4_GrabConnection (RpcConnection *connection)
 
void RPCRT4_ReleaseConnection (RpcConnection *connection)
 
RPC_STATUS RPCRT4_IsServerListening (const char *protseq, const char *endpoint)
 
RPC_STATUS RpcTransport_GetTopOfTower (unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint)
 
RPC_STATUS RpcTransport_ParseTopOfTower (const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint)
 
RPC_STATUS WINAPI RpcNetworkIsProtseqValidW (RPC_WSTR protseq)
 
RPC_STATUS WINAPI RpcNetworkIsProtseqValidA (RPC_CSTR protseq)
 
RPC_STATUS WINAPI RpcProtseqVectorFreeA (RPC_PROTSEQ_VECTORA **protseqs)
 
RPC_STATUS WINAPI RpcProtseqVectorFreeW (RPC_PROTSEQ_VECTORW **protseqs)
 
RPC_STATUS WINAPI RpcNetworkInqProtseqsW (RPC_PROTSEQ_VECTORW **protseqs)
 
RPC_STATUS WINAPI RpcNetworkInqProtseqsA (RPC_PROTSEQ_VECTORA **protseqs)
 

Variables

static const WCHAR basicW [] = {'B','a','s','i','c',0}
 
static const WCHAR ntlmW [] = {'N','T','L','M',0}
 
static const WCHAR passportW [] = {'P','a','s','s','p','o','r','t',0}
 
static const WCHAR digestW [] = {'D','i','g','e','s','t',0}
 
static const WCHAR negotiateW [] = {'N','e','g','o','t','i','a','t','e',0}
 
struct {
   const WCHAR *   str
 
   unsigned int   len
 
   DWORD   scheme
 
auth_schemes []
 
static const struct connection_ops conn_protseq_list []
 
static const struct protseq_ops protseq_list []
 

Macro Definition Documentation

◆ DEFAULT_NCACN_HTTP_TIMEOUT

#define DEFAULT_NCACN_HTTP_TIMEOUT   (60 * 1000)

Definition at line 57 of file rpc_transport.c.

◆ HTTP_IDLE_TIME

#define HTTP_IDLE_TIME   60000

Definition at line 1705 of file rpc_transport.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 27 of file rpc_transport.c.

Typedef Documentation

◆ HttpTimerThreadData

◆ RpcConnection_http

◆ RpcConnection_np

◆ RpcConnection_tcp

◆ RpcHttpAsyncData

◆ RpcServerProtseq_np

◆ RpcServerProtseq_sock

Function Documentation

◆ alloc_authinfo()

static struct authinfo* alloc_authinfo ( void  )
static

Definition at line 2415 of file rpc_transport.c.

2416 {
2417  struct authinfo *ret;
2418 
2419  if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret) ))) return NULL;
2420 
2421  SecInvalidateHandle(&ret->cred);
2422  SecInvalidateHandle(&ret->ctx);
2423  memset(&ret->exp, 0, sizeof(ret->exp));
2424  ret->scheme = 0;
2425  ret->attr = 0;
2426  ret->max_token = 0;
2427  ret->data = NULL;
2428  ret->data_len = 0;
2429  ret->finished = FALSE;
2430  return ret;
2431 }
#define SecInvalidateHandle(x)
Definition: sspi.h:58
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define memset(x, y, z)
Definition: compat.h:39

Referenced by do_authorization().

◆ auth_scheme_from_header()

static DWORD auth_scheme_from_header ( const WCHAR header)
static

Definition at line 2467 of file rpc_transport.c.

2468 {
2469  unsigned int i;
2470  for (i = 0; i < ARRAY_SIZE(auth_schemes); i++)
2471  {
2473  (header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
2474  }
2475  return 0;
2476 }
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
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
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
static const struct @526 auth_schemes[]

Referenced by do_authorization(), and get_authvalue().

◆ authorize_request()

static RPC_STATUS authorize_request ( RpcConnection_http httpc,
HINTERNET  request 
)
static

Definition at line 2699 of file rpc_transport.c.

2700 {
2701  static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':','\r','\n',0};
2702  struct authinfo *info = NULL;
2704  BOOL ret;
2705 
2706  for (;;)
2707  {
2709  if (status != RPC_S_OK) break;
2710 
2711  status = insert_authorization_header(request, info->scheme, info->data, info->data_len);
2712  if (status != RPC_S_OK) break;
2713 
2715  ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
2717  if (status != RPC_S_OK || info->finished) break;
2718 
2720  if (status != RPC_S_OK && status != ERROR_ACCESS_DENIED) break;
2721  drain_content(request, httpc->async_data, httpc->cancel_event);
2722  }
2723 
2724  if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
2726 
2728  return status;
2729 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
static void drain_content(HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event)
RpcConnection common
#define RPC_C_HTTP_AUTHN_SCHEME_BASIC
Definition: rpcdce.h:205
static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
#define HTTP_ADDREQ_FLAG_REPLACE
Definition: wininet.h:1711
long RPC_STATUS
Definition: rpc.h:52
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5631
static RPC_STATUS insert_authorization_header(HINTERNET request, ULONG scheme, char *data, int data_len)
static void prepare_async_request(RpcHttpAsyncData *async_data)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
static RPC_STATUS do_authorization(HINTERNET request, SEC_WCHAR *servername, const RPC_HTTP_TRANSPORT_CREDENTIALS_W *creds, struct authinfo **auth_ptr)
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1396
static void destroy_authinfo(struct authinfo *info)
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
RpcHttpAsyncData * async_data
Definition: tftpd.h:85
static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by rpcrt4_ncacn_http_open().

◆ decode_base64()

static unsigned int decode_base64 ( const WCHAR base64,
unsigned int  len,
char buf 
)
static

Definition at line 2353 of file rpc_transport.c.

2354 {
2355  unsigned int i = 0;
2356  char c0, c1, c2, c3;
2357  const WCHAR *p = base64;
2358 
2359  while (len > 4)
2360  {
2361  if ((c0 = decode_char( p[0] )) > 63) return 0;
2362  if ((c1 = decode_char( p[1] )) > 63) return 0;
2363  if ((c2 = decode_char( p[2] )) > 63) return 0;
2364  if ((c3 = decode_char( p[3] )) > 63) return 0;
2365 
2366  if (buf)
2367  {
2368  buf[i + 0] = (c0 << 2) | (c1 >> 4);
2369  buf[i + 1] = (c1 << 4) | (c2 >> 2);
2370  buf[i + 2] = (c2 << 6) | c3;
2371  }
2372  len -= 4;
2373  i += 3;
2374  p += 4;
2375  }
2376  if (p[2] == '=')
2377  {
2378  if ((c0 = decode_char( p[0] )) > 63) return 0;
2379  if ((c1 = decode_char( p[1] )) > 63) return 0;
2380 
2381  if (buf) buf[i] = (c0 << 2) | (c1 >> 4);
2382  i++;
2383  }
2384  else if (p[3] == '=')
2385  {
2386  if ((c0 = decode_char( p[0] )) > 63) return 0;
2387  if ((c1 = decode_char( p[1] )) > 63) return 0;
2388  if ((c2 = decode_char( p[2] )) > 63) return 0;
2389 
2390  if (buf)
2391  {
2392  buf[i + 0] = (c0 << 2) | (c1 >> 4);
2393  buf[i + 1] = (c1 << 4) | (c2 >> 2);
2394  }
2395  i += 2;
2396  }
2397  else
2398  {
2399  if ((c0 = decode_char( p[0] )) > 63) return 0;
2400  if ((c1 = decode_char( p[1] )) > 63) return 0;
2401  if ((c2 = decode_char( p[2] )) > 63) return 0;
2402  if ((c3 = decode_char( p[3] )) > 63) return 0;
2403 
2404  if (buf)
2405  {
2406  buf[i + 0] = (c0 << 2) | (c1 >> 4);
2407  buf[i + 1] = (c1 << 4) | (c2 >> 2);
2408  buf[i + 2] = (c2 << 6) | c3;
2409  }
2410  i += 3;
2411  }
2412  return i;
2413 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
static char decode_char(WCHAR c)
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by do_authorization().

◆ decode_char()

static char decode_char ( WCHAR  c)
inlinestatic

Definition at line 2343 of file rpc_transport.c.

2344 {
2345  if (c >= 'A' && c <= 'Z') return c - 'A';
2346  if (c >= 'a' && c <= 'z') return c - 'a' + 26;
2347  if (c >= '0' && c <= '9') return c - '0' + 52;
2348  if (c == '+') return 62;
2349  if (c == '/') return 63;
2350  return 64;
2351 }
const GLubyte * c
Definition: glext.h:8905

Referenced by decode_base64().

◆ destroy_authinfo()

static void destroy_authinfo ( struct authinfo info)
static

Definition at line 2433 of file rpc_transport.c.

2434 {
2435  if (!info) return;
2436 
2437  if (SecIsValidHandle(&info->ctx))
2438  DeleteSecurityContext(&info->ctx);
2439  if (SecIsValidHandle(&info->cred))
2440  FreeCredentialsHandle(&info->cred);
2441 
2442  HeapFree(GetProcessHeap(), 0, info->data);
2443  HeapFree(GetProcessHeap(), 0, info);
2444 }
#define SecIsValidHandle(x)
Definition: sspi.h:63
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450

Referenced by authorize_request(), do_authorization(), and request_destroy().

◆ do_authorization()

static RPC_STATUS do_authorization ( HINTERNET  request,
SEC_WCHAR servername,
const RPC_HTTP_TRANSPORT_CREDENTIALS_W creds,
struct authinfo **  auth_ptr 
)
static

Definition at line 2490 of file rpc_transport.c.

2492 {
2493  struct authinfo *info = *auth_ptr;
2496 
2497  if ((!info && !(info = alloc_authinfo()))) return RPC_S_SERVER_UNAVAILABLE;
2498 
2499  switch (creds->AuthnSchemes[0])
2500  {
2502  {
2503  int userlen = WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, NULL, 0, NULL, NULL);
2504  int passlen = WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, NULL, 0, NULL, NULL);
2505 
2506  info->data_len = userlen + passlen + 1;
2507  if (!(info->data = HeapAlloc(GetProcessHeap(), 0, info->data_len)))
2508  {
2510  break;
2511  }
2512  WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, info->data, userlen, NULL, NULL);
2513  info->data[userlen] = ':';
2514  WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, info->data + userlen + 1, passlen, NULL, NULL);
2515 
2517  info->finished = TRUE;
2518  status = RPC_S_OK;
2519  break;
2520  }
2523  {
2524 
2525  static SEC_WCHAR ntlmW[] = {'N','T','L','M',0}, negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
2527  SecBufferDesc out_desc, in_desc;
2528  SecBuffer out, in;
2530  SEC_WCHAR *scheme;
2531  int scheme_len;
2532  const WCHAR *p;
2533  WCHAR auth_value[2048];
2534  DWORD size = sizeof(auth_value);
2535  BOOL first = FALSE;
2536 
2538  else scheme = negotiateW;
2539  scheme_len = lstrlenW( scheme );
2540 
2541  if (!*auth_ptr)
2542  {
2543  TimeStamp exp;
2544  SecPkgInfoW *pkg_info;
2545 
2547  if (ret != SEC_E_OK) break;
2548 
2549  ret = QuerySecurityPackageInfoW(scheme, &pkg_info);
2550  if (ret != SEC_E_OK) break;
2551 
2552  info->max_token = pkg_info->cbMaxToken;
2553  FreeContextBuffer(pkg_info);
2554  first = TRUE;
2555  }
2556  else
2557  {
2558  if (info->finished || !get_authvalue(request, creds->AuthnSchemes[0], auth_value, size)) break;
2559  if (auth_scheme_from_header(auth_value) != info->scheme)
2560  {
2561  ERR("authentication scheme changed\n");
2562  break;
2563  }
2564  }
2565  in.BufferType = SECBUFFER_TOKEN;
2566  in.cbBuffer = 0;
2567  in.pvBuffer = NULL;
2568 
2569  in_desc.ulVersion = 0;
2570  in_desc.cBuffers = 1;
2571  in_desc.pBuffers = &in;
2572 
2573  p = auth_value + scheme_len;
2574  if (!first && *p == ' ')
2575  {
2576  int len = lstrlenW(++p);
2577  in.cbBuffer = decode_base64(p, len, NULL);
2578  if (!(in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer))) break;
2579  decode_base64(p, len, in.pvBuffer);
2580  }
2581  out.BufferType = SECBUFFER_TOKEN;
2582  out.cbBuffer = info->max_token;
2583  if (!(out.pvBuffer = HeapAlloc(GetProcessHeap(), 0, out.cbBuffer)))
2584  {
2585  HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2586  break;
2587  }
2588  out_desc.ulVersion = 0;
2589  out_desc.cBuffers = 1;
2590  out_desc.pBuffers = &out;
2591 
2592  ret = InitializeSecurityContextW(first ? &info->cred : NULL, first ? NULL : &info->ctx,
2593  first ? servername : NULL, flags, 0, SECURITY_NETWORK_DREP,
2594  in.pvBuffer ? &in_desc : NULL, 0, &info->ctx, &out_desc,
2595  &info->attr, &info->exp);
2596  HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2597  if (ret == SEC_E_OK)
2598  {
2599  HeapFree(GetProcessHeap(), 0, info->data);
2600  info->data = out.pvBuffer;
2601  info->data_len = out.cbBuffer;
2602  info->finished = TRUE;
2603  TRACE("sending last auth packet\n");
2604  status = RPC_S_OK;
2605  }
2606  else if (ret == SEC_I_CONTINUE_NEEDED)
2607  {
2608  HeapFree(GetProcessHeap(), 0, info->data);
2609  info->data = out.pvBuffer;
2610  info->data_len = out.cbBuffer;
2611  TRACE("sending next auth packet\n");
2612  status = RPC_S_OK;
2613  }
2614  else
2615  {
2616  ERR("InitializeSecurityContextW failed with error 0x%08x\n", ret);
2617  HeapFree(GetProcessHeap(), 0, out.pvBuffer);
2618  break;
2619  }
2620  info->scheme = creds->AuthnSchemes[0];
2621  break;
2622  }
2623  default:
2624  FIXME("scheme %u not supported\n", creds->AuthnSchemes[0]);
2625  break;
2626  }
2627 
2628  if (status != RPC_S_OK)
2629  {
2631  *auth_ptr = NULL;
2632  return status;
2633  }
2634  *auth_ptr = info;
2635  return RPC_S_OK;
2636 }
static struct authinfo * alloc_authinfo(void)
#define TRUE
Definition: types.h:120
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:278
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
static DWORD auth_scheme_from_header(const WCHAR *header)
#define WideCharToMultiByte
Definition: compat.h:101
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
WCHAR SEC_WCHAR
Definition: sspi.h:29
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
ULONG ulVersion
Definition: sspi.h:168
const GLint * first
Definition: glext.h:5794
#define RPC_C_HTTP_AUTHN_SCHEME_BASIC
Definition: rpcdce.h:205
DWORD scheme
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
#define ISC_REQ_DELEGATE
Definition: sspi.h:349
#define lstrlenW
Definition: compat.h:415
static const WCHAR negotiateW[]
struct _test_info info[]
Definition: SetCursorPos.c:19
long RPC_STATUS
Definition: rpc.h:52
#define CP_UTF8
Definition: nls.h:20
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
unsigned int BOOL
Definition: ntddk_ex.h:94
ULONG cbMaxToken
Definition: sspi.h:104
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define SEC_I_CONTINUE_NEEDED
Definition: winerror.h:2927
static const WCHAR ntlmW[]
LONG SECURITY_STATUS
Definition: sspi.h:34
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
SECURITY_STATUS WINAPI InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: wrapper.c:301
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
#define RPC_C_HTTP_AUTHN_SCHEME_NTLM
Definition: rpcdce.h:206
int ret
#define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE
Definition: rpcdce.h:209
#define SECBUFFER_TOKEN
Definition: sspi.h:148
GLenum GLsizei len
Definition: glext.h:6722
#define ISC_REQ_USE_DCE_STYLE
Definition: sspi.h:358
static void destroy_authinfo(struct authinfo *info)
#define SECURITY_NETWORK_DREP
Definition: sspi.h:461
#define SEC_E_OK
Definition: winerror.h:2356
#define ISC_REQ_CONNECTION
Definition: sspi.h:360
#define ERR(fmt,...)
Definition: debug.h:109
GLuint in
Definition: glext.h:9616
DWORD exp
Definition: msg.c:16038
#define ISC_REQ_MUTUAL_AUTH
Definition: sspi.h:350
static unsigned int decode_base64(const WCHAR *base64, unsigned int len, char *buf)
Definition: tftpd.h:85
unsigned int ULONG
Definition: retypes.h:1
GLenum GLuint id
Definition: glext.h:5579
GLfloat GLfloat p
Definition: glext.h:8902
static BOOL get_authvalue(HINTERNET request, DWORD scheme, WCHAR *buffer, DWORD buflen)
ULONG cBuffers
Definition: sspi.h:169
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo)
Definition: wrapper.c:750
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by authorize_request().

◆ drain_content()

static void drain_content ( HINTERNET  request,
RpcHttpAsyncData async_data,
HANDLE  cancel_event 
)
static

Definition at line 2684 of file rpc_transport.c.

2685 {
2686  DWORD count, len = 0, size = sizeof(len);
2687  char buf[2048];
2688 
2690  if (!len) return;
2691  for (;;)
2692  {
2693  count = min(sizeof(buf), len);
2694  if (rpcrt4_http_async_read(request, async_data, cancel_event, buf, count) <= 0) return;
2695  len -= count;
2696  }
2697 }
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528
static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event, void *buffer, unsigned int count)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
unsigned int len
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
GLenum GLsizei len
Definition: glext.h:6722
#define min(a, b)
Definition: monoChain.cc:55
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
Definition: tftpd.h:85

Referenced by authorize_request(), and rpcrt4_ncacn_http_open().

◆ encode_base64()

static UINT encode_base64 ( const char bin,
unsigned int  len,
WCHAR base64 
)
static

Definition at line 2303 of file rpc_transport.c.

2304 {
2305  static const char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2306  UINT i = 0, x;
2307 
2308  while (len > 0)
2309  {
2310  /* first 6 bits, all from bin[0] */
2311  base64[i++] = enc[(bin[0] & 0xfc) >> 2];
2312  x = (bin[0] & 3) << 4;
2313 
2314  /* next 6 bits, 2 from bin[0] and 4 from bin[1] */
2315  if (len == 1)
2316  {
2317  base64[i++] = enc[x];
2318  base64[i++] = '=';
2319  base64[i++] = '=';
2320  break;
2321  }
2322  base64[i++] = enc[x | ((bin[1] & 0xf0) >> 4)];
2323  x = (bin[1] & 0x0f) << 2;
2324 
2325  /* next 6 bits 4 from bin[1] and 2 from bin[2] */
2326  if (len == 2)
2327  {
2328  base64[i++] = enc[x];
2329  base64[i++] = '=';
2330  break;
2331  }
2332  base64[i++] = enc[x | ((bin[2] & 0xc0) >> 6)];
2333 
2334  /* last 6 bits, all from bin [2] */
2335  base64[i++] = enc[bin[2] & 0x3f];
2336  bin += 3;
2337  len -= 3;
2338  }
2339  base64[i] = 0;
2340  return i;
2341 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
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
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
static struct _PeImage bin

Referenced by insert_authorization_header().

◆ get_authvalue()

static BOOL get_authvalue ( HINTERNET  request,
DWORD  scheme,
WCHAR buffer,
DWORD  buflen 
)
static

Definition at line 2478 of file rpc_transport.c.

2479 {
2480  DWORD len, index = 0;
2481  for (;;)
2482  {
2483  len = buflen;
2485  if (auth_scheme_from_header(buffer) == scheme) break;
2486  }
2487  return TRUE;
2488 }
#define TRUE
Definition: types.h:120
static DWORD auth_scheme_from_header(const WCHAR *header)
DWORD scheme
GLuint buffer
Definition: glext.h:5915
#define HTTP_QUERY_WWW_AUTHENTICATE
Definition: wininet.h:1563
unsigned int len
GLuint index
Definition: glext.h:6031
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
GLenum GLsizei len
Definition: glext.h:6722
Definition: tftpd.h:85

Referenced by do_authorization().

◆ get_np_event()

static HANDLE get_np_event ( RpcConnection_np connection)
static

Definition at line 97 of file rpc_transport.c.

98 {
99  HANDLE event = InterlockedExchangePointer(&connection->event_cache, NULL);
100  return event ? event : CreateEventW(NULL, TRUE, FALSE, NULL);
101 }
#define TRUE
Definition: types.h:120
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
smooth NULL
Definition: ftsmooth.c:416
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
struct _cl_event * event
Definition: glext.h:7739

Referenced by rpcrt4_conn_np_read(), rpcrt4_conn_np_write(), and rpcrt4_protseq_np_get_wait_array().

◆ has_credentials()

static BOOL has_credentials ( RpcConnection_http httpc)
static

Definition at line 2731 of file rpc_transport.c.

2732 {
2735 
2737  return FALSE;
2738 
2739  creds = httpc->common.QOS->qos->u.HttpCredentials;
2741  return FALSE;
2742 
2743  id = creds->TransportCredentials;
2744  if (!id || !id->User || !id->Password) return FALSE;
2745 
2746  return TRUE;
2747 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
#define TRUE
Definition: types.h:120
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
#define RPC_C_HTTP_AUTHN_TARGET_SERVER
Definition: rpcdce.h:202
RpcConnection common
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
GLenum GLuint id
Definition: glext.h:5579
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
RpcQualityOfService * QOS
Definition: rpc_binding.h:81

Referenced by rpcrt4_ncacn_http_open().

◆ insert_authorization_header()

static RPC_STATUS insert_authorization_header ( HINTERNET  request,
ULONG  scheme,
char data,
int  data_len 
)
static

Definition at line 2638 of file rpc_transport.c.

2639 {
2640  static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '};
2641  static const WCHAR basicW[] = {'B','a','s','i','c',' '};
2642  static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '};
2643  static const WCHAR ntlmW[] = {'N','T','L','M',' '};
2644  int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len + 2) * 4) / 3;
2645  const WCHAR *scheme_str;
2646  WCHAR *header, *ptr;
2648 
2649  switch (scheme)
2650  {
2652  scheme_str = basicW;
2653  scheme_len = ARRAY_SIZE(basicW);
2654  break;
2656  scheme_str = negotiateW;
2657  scheme_len = ARRAY_SIZE(negotiateW);
2658  break;
2660  scheme_str = ntlmW;
2661  scheme_len = ARRAY_SIZE(ntlmW);
2662  break;
2663  default:
2664  ERR("unknown scheme %u\n", scheme);
2665  return RPC_S_SERVER_UNAVAILABLE;
2666  }
2667  if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR))))
2668  {
2669  memcpy(header, authW, auth_len * sizeof(WCHAR));
2670  ptr = header + auth_len;
2671  memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR));
2672  ptr += scheme_len;
2674  ptr[len++] = '\r';
2675  ptr[len++] = '\n';
2676  ptr[len] = 0;
2678  status = RPC_S_OK;
2680  }
2681  return status;
2682 }
static const WCHAR basicW[]
#define RPC_C_HTTP_AUTHN_SCHEME_BASIC
Definition: rpcdce.h:205
DWORD scheme
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
static const WCHAR negotiateW[]
#define HTTP_ADDREQ_FLAG_REPLACE
Definition: wininet.h:1711
unsigned int len
long RPC_STATUS
Definition: rpc.h:52
static PVOID ptr
Definition: dispmode.c:27
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
static const WCHAR ntlmW[]
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned int data_len
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define RPC_C_HTTP_AUTHN_SCHEME_NTLM
Definition: rpcdce.h:206
#define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE
Definition: rpcdce.h:209
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1396
static UINT encode_base64(const char *bin, unsigned int len, WCHAR *base64)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define ERR(fmt,...)
Definition: debug.h:109
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: tftpd.h:85
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
struct CFHEADER header
Definition: fdi.c:101
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by authorize_request().

◆ insert_content_length_header()

static RPC_STATUS insert_content_length_header ( HINTERNET  request,
DWORD  len 
)
static

Definition at line 2127 of file rpc_transport.c.

2128 {
2129  static const WCHAR fmtW[] =
2130  {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
2131  WCHAR header[ARRAY_SIZE(fmtW) + 10];
2132 
2133  swprintf(header, fmtW, len);
2135  return RPC_S_SERVER_UNAVAILABLE;
2136 }
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
#define HTTP_ADDREQ_FLAG_REPLACE
Definition: wininet.h:1711
#define HTTP_ADDREQ_FLAG_ADD
Definition: wininet.h:1707
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1396
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: tftpd.h:85
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_http_prepare_in_pipe(), and rpcrt4_http_prepare_out_pipe().

◆ is_pipe_listening()

static RPC_STATUS is_pipe_listening ( const char pipe_name)
static

Definition at line 379 of file rpc_transport.c.

380 {
381  return WaitNamedPipeA(pipe_name, 1) ? RPC_S_OK : RPC_S_NOT_LISTENING;
382 }
BOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
Definition: npipe.c:433
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1026
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_ncacn_np_is_server_listening(), and rpcrt4_ncalrpc_np_is_server_listening().

◆ is_secure()

static BOOL is_secure ( RpcConnection_http httpc)
static

Definition at line 2749 of file rpc_transport.c.

2750 {
2751  return httpc->common.QOS &&
2754 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
RpcConnection common
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
#define RPC_C_HTTP_FLAG_USE_SSL
Definition: rpcdce.h:198
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
RpcQualityOfService * QOS
Definition: rpc_binding.h:81

Referenced by open_connection(), rpcrt4_ncacn_http_open(), and set_auth_cookie().

◆ ncacn_pipe_name()

static char* ncacn_pipe_name ( const char endpoint)
static

Definition at line 258 of file rpc_transport.c.

260 {
261 #ifdef __REACTOS__
262  static const char prefix[] = "\\\\";
263  static const char local[] = ".";
264  char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
265 #else
266  static const char prefix[] = "\\\\.";
267 #endif
268  char *pipe_name;
269 
270 #ifdef __REACTOS__
271  DWORD bufLen = ARRAYSIZE(ComputerName);
272 
273  GetComputerNameA(ComputerName, &bufLen);
274 
275  if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
276  server = local;
277 #endif
278 
279  /* protseq=ncacn_np: named pipes */
280 #ifdef __REACTOS__
281  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
282  strcpy(pipe_name, prefix);
283  strcat(pipe_name, server);
284  strcat(pipe_name, endpoint);
285 #else
286  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
287  strcat(strcpy(pipe_name, prefix), endpoint);
288 #endif
289  return pipe_name;
290 }
BOOL WINAPI SHIM_OBJ_NAME() GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
Definition: shimtest.c:21
static rfbScreenInfoPtr server
Definition: vnc.c:74
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
smooth NULL
Definition: ftsmooth.c:416
_Check_return_ _CRTIMP int __cdecl stricmp(_In_z_ const char *_Str1, _In_z_ const char *_Str2)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define local
Definition: zutil.h:30
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
Definition: nis.h:10
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714

Referenced by rpcrt4_ncacn_np_is_server_listening(), rpcrt4_ncacn_np_open(), and rpcrt4_protseq_ncacn_np_open_endpoint().

◆ ncalrpc_pipe_name()

static char* ncalrpc_pipe_name ( const char endpoint)
static

Definition at line 194 of file rpc_transport.c.

195 {
196  static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
197  char *pipe_name;
198 
199  /* protseq=ncalrpc: supposed to use NT LPC ports,
200  * but we'll implement it with named pipes for now */
201  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
202  strcat(strcpy(pipe_name, prefix), endpoint);
203  return pipe_name;
204 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: nis.h:10
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714

Referenced by rpcrt4_ncalrpc_np_is_server_listening(), rpcrt4_ncalrpc_open(), and rpcrt4_protseq_ncalrpc_open_endpoint().

◆ prepare_async_request()

static void prepare_async_request ( RpcHttpAsyncData async_data)
static

Definition at line 1739 of file rpc_transport.c.

1740 {
1741  ResetEvent(async_data->completion_event);
1742  RpcHttpAsyncData_AddRef(async_data);
1743 }
static ULONG RpcHttpAsyncData_AddRef(RpcHttpAsyncData *data)
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714

Referenced by authorize_request(), rpcrt4_http_async_read(), rpcrt4_http_prepare_in_pipe(), rpcrt4_http_prepare_out_pipe(), rpcrt4_ncacn_http_wait_for_incoming_data(), and send_echo_request().

◆ release_np_event()

static void release_np_event ( RpcConnection_np connection,
HANDLE  event 
)
static

Definition at line 103 of file rpc_transport.c.

104 {
105  event = InterlockedExchangePointer(&connection->event_cache, event);
106  if (event)
108 }
#define CloseHandle
Definition: compat.h:406
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
struct _cl_event * event
Definition: glext.h:7739

Referenced by rpcrt4_conn_np_read(), rpcrt4_conn_np_write(), and rpcrt4_protseq_np_wait_for_new_connection().

◆ RpcHttpAsyncData_AddRef()

static ULONG RpcHttpAsyncData_AddRef ( RpcHttpAsyncData data)
static

Definition at line 1719 of file rpc_transport.c.

1720 {
1721  return InterlockedIncrement(&data->refs);
1722 }
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by prepare_async_request().

◆ RpcHttpAsyncData_Release()

static ULONG RpcHttpAsyncData_Release ( RpcHttpAsyncData data)
static

Definition at line 1724 of file rpc_transport.c.

1725 {
1726  ULONG refs = InterlockedDecrement(&data->refs);
1727  if (!refs)
1728  {
1729  TRACE("destroying async data %p\n", data);
1730  CloseHandle(data->completion_event);
1731  HeapFree(GetProcessHeap(), 0, data->inet_buffers.lpvBuffer);
1732  data->cs.DebugInfo->Spare[0] = 0;
1734  HeapFree(GetProcessHeap(), 0, data);
1735  }
1736  return refs;
1737 }
#define CloseHandle
Definition: compat.h:406
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by rpcrt4_http_internet_callback(), rpcrt4_ncacn_http_close(), and wait_async_request().

◆ RpcNetworkInqProtseqsA()

RPC_STATUS WINAPI RpcNetworkInqProtseqsA ( RPC_PROTSEQ_VECTORA **  protseqs)

Definition at line 3701 of file rpc_transport.c.

3702 {
3703  RPC_PROTSEQ_VECTORA *pvector;
3704  unsigned int i;
3706 
3707  TRACE("(%p)\n", protseqs);
3708 
3709  *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned char*)*ARRAY_SIZE(protseq_list)));
3710  if (!*protseqs)
3711  goto end;
3712  pvector = *protseqs;
3713  pvector->Count = 0;
3714  for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3715  {
3716  pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, strlen(protseq_list[i].name)+1);
3717  if (pvector->Protseq[i] == NULL)
3718  goto end;
3719  strcpy((char*)pvector->Protseq[i], protseq_list[i].name);
3720  pvector->Count++;
3721  }
3722  status = RPC_S_OK;
3723 
3724 end:
3725  if (status != RPC_S_OK)
3727  return status;
3728 }
static struct list protseqs
Definition: rpc_server.c:68
unsigned char * Protseq[1]
Definition: rpcdce.h:91
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned int Count
Definition: rpcdce.h:90
GLuint GLuint end
Definition: gl.h:1545
static const struct protseq_ops protseq_list[]
long RPC_STATUS
Definition: rpc.h:52
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 RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
RPC_STATUS WINAPI RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA **protseqs)
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

◆ RpcNetworkInqProtseqsW()

RPC_STATUS WINAPI RpcNetworkInqProtseqsW ( RPC_PROTSEQ_VECTORW **  protseqs)

Definition at line 3668 of file rpc_transport.c.

3669 {
3670  RPC_PROTSEQ_VECTORW *pvector;
3671  unsigned int i;
3673 
3674  TRACE("(%p)\n", protseqs);
3675 
3676  *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned short*)*ARRAY_SIZE(protseq_list)));
3677  if (!*protseqs)
3678  goto end;
3679  pvector = *protseqs;
3680  pvector->Count = 0;
3681  for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3682  {
3683  pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, (strlen(protseq_list[i].name)+1)*sizeof(unsigned short));
3684  if (pvector->Protseq[i] == NULL)
3685  goto end;
3687  (WCHAR*)pvector->Protseq[i], strlen(protseq_list[i].name) + 1);
3688  pvector->Count++;
3689  }
3690  status = RPC_S_OK;
3691 
3692 end:
3693  if (status != RPC_S_OK)
3695  return status;
3696 }
static struct list protseqs
Definition: rpc_server.c:68
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
unsigned int Count
Definition: rpcdce.h:96
GLuint GLuint end
Definition: gl.h:1545
static const struct protseq_ops protseq_list[]
long RPC_STATUS
Definition: rpc.h:52
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 RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
RPC_STATUS WINAPI RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW **protseqs)
smooth NULL
Definition: ftsmooth.c:416
unsigned short * Protseq[1]
Definition: rpcdce.h:97
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:38
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

◆ RpcNetworkIsProtseqValidA()

RPC_STATUS WINAPI RpcNetworkIsProtseqValidA ( RPC_CSTR  protseq)

Definition at line 3616 of file rpc_transport.c.

3617 {
3618  UNICODE_STRING protseqW;
3619 
3620  if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq))
3621  {
3623  RtlFreeUnicodeString(&protseqW);
3624  return ret;
3625  }
3626  return RPC_S_OUT_OF_MEMORY;
3627 }
long RPC_STATUS
Definition: rpc.h:52
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret
RPC_STATUS WINAPI RpcNetworkIsProtseqValidW(RPC_WSTR protseq)

Referenced by test_rpc_ncacn_ip_tcp().

◆ RpcNetworkIsProtseqValidW()

RPC_STATUS WINAPI RpcNetworkIsProtseqValidW ( RPC_WSTR  protseq)

Definition at line 3599 of file rpc_transport.c.

3600 {
3601  char ps[0x10];
3602 
3603  WideCharToMultiByte(CP_ACP, 0, protseq, -1,
3604  ps, sizeof ps, NULL, NULL);
3606  return RPC_S_OK;
3607 
3608  FIXME("Unknown protseq %s\n", debugstr_w(protseq));
3609 
3611 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define RPC_S_INVALID_RPC_PROTSEQ
Definition: winerror.h:1015
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcNetworkIsProtseqValidA().

◆ RpcProtseqVectorFreeA()

RPC_STATUS WINAPI RpcProtseqVectorFreeA ( RPC_PROTSEQ_VECTORA **  protseqs)

Definition at line 3632 of file rpc_transport.c.

3633 {
3634  TRACE("(%p)\n", protseqs);
3635 
3636  if (*protseqs)
3637  {
3638  unsigned int i;
3639  for (i = 0; i < (*protseqs)->Count; i++)
3640  HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3642  *protseqs = NULL;
3643  }
3644  return RPC_S_OK;
3645 }
static struct list protseqs
Definition: rpc_server.c:68
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcNetworkInqProtseqsA().

◆ RpcProtseqVectorFreeW()

RPC_STATUS WINAPI RpcProtseqVectorFreeW ( RPC_PROTSEQ_VECTORW **  protseqs)

Definition at line 3650 of file rpc_transport.c.

3651 {
3652  TRACE("(%p)\n", protseqs);
3653 
3654  if (*protseqs)
3655  {
3656  unsigned int i;
3657  for (i = 0; i < (*protseqs)->Count; i++)
3658  HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3660  *protseqs = NULL;
3661  }
3662  return RPC_S_OK;
3663 }
static struct list protseqs
Definition: rpc_server.c:68
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcNetworkInqProtseqsW().

◆ RPCRT4_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3348 of file rpc_transport.c.

3349 {
3350  TRACE("(Connection == ^%p)\n", Connection);
3351  if (SecIsValidHandle(&Connection->ctx))
3352  {
3353  DeleteSecurityContext(&Connection->ctx);
3354  SecInvalidateHandle(&Connection->ctx);
3355  }
3356  rpcrt4_conn_close(Connection);
3357  return RPC_S_OK;
3358 }
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:200
#define SecIsValidHandle(x)
Definition: sspi.h:63
#define SecInvalidateHandle(x)
Definition: sspi.h:58
#define TRACE(s)
Definition: solgame.cpp:4
CtxtHandle ctx
Definition: rpc_binding.h:74
#define RPC_S_OK
Definition: rpcnterr.h:22
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450

Referenced by RPCRT4_ReleaseConnection(), and RPCRT4_server_thread().

◆ rpcrt4_conn_create_pipe()

static RPC_STATUS rpcrt4_conn_create_pipe ( RpcConnection conn)
static

Definition at line 110 of file rpc_transport.c.

111 {
112  RpcConnection_np *connection = (RpcConnection_np *) conn;
113 
114  TRACE("listening on %s\n", connection->listen_pipe);
115 
120  if (connection->pipe == INVALID_HANDLE_VALUE)
121  {
122  WARN("CreateNamedPipe failed with error %d\n", GetLastError());
125  else
127  }
128 
129  return RPC_S_OK;
130 }
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:175
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define PIPE_TYPE_MESSAGE
Definition: winbase.h:168
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: npipe.c:220
#define WARN(fmt,...)
Definition: debug.h:111
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
#define RPC_S_DUPLICATE_ENDPOINT
Definition: winerror.h:1048
#define TRACE(s)
Definition: solgame.cpp:4
#define PIPE_ACCESS_DUPLEX
Definition: winbase.h:164
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define RPC_S_OK
Definition: rpcnterr.h:22
#define RPC_S_CANT_CREATE_ENDPOINT
Definition: winerror.h:1031

Referenced by rpcrt4_ncacn_np_handoff(), rpcrt4_ncalrpc_handoff(), rpcrt4_protseq_ncacn_np_open_endpoint(), rpcrt4_protseq_ncalrpc_open_endpoint(), and rpcrt4_protseq_np_get_wait_array().

◆ rpcrt4_conn_np_alloc()

static RpcConnection* rpcrt4_conn_np_alloc ( void  )
static

Definition at line 91 of file rpc_transport.c.

92 {
94  return &npc->common;
95 }
RpcConnection common
Definition: rpc_transport.c:82
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

◆ rpcrt4_conn_np_cancel_call()

static void rpcrt4_conn_np_cancel_call ( RpcConnection conn)
static

Definition at line 524 of file rpc_transport.c.

525 {
526  RpcConnection_np *connection = (RpcConnection_np *)conn;
527  CancelIoEx(connection->pipe, NULL);
528 }
smooth NULL
Definition: ftsmooth.c:416

◆ rpcrt4_conn_np_close()

static int rpcrt4_conn_np_close ( RpcConnection conn)
static

Definition at line 489 of file rpc_transport.c.

490 {
491  RpcConnection_np *connection = (RpcConnection_np *) conn;
492  if (connection->pipe)
493  {
494  FlushFileBuffers(connection->pipe);
495  CloseHandle(connection->pipe);
496  connection->pipe = 0;
497  }
498  if (connection->listen_event)
499  {
500  CloseHandle(connection->listen_event);
501  connection->listen_event = 0;
502  }
503  if (connection->event_cache)
504  {
505  CloseHandle(connection->event_cache);
506  connection->event_cache = 0;
507  }
508  return 0;
509 }
#define CloseHandle
Definition: compat.h:406
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:175

◆ rpcrt4_conn_np_close_read()

static void rpcrt4_conn_np_close_read ( RpcConnection conn)
static

Definition at line 511 of file rpc_transport.c.

512 {
513  RpcConnection_np *connection = (RpcConnection_np*)conn;
515 
516  connection->read_closed = TRUE;
517 #ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
518  NtCancelIoFile(connection->pipe, &io_status);
519 #else
520  NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
521 #endif
522 }
#define TRUE
Definition: types.h:120
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:54
IO_STATUS_BLOCK io_status
Definition: rpc_transport.c:86
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE, PIO_STATUS_BLOCK, PIO_STATUS_BLOCK)
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:4018

◆ rpcrt4_conn_np_handoff()

static void rpcrt4_conn_np_handoff ( RpcConnection_np old_npc,
RpcConnection_np new_npc 
)
static

Definition at line 349 of file rpc_transport.c.

350 {
351  /* because of the way named pipes work, we'll transfer the connected pipe
352  * to the child, then reopen the server binding to continue listening */
353 
354  new_npc->pipe = old_npc->pipe;
355  old_npc->pipe = 0;
356  assert(!old_npc->listen_event);
357 }
#define assert(x)
Definition: debug.h:53

Referenced by rpcrt4_ncacn_np_handoff(), and rpcrt4_ncalrpc_handoff().

◆ rpcrt4_conn_np_impersonate_client()

static RPC_STATUS rpcrt4_conn_np_impersonate_client ( RpcConnection conn)
static

Definition at line 648 of file rpc_transport.c.

649 {
650  RpcConnection_np *npc = (RpcConnection_np *)conn;
651  BOOL ret;
652 
653  TRACE("(%p)\n", conn);
654 
655  if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
657 
659  if (!ret)
660  {
662  WARN("ImpersonateNamedPipeClient failed with error %u\n", error);
663  switch (error)
664  {
667  }
668  }
669  return RPC_S_OK;
670 }
BOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe)
Definition: security.c:903
#define error(str)
Definition: mkdosfs.c:1605
#define RPC_S_NO_CONTEXT_AVAILABLE
Definition: winerror.h:1073
#define SecIsValidHandle(x)
Definition: sspi.h:63
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ERROR_CANNOT_IMPERSONATE
Definition: winerror.h:849
unsigned int BOOL
Definition: ntddk_ex.h:94
RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn)
Definition: rpc_message.c:1131
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
CtxtHandle ctx
Definition: rpc_binding.h:74
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ rpcrt4_conn_np_read()

static int rpcrt4_conn_np_read ( RpcConnection conn,
void buffer,
unsigned int  count 
)
static

Definition at line 431 of file rpc_transport.c.

432 {
433  RpcConnection_np *connection = (RpcConnection_np *) conn;
434  HANDLE event;
436 
437  event = get_np_event(connection);
438  if (!event)
439  return -1;
440 
441  if (connection->read_closed)
443  else
444  status = NtReadFile(connection->pipe, event, NULL, NULL, &connection->io_status, buffer, count, NULL, NULL);
445  if (status == STATUS_PENDING)
446  {
447  /* check read_closed again before waiting to avoid a race */
448  if (connection->read_closed)
449  {
451 #ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
452  NtCancelIoFile(connection->pipe, &io_status);
453 #else
454  NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
455 #endif
456  }
458  status = connection->io_status.u.Status;
459  }
460  release_np_event(connection, event);
461  return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information;
462 }
static HANDLE get_np_event(RpcConnection_np *connection)
Definition: rpc_transport.c:97
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG NTSTATUS
Definition: precomp.h:26
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:54
GLuint buffer
Definition: glext.h:5915
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
IO_STATUS_BLOCK io_status
Definition: rpc_transport.c:86
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE, PIO_STATUS_BLOCK, PIO_STATUS_BLOCK)
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
struct _cl_event * event
Definition: glext.h:7739
static void release_np_event(RpcConnection_np *connection, HANDLE event)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:4018
#define INFINITE
Definition: serial.h:102
static SERVICE_STATUS status
Definition: service.c:31
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
Definition: ps.c:97

Referenced by rpcrt4_conn_np_wait_for_incoming_data().

◆ rpcrt4_conn_np_revert_to_self()

static RPC_STATUS rpcrt4_conn_np_revert_to_self ( RpcConnection conn)
static

Definition at line 672 of file rpc_transport.c.

673 {
674  BOOL ret;
675 
676  TRACE("(%p)\n", conn);
677 
678  if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
679  return RPCRT4_default_revert_to_self(conn);
680 
681  ret = RevertToSelf();
682  if (!ret)
683  {
684  WARN("RevertToSelf failed with error %u\n", GetLastError());
686  }
687  return RPC_S_OK;
688 }
RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn)
Definition: rpc_message.c:1159
#define RPC_S_NO_CONTEXT_AVAILABLE
Definition: winerror.h:1073
BOOL WINAPI RevertToSelf(VOID)
Definition: security.c:1487
#define SecIsValidHandle(x)
Definition: sspi.h:63
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
int ret
CtxtHandle ctx
Definition: rpc_binding.h:74
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ rpcrt4_conn_np_wait_for_incoming_data()

static int rpcrt4_conn_np_wait_for_incoming_data ( RpcConnection conn)
static

Definition at line 530 of file rpc_transport.c.

531 {
532  return rpcrt4_conn_np_read(conn, NULL, 0);
533 }
static int rpcrt4_conn_np_read(RpcConnection *conn, void *buffer, unsigned int count)
smooth NULL
Definition: ftsmooth.c:416

◆ rpcrt4_conn_np_write()

static int rpcrt4_conn_np_write ( RpcConnection conn,
const void buffer,
unsigned int  count 
)
static

Definition at line 464 of file rpc_transport.c.

465 {
466  RpcConnection_np *connection = (RpcConnection_np *) conn;
468  HANDLE event;
470 
471  event = get_np_event(connection);
472  if (!event)
473  return -1;
474 
475  status = NtWriteFile(connection->pipe, event, NULL, NULL, &io_status, buffer, count, NULL, NULL);
476  if (status == STATUS_PENDING)
477  {
479  status = io_status.u.Status;
480  }
481  release_np_event(connection, event);
482  if (status)
483  return -1;
484 
485  assert(io_status.Information == count);
486  return count;
487 }
static HANDLE get_np_event(RpcConnection_np *connection)
Definition: rpc_transport.c:97
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG NTSTATUS
Definition: precomp.h:26
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:54
#define assert(x)
Definition: debug.h:53
GLuint buffer
Definition: glext.h:5915
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
#define STATUS_PENDING
Definition: ntstatus.h:82
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
struct _cl_event * event
Definition: glext.h:7739
static void release_np_event(RpcConnection_np *connection, HANDLE event)
#define INFINITE
Definition: serial.h:102
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ rpcrt4_conn_open_pipe()

static RPC_STATUS rpcrt4_conn_open_pipe ( RpcConnection Connection,
LPCSTR  pname,
BOOL  wait 
)
static

Definition at line 132 of file rpc_transport.c.

133 {
134  RpcConnection_np *npc = (RpcConnection_np *) Connection;
135  HANDLE pipe;
136  DWORD err, dwMode;
137 
138  TRACE("connecting to %s\n", pname);
139 
140  while (TRUE) {
141  DWORD dwFlags = 0;
142  if (Connection->QOS)
143  {
145  switch (Connection->QOS->qos->ImpersonationType)
146  {
148  /* FIXME: what to do here? */
149  break;
152  break;
155  break;
158  break;
161  break;
162  }
163  if (Connection->QOS->qos->IdentityTracking == RPC_C_QOS_IDENTITY_DYNAMIC)
165  }
168  if (pipe != INVALID_HANDLE_VALUE) break;
169  err = GetLastError();
170  if (err == ERROR_PIPE_BUSY) {
172  TRACE("retrying busy server\n");
173  continue;
174  }
175  TRACE("connection failed, error=%x\n", err);
176  return RPC_S_SERVER_TOO_BUSY;
177  }
178  if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
179  err = GetLastError();
180  WARN("connection failed, error=%x\n", err);
182  }
183  }
184 
185  /* success */
186  /* pipe is connected; change to message-read mode. */
187  dwMode = PIPE_READMODE_MESSAGE;
188  SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
189  npc->pipe = pipe;
190 
191  return RPC_S_OK;
192 }
#define TRUE
Definition: types.h:120
#define SECURITY_IDENTIFICATION
Definition: winbase.h:522
#define WARN(fmt,...)
Definition: debug.h:111
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define RPC_C_IMP_LEVEL_ANONYMOUS
Definition: rpcdce.h:174
#define RPC_C_IMP_LEVEL_IDENTIFY
Definition: rpcdce.h:175
#define NMPWAIT_USE_DEFAULT_WAIT
Definition: winbase.h:134
#define RPC_C_IMP_LEVEL_IMPERSONATE
Definition: rpcdce.h:176
BOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
Definition: npipe.c:433
GLenum pname
Definition: glext.h:5645
#define SECURITY_DELEGATION
Definition: winbase.h:524
#define GENERIC_WRITE
Definition: nt_native.h:90
#define NMPWAIT_WAIT_FOREVER
Definition: winbase.h:133
smooth NULL
Definition: ftsmooth.c:416
#define SECURITY_CONTEXT_TRACKING
Definition: winbase.h:525
#define OPEN_EXISTING
Definition: compat.h:434
#define SECURITY_SQOS_PRESENT
Definition: winbase.h:527
#define TRACE(s)
Definition: solgame.cpp:4
#define RPC_C_QOS_IDENTITY_DYNAMIC
Definition: rpcdce.h:181
BOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout)
Definition: npipe.c:774
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ERROR_PIPE_BUSY
Definition: winerror.h:283
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define GENERIC_READ
Definition: compat.h:124
#define err(...)
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
#define SECURITY_ANONYMOUS
Definition: winbase.h:521
#define SECURITY_IMPERSONATION
Definition: winbase.h:523
#define RPC_S_SERVER_TOO_BUSY
Definition: winerror.h:1034
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define RPC_C_IMP_LEVEL_DEFAULT
Definition: rpcdce.h:173
#define RPC_C_IMP_LEVEL_DELEGATE
Definition: rpcdce.h:177
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_ncacn_np_open(), and rpcrt4_ncalrpc_open().

◆ rpcrt4_conn_release_and_wait()

void rpcrt4_conn_release_and_wait ( RpcConnection connection)

Definition at line 3424 of file rpc_transport.c.

3425 {
3426  HANDLE event = NULL;
3427 
3428  if (connection->ref > 1)
3429  event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3430 
3431  RPCRT4_ReleaseConnection(connection);
3432 
3433  if(event)
3434  {
3436  CloseHandle(event);
3437  }
3438 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
void RPCRT4_ReleaseConnection(RpcConnection *connection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
smooth NULL
Definition: ftsmooth.c:416
HANDLE wait_release
Definition: rpc_binding.h:66
struct _cl_event * event
Definition: glext.h:7739
#define INFINITE
Definition: serial.h:102

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_tcp_alloc()

static RpcConnection* rpcrt4_conn_tcp_alloc ( void  )
static

Definition at line 1173 of file rpc_transport.c.

1174 {
1175  RpcConnection_tcp *tcpc;
1177  if (tcpc == NULL)
1178  return NULL;
1179  tcpc->sock = -1;
1180  if (!rpcrt4_sock_wait_init(tcpc))
1181  {
1182  HeapFree(GetProcessHeap(), 0, tcpc);
1183  return NULL;
1184  }
1185  return &tcpc->common;
1186 }
static BOOL rpcrt4_sock_wait_init(RpcConnection_tcp *tcpc)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
RpcConnection common
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ rpcrt4_conn_tcp_cancel_call()

static void rpcrt4_conn_tcp_cancel_call ( RpcConnection conn)
static

Definition at line 1523 of file rpc_transport.c.

1524 {
1525  RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1526 
1527  TRACE("%p\n", connection);
1528 
1529  SetEvent(connection->cancel_event);
1530 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define TRACE(s)
Definition: solgame.cpp:4

◆ rpcrt4_conn_tcp_close()

static int rpcrt4_conn_tcp_close ( RpcConnection conn)
static

Definition at line 1503 of file rpc_transport.c.

1504 {
1505  RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1506 
1507  TRACE("%d\n", connection->sock);
1508 
1509  if (connection->sock != -1)
1510  closesocket(connection->sock);
1511  connection->sock = -1;
1512  CloseHandle(connection->sock_event);
1513  CloseHandle(connection->cancel_event);
1514  return 0;
1515 }
#define CloseHandle
Definition: compat.h:406
#define closesocket
Definition: precomp.h:57
#define TRACE(s)
Definition: solgame.cpp:4

◆ rpcrt4_conn_tcp_close_read()

static void rpcrt4_conn_tcp_close_read ( RpcConnection conn)
static

Definition at line 1517 of file rpc_transport.c.

1518 {
1519  RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1520  shutdown(connection->sock, SD_RECEIVE);
1521 }
INT WSAAPI shutdown(IN SOCKET s, IN INT how)
Definition: sockctrl.c:506
#define SD_RECEIVE
Definition: winsock.h:54

◆ rpcrt4_conn_tcp_handoff()

static RPC_STATUS rpcrt4_conn_tcp_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
static

Definition at line 1417 of file rpc_transport.c.

1418 {
1419  int ret;
1420  struct sockaddr_in address;
1421  socklen_t addrsize;
1424  u_long nonblocking;
1425 
1426  addrsize = sizeof(address);
1427  ret = accept(server->sock, (struct sockaddr*) &address, &addrsize);
1428  if (ret < 0)
1429  {
1430  ERR("Failed to accept a TCP connection: error %d\n", ret);
1431  return RPC_S_OUT_OF_RESOURCES;
1432  }
1433 
1434  nonblocking = 1;
1435  ioctlsocket(ret, FIONBIO, &nonblocking);
1436  client->sock = ret;
1437 
1438  client->common.NetworkAddr = HeapAlloc(GetProcessHeap(), 0, INET6_ADDRSTRLEN);
1439  ret = getnameinfo((struct sockaddr*)&address, addrsize, client->common.NetworkAddr, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
1440  if (ret != 0)
1441  {
1442  ERR("Failed to retrieve the IP address, error %d\n", ret);
1443  return RPC_S_OUT_OF_RESOURCES;
1444  }
1445 
1446  TRACE("Accepted a new TCP connection from %s\n", client->common.NetworkAddr);
1447  return RPC_S_OK;
1448 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
unsigned long u_long
Definition: linux.h:269
#define NI_NUMERICHOST
Definition: ws2def.h:354
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static FILE * client
Definition: client.c:41
GLuint address
Definition: glext.h:9393
int socklen_t
Definition: tcp.c:35
int ret
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
#define FIONBIO
Definition: winsock.h:149
#define ERR(fmt,...)
Definition: debug.h:109
#define ioctlsocket
Definition: precomp.h:58
#define getnameinfo
Definition: wspiapi.h:45
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define INET6_ADDRSTRLEN
Definition: ws2ipdef.h:132
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ rpcrt4_conn_tcp_is_server_listening()

static RPC_STATUS rpcrt4_conn_tcp_is_server_listening ( const char endpoint)
static

Definition at line 1532 of file rpc_transport.c.

1533 {
1534  FIXME("\n");
1535  return RPC_S_ACCESS_DENIED;
1536 }
#define RPC_S_ACCESS_DENIED
Definition: rpcnterr.h:29
#define FIXME(fmt,...)
Definition: debug.h:110

◆ rpcrt4_conn_tcp_read()

static int rpcrt4_conn_tcp_read ( RpcConnection Connection,
void buffer,
unsigned int  count 
)
static

Definition at line 1450 of file rpc_transport.c.

1452 {
1453  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1454  int bytes_read = 0;
1455  while (bytes_read != count)
1456  {
1457  int r = recv(tcpc->sock, (char *)buffer + bytes_read, count - bytes_read, 0);
1458  if (!r)
1459  return -1;
1460  else if (r > 0)
1461  bytes_read += r;
1462  else if (WSAGetLastError() == WSAEINTR)
1463  continue;
1464  else if (WSAGetLastError() != WSAEWOULDBLOCK)
1465  {
1466  WARN("recv() failed: %u\n", WSAGetLastError());
1467  return -1;
1468  }
1469  else
1470  {
1471  if (!rpcrt4_sock_wait_for_recv(tcpc))
1472  return -1;
1473  }
1474  }
1475  TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_read);
1476  return bytes_read;
1477 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
GLuint buffer
Definition: glext.h:5915
#define TRACE(s)
Definition: solgame.cpp:4
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
static BOOL rpcrt4_sock_wait_for_recv(RpcConnection_tcp *tcpc)
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
#define WSAEINTR
Definition: winerror.h:1942

◆ rpcrt4_conn_tcp_wait_for_incoming_data()

static int rpcrt4_conn_tcp_wait_for_incoming_data ( RpcConnection Connection)
static

Definition at line 1538 of file rpc_transport.c.

1539 {
1540  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1541 
1542  TRACE("%p\n", Connection);
1543 
1544  if (!rpcrt4_sock_wait_for_recv(tcpc))
1545  return -1;
1546  return 0;
1547 }
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL rpcrt4_sock_wait_for_recv(RpcConnection_tcp *tcpc)

◆ rpcrt4_conn_tcp_write()

static int rpcrt4_conn_tcp_write ( RpcConnection Connection,
const void buffer,
unsigned int  count 
)
static

Definition at line 1479 of file rpc_transport.c.

1481 {
1482  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1483  int bytes_written = 0;
1484  while (bytes_written != count)
1485  {
1486  int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0);
1487  if (r >= 0)
1488  bytes_written += r;
1489  else if (WSAGetLastError() == WSAEINTR)
1490  continue;
1491  else if (WSAGetLastError() != WSAEWOULDBLOCK)
1492  return -1;
1493  else
1494  {
1495  if (!rpcrt4_sock_wait_for_send(tcpc))
1496  return -1;
1497  }
1498  }
1499  TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_written);
1500  return bytes_written;
1501 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
GLuint buffer
Definition: glext.h:5915
#define TRACE(s)
Definition: solgame.cpp:4
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
static BOOL rpcrt4_sock_wait_for_send(RpcConnection_tcp *tcpc)
#define WSAEINTR
Definition: winerror.h:1942

◆ RPCRT4_CreateConnection()

RPC_STATUS RPCRT4_CreateConnection ( RpcConnection **  Connection,
BOOL  server,
LPCSTR  Protseq,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCWSTR  NetworkOptions,
RpcAuthInfo AuthInfo,
RpcQualityOfService QOS,
LPCWSTR  CookieAuth 
)

Definition at line 3360 of file rpc_transport.c.

3363 {
3364  static LONG next_id;
3365  const struct connection_ops *ops;
3366  RpcConnection* NewConnection;
3367 
3368  ops = rpcrt4_get_conn_protseq_ops(Protseq);
3369  if (!ops)
3370  {
3371  FIXME("not supported for protseq %s\n", Protseq);
3373  }
3374 
3375  NewConnection = ops->alloc();
3376  NewConnection->ref = 1;
3377  NewConnection->server = server;
3378  NewConnection->ops = ops;
3379  NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
3380  NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
3381  NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
3382  NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
3383  NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
3384  NewConnection->NextCallId = 1;
3385 
3386  SecInvalidateHandle(&NewConnection->ctx);
3387  if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3388  NewConnection->AuthInfo = AuthInfo;
3389  NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3391  NewConnection->QOS = QOS;
3392 
3393  list_init(&NewConnection->conn_pool_entry);
3394  list_init(&NewConnection->protseq_entry);
3395 
3396  TRACE("connection: %p\n", NewConnection);
3397  *Connection = NewConnection;
3398 
3399  return RPC_S_OK;
3400 }
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
struct list protseq_entry
Definition: rpc_binding.h:94
static rfbScreenInfoPtr server
Definition: vnc.c:74
USHORT NextCallId
Definition: rpc_binding.h:93
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
static LONG next_id
Definition: changenotify.c:91
const struct connection_ops * ops
Definition: rpc_binding.h:70
struct list conn_pool_entry
Definition: rpc_binding.h:85
#define SecInvalidateHandle(x)
Definition: sspi.h:58
long LONG
Definition: pedump.c:60
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1179
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
#define TRACE(s)
Definition: solgame.cpp:4
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
LPSTR NetworkAddr
Definition: rpc_binding.h:67
LPWSTR CookieAuth
Definition: rpc_binding.h:82
CtxtHandle ctx
Definition: rpc_binding.h:74
RpcConnection *(* alloc)(void)
Definition: rpc_binding.h:102
#define InterlockedIncrement
Definition: armddk.h:53
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
Definition: rpc_binding.c:1356
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
ULONG auth_context_id
Definition: rpc_binding.h:78
struct _QualityOfService QOS
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcAssoc_GetClientConnection(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), rpcrt4_protseq_ncacn_np_open_endpoint(), rpcrt4_protseq_ncalrpc_open_endpoint(), and rpcrt4_spawn_connection().

◆ rpcrt4_get_conn_protseq_ops()

static const struct connection_ops* rpcrt4_get_conn_protseq_ops ( const char protseq)
static

Definition at line 3329 of file rpc_transport.c.

3330 {
3331  unsigned int i;
3332  for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3333  if (!strcmp(conn_protseq_list[i].name, protseq))
3334  return &conn_protseq_list[i];
3335  return NULL;
3336 }
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
smooth NULL
Definition: ftsmooth.c:416
static const struct connection_ops conn_protseq_list[]
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by RpcNetworkIsProtseqValidW(), RPCRT4_CreateConnection(), RPCRT4_IsServerListening(), and RpcTransport_GetTopOfTower().

◆ rpcrt4_get_protseq_ops()

const struct protseq_ops* rpcrt4_get_protseq_ops ( const char protseq)

Definition at line 3320 of file rpc_transport.c.

3321 {
3322  unsigned int i;
3323  for(i = 0; i < ARRAY_SIZE(protseq_list); i++)
3324  if (!strcmp(protseq_list[i].name, protseq))
3325  return &protseq_list[i];
3326  return NULL;
3327 }
static const struct protseq_ops protseq_list[]
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
smooth NULL
Definition: ftsmooth.c:416
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by alloc_serverprotoseq().

◆ RPCRT4_GrabConnection()

RpcConnection* RPCRT4_GrabConnection ( RpcConnection connection)

Definition at line 3440 of file rpc_transport.c.

3441 {
3442  LONG ref = InterlockedIncrement(&connection->ref);
3443  TRACE("%p ref=%u\n", connection, ref);
3444  return connection;
3445 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by RPCRT4_io_thread(), and RPCRT4_server_thread().

◆ rpcrt4_http_async_read()

static int rpcrt4_http_async_read ( HINTERNET  req,
RpcHttpAsyncData async_data,
HANDLE  cancel_event,
void buffer,
unsigned int  count 
)
static

Definition at line 2066 of file rpc_transport.c.

2068 {
2069  char *buf = buffer;
2070  BOOL ret;
2071  unsigned int bytes_left = count;
2073 
2074  async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, count);
2075 
2076  while (bytes_left)
2077  {
2078  async_data->inet_buffers.dwBufferLength = bytes_left;
2079  prepare_async_request(async_data);
2080  ret = InternetReadFileExW(req, &async_data->inet_buffers, IRF_ASYNC, 0);
2081  status = wait_async_request(async_data, ret, cancel_event);
2082  if (status != RPC_S_OK)
2083  {
2085  TRACE("call cancelled\n");
2086  break;
2087  }
2088 
2089  if (!async_data->inet_buffers.dwBufferLength)
2090  break;
2091  memcpy(buf, async_data->inet_buffers.lpvBuffer,
2092  async_data->inet_buffers.dwBufferLength);
2093 
2094  bytes_left -= async_data->inet_buffers.dwBufferLength;
2095  buf += async_data->inet_buffers.dwBufferLength;
2096  }
2097 
2098  HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
2099  async_data->inet_buffers.lpvBuffer = NULL;
2100 
2101  TRACE("%p %p %u -> %u\n", req, buffer, count, status);
2102  return status == RPC_S_OK ? count : -1;
2103 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define IRF_ASYNC
Definition: wininet.h:622
static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
GLuint buffer
Definition: glext.h:5915
INTERNET_BUFFERSW inet_buffers
DWORD dwBufferLength
Definition: wininet.h:278
long RPC_STATUS
Definition: rpc.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static void prepare_async_request(RpcHttpAsyncData *async_data)
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RPC_S_CALL_CANCELLED
Definition: winerror.h:1125
int ret
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2268
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPVOID lpvBuffer
Definition: wininet.h:277
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

Referenced by drain_content(), rpcrt4_http_prepare_out_pipe(), rpcrt4_http_read_http_packet(), rpcrt4_ncacn_http_read(), and send_echo_request().

◆ rpcrt4_http_check_response()

static RPC_STATUS rpcrt4_http_check_response ( HINTERNET  hor)
static

Definition at line 1905 of file rpc_transport.c.

1906 {
1907  BOOL ret;
1909  DWORD size;
1910  DWORD index;
1911  WCHAR buf[32];
1912  WCHAR *status_text = buf;
1913  TRACE("\n");
1914 
1915  index = 0;
1916  size = sizeof(status_code);
1918  if (!ret)
1919  return GetLastError();
1920  if (status_code == HTTP_STATUS_OK)
1921  return RPC_S_OK;
1922  index = 0;
1923  size = sizeof(buf);
1924  ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
1926  {
1927  status_text = HeapAlloc(GetProcessHeap(), 0, size);
1928  ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
1929  }
1930 
1931  ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
1932  if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text);
1933 
1935  return ERROR_ACCESS_DENIED;
1936  return RPC_S_SERVER_UNAVAILABLE;
1937 }
#define HTTP_QUERY_STATUS_TEXT
Definition: wininet.h:1543
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
struct status_code status_code
#define ERROR_ACCESS_DENIED
Definition: compat.h:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
GLuint index
Definition: glext.h:6031
#define HTTP_STATUS_DENIED
Definition: winhttp.h:256
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HTTP_STATUS_OK
Definition: winhttp.h:240
int ret
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3883
#define index(s, c)
Definition: various.h:29
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define ERR(fmt,...)
Definition: debug.h:109
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by authorize_request(), rpcrt4_http_prepare_out_pipe(), rpcrt4_ncacn_http_open(), and send_echo_request().

◆ rpcrt4_http_internet_callback()

static VOID WINAPI rpcrt4_http_internet_callback ( HINTERNET  hInternet,
DWORD_PTR  dwContext,
DWORD  dwInternetStatus,
LPVOID  lpvStatusInformation,
DWORD  dwStatusInformationLength 
)
static

Definition at line 1880 of file rpc_transport.c.

1886 {
1887  RpcHttpAsyncData *async_data = (RpcHttpAsyncData *)dwContext;
1888 
1889  switch (dwInternetStatus)
1890  {
1892  TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n");
1893  if (async_data)
1894  {
1895  INTERNET_ASYNC_RESULT *async_result = lpvStatusInformation;
1896 
1897  async_data->async_result = async_result->dwResult ? ERROR_SUCCESS : async_result->dwError;
1898  SetEvent(async_data->completion_event);
1899  RpcHttpAsyncData_Release(async_data);
1900  }
1901  break;
1902  }
1903 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static ULONG RpcHttpAsyncData_Release(RpcHttpAsyncData *data)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define TRACE(s)
Definition: solgame.cpp:4
DWORD_PTR dwResult
Definition: wininet.h:155
#define INTERNET_STATUS_REQUEST_COMPLETE
Definition: wininet.h:898

Referenced by rpcrt4_http_internet_connect().

◆ rpcrt4_http_internet_connect()

static RPC_STATUS rpcrt4_http_internet_connect ( RpcConnection_http httpc)
static

Definition at line 1939 of file rpc_transport.c.

1940 {
1941  static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0};
1942  LPWSTR proxy = NULL;
1943  LPWSTR user = NULL;
1944  LPWSTR password = NULL;
1945  LPWSTR servername = NULL;
1946  const WCHAR *option;
1948 
1949  if (httpc->common.QOS &&
1951  {
1952  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_cred = httpc->common.QOS->qos->u.HttpCredentials;
1953  if (http_cred->TransportCredentials)
1954  {
1955  WCHAR *p;
1956  const SEC_WINNT_AUTH_IDENTITY_W *cred = http_cred->TransportCredentials;
1957  ULONG len = cred->DomainLength + 1 + cred->UserLength;
1958  user = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
1959  if (!user)
1960  return RPC_S_OUT_OF_RESOURCES;
1961  p = user;
1962  if (cred->DomainLength)
1963  {
1964  memcpy(p, cred->Domain, cred->DomainLength * sizeof(WCHAR));
1965  p += cred->DomainLength;
1966  *p = '\\';
1967  p++;
1968  }
1969  memcpy(p, cred->User, cred->UserLength * sizeof(WCHAR));
1970  p[cred->UserLength] = 0;
1971 
1973  }
1974  }
1975 
1976  for (option = httpc->common.NetworkOptions; option;
1977  option = (wcschr(option, ',') ? wcschr(option, ',')+1 : NULL))
1978  {
1979  static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
1980  static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
1981 
1982  if (!_wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
1983  {
1984  const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
1985  const WCHAR *value_end;
1986  const WCHAR *p;
1987 
1988  value_end = wcschr(option, ',');
1989  if (!value_end)
1990  value_end = value_start + lstrlenW(value_start);
1991  for (p = value_start; p < value_end; p++)
1992  if (*p == ':')
1993  {
1994  port = wcstol(p+1, NULL, 10);
1995  value_end = p;
1996  break;
1997  }
1998  TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
1999  servername = RPCRT4_strndupW(value_start, value_end-value_start);
2000  }
2001  else if (!_wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
2002  {
2003  const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
2004  const WCHAR *value_end;
2005 
2006  value_end = wcschr(option, ',');
2007  if (!value_end)
2008  value_end = value_start + lstrlenW(value_start);
2009  TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
2010  proxy = RPCRT4_strndupW(value_start, value_end-value_start);
2011  }
2012  else
2013  FIXME("unhandled option %s\n", debugstr_w(option));
2014  }
2015 
2018  if (!httpc->app_info)
2019  {
2021  HeapFree(GetProcessHeap(), 0, user);
2022  HeapFree(GetProcessHeap(), 0, proxy);
2023  HeapFree(GetProcessHeap(), 0, servername);
2024  ERR("InternetOpenW failed with error %d\n", GetLastError());
2025  return RPC_S_SERVER_UNAVAILABLE;
2026  }
2028 
2029  /* if no RpcProxy option specified, set the HTTP server address to the
2030  * RPC server address */
2031  if (!servername)
2032  {
2033  servername = HeapAlloc(GetProcessHeap(), 0, (strlen(httpc->common.NetworkAddr) + 1)*sizeof(WCHAR));
2034  if (!servername)
2035  {
2037  HeapFree(GetProcessHeap(), 0, user);
2038  HeapFree(GetProcessHeap(), 0, proxy);
2039  return RPC_S_OUT_OF_RESOURCES;
2040  }
2041  MultiByteToWideChar(CP_ACP, 0, httpc->common.NetworkAddr, -1, servername, strlen(httpc->common.NetworkAddr) + 1);
2042  }
2043 
2044  port = (httpc->common.QOS &&
2048 
2049  httpc->session = InternetConnectW(httpc->app_info, servername, port, user, password,
2050  INTERNET_SERVICE_HTTP, 0, 0);
2051 
2053  HeapFree(GetProcessHeap(), 0, user);
2054  HeapFree(GetProcessHeap(), 0, proxy);
2055 
2056  if (!httpc->session)
2057  {
2058  ERR("InternetConnectW failed with error %d\n", GetLastError());
2059  HeapFree(GetProcessHeap(), 0, servername);
2060  return RPC_S_SERVER_UNAVAILABLE;
2061  }
2062  httpc->servername = servername;
2063  return RPC_S_OK;
2064 }
union _RPC_SECURITY_QOS_V2_W::@3107 u
unsigned short * Domain
Definition: rpcdce.h:225
int proxy
Definition: main.c:67
static VOID WINAPI rpcrt4_http_internet_callback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
unsigned short * User
Definition: rpcdce.h:223
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned short * Password
Definition: rpcdce.h:227
#define CP_ACP
Definition: compat.h:99
RpcConnection common
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define lstrlenW
Definition: compat.h:415
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
WORD INTERNET_PORT
Definition: winhttp.h:38
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
GLuint GLenum option
Definition: glext.h:11211
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2097
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
LPSTR NetworkAddr
Definition: rpc_binding.h:67
#define INTERNET_FLAG_ASYNC
Definition: wininet.h:64
T1_FIELD_DICT_PRIVATE password
Definition: t1tokens.h:64
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
#define debugstr_wn
Definition: kernel32.h:33
#define ERR(fmt,...)
Definition: debug.h:109
#define INTERNET_DEFAULT_HTTPS_PORT
Definition: winhttp.h:37
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
#define ARRAY_SIZE(a)
Definition: main.h:24
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define MultiByteToWideChar
Definition: compat.h:100
#define RPC_C_HTTP_FLAG_USE_SSL
Definition: rpcdce.h:198
unsigned int ULONG
Definition: retypes.h:1
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1280
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:91
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1001
USHORT port
Definition: uri.c:228
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_ncacn_http_open().

◆ rpcrt4_http_keep_connection_active_timer_proc()

static VOID rpcrt4_http_keep_connection_active_timer_proc ( PVOID  param,
BOOLEAN  dummy 
)
static

Definition at line 1835 of file rpc_transport.c.

1836 {
1837  HINTERNET in_request = param;
1838  RpcPktHdr *idle_pkt;
1839 
1841  0, 0);
1842  if (idle_pkt)
1843  {
1844  DWORD bytes_written;
1845  InternetWriteFile(in_request, idle_pkt, idle_pkt->common.frag_len, &bytes_written);
1846  RPCRT4_FreeHeader(idle_pkt);
1847  }
1848 }
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
RpcPktCommonHdr common
Definition: rpc_defs.h:152
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2134
unsigned short frag_len
Definition: rpc_defs.h:33
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
RpcPktHdr * RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size)
Definition: rpc_message.c:291

Referenced by rpcrt4_http_timer_thread().

◆ rpcrt4_http_prepare_in_pipe()

static RPC_STATUS rpcrt4_http_prepare_in_pipe ( HINTERNET  in_request,
RpcHttpAsyncData async_data,
HANDLE  cancel_event,
const UUID connection_uuid,
const UUID in_pipe_uuid,
const UUID association_uuid,
BOOL  authorized 
)
static

Definition at line 2139 of file rpc_transport.c.

2142 {
2143  BOOL ret;
2145  RpcPktHdr *hdr;
2146  INTERNET_BUFFERSW buffers_in;
2147  DWORD bytes_written;
2148 
2149  if (!authorized)
2150  {
2151  /* ask wininet to authorize, if necessary */
2152  status = send_echo_request(in_request, async_data, cancel_event);
2153  if (status != RPC_S_OK) return status;
2154  }
2155  memset(&buffers_in, 0, sizeof(buffers_in));
2156  buffers_in.dwStructSize = sizeof(buffers_in);
2157  /* FIXME: get this from the registry */
2158  buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */
2159  status = insert_content_length_header(in_request, buffers_in.dwBufferTotal);
2160  if (status != RPC_S_OK) return status;
2161 
2162  prepare_async_request(async_data);
2163  ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0);
2164  status = wait_async_request(async_data, ret, cancel_event);
2165  if (status != RPC_S_OK) return status;
2166 
2167  TRACE("sending HTTP connect header to server\n");
2168  hdr = RPCRT4_BuildHttpConnectHeader(FALSE, connection_uuid, in_pipe_uuid, association_uuid);
2169  if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2170  ret = InternetWriteFile(in_request, hdr, hdr->common.frag_len, &bytes_written);
2172  if (!ret)
2173  {
2174  ERR("InternetWriteFile failed with error %d\n", GetLastError());
2175  return RPC_S_SERVER_UNAVAILABLE;
2176  }
2177 
2178  return RPC_S_OK;
2179 }
DWORD dwStructSize
Definition: wininet.h:272
static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event)
char hdr[14]
Definition: iptest.cpp:33
DWORD dwBufferTotal
Definition: wininet.h:279
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
long RPC_STATUS
Definition: rpc.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
RpcPktHdr * RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid)
Definition: rpc_message.c:344
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5536
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2134
static void prepare_async_request(RpcHttpAsyncData *async_data)
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define memset(x, y, z)
Definition: compat.h:39
static SERVICE_STATUS status
Definition: service.c:31
#define RPC_S_OK
Definition: rpcnterr.h:22
static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
Definition: ps.c:97

Referenced by rpcrt4_ncacn_http_open().

◆ rpcrt4_http_prepare_out_pipe()

static RPC_STATUS rpcrt4_http_prepare_out_pipe ( HINTERNET  out_request,
RpcHttpAsyncData async_data,
HANDLE  cancel_event,
const UUID connection_uuid,
const UUID out_pipe_uuid,
ULONG flow_control_increment,
BOOL  authorized 
)
static

Definition at line 2226 of file rpc_transport.c.

2230 {
2231  BOOL ret;
2233  RpcPktHdr *hdr;
2234  BYTE *data_from_server;
2235  RpcPktHdr pkt_from_server;
2236  ULONG field1, field3;
2237  BYTE buf[20];
2238 
2239  if (!authorized)
2240  {
2241  /* ask wininet to authorize, if necessary */
2242  status = send_echo_request(out_request, async_data, cancel_event);
2243  if (status != RPC_S_OK) return status;
2244  }
2245  else
2246  rpcrt4_http_async_read(out_request, async_data, cancel_event, buf, sizeof(buf));
2247 
2248  hdr = RPCRT4_BuildHttpConnectHeader(TRUE, connection_uuid, out_pipe_uuid, NULL);
2249  if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2250 
2251  status = insert_content_length_header(out_request, hdr->common.frag_len);
2252  if (status != RPC_S_OK)
2253  {
2255  return status;
2256  }
2257 
2258  TRACE("sending HTTP connect header to server\n");
2259  prepare_async_request(async_data);
2260  ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len);
2261  status = wait_async_request(async_data, ret, cancel_event);
2263  if (status != RPC_S_OK) return status;
2264 
2265  status = rpcrt4_http_check_response(out_request);
2266  if (status != RPC_S_OK) return status;
2267 
2268  status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2269  &pkt_from_server, &data_from_server);
2270  if (status != RPC_S_OK) return status;
2271  status = RPCRT4_ParseHttpPrepareHeader1(&pkt_from_server, data_from_server,
2272  &field1);
2273  HeapFree(GetProcessHeap(), 0, data_from_server);
2274  if (status != RPC_S_OK) return status;
2275  TRACE("received (%d) from first prepare header\n", field1);
2276 
2277  for (;;)
2278  {
2279  status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2280  &pkt_from_server, &data_from_server);
2281  if (status != RPC_S_OK) return status;
2282  if (pkt_from_server.http.flags != 0x0001) break;
2283 
2284  TRACE("http idle packet, waiting for real packet\n");
2285  HeapFree(GetProcessHeap(), 0, data_from_server);
2286  if (pkt_from_server.http.num_data_items != 0)
2287  {
2288  ERR("HTTP idle packet should have no data items instead of %d\n",
2289  pkt_from_server.http.num_data_items);
2290  return RPC_S_PROTOCOL_ERROR;
2291  }
2292  }
2293  status = RPCRT4_ParseHttpPrepareHeader2(&pkt_from_server, data_from_server,
2294  &field1, flow_control_increment,
2295  &field3);
2296  HeapFree(GetProcessHeap(), 0, data_from_server);
2297  if (status != RPC_S_OK) return status;
2298  TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1, *flow_control_increment, field3);
2299 
2300  return RPC_S_OK;
2301 }
static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event)
static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event, void *buffer, unsigned int count)
#define TRUE
Definition: types.h:120
char hdr[14]
Definition: iptest.cpp:33
RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, unsigned char *data, ULONG *field1)
Definition: rpc_message.c:566
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
long RPC_STATUS
Definition: rpc.h:52
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short flags
Definition: rpc_defs.h:138
RpcPktHdr * RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid)
Definition: rpc_message.c:344
smooth NULL
Definition: ftsmooth.c:416
static RPC_STATUS rpcrt4_http_read_http_packet(HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event, RpcPktHdr *hdr, BYTE **data)
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5631
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
static void prepare_async_request(RpcHttpAsyncData *async_data)
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
int ret
unsigned char BYTE
Definition: mem.h:68
RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, unsigned char *data, ULONG *field1, ULONG *bytes_until_next_packet, ULONG *field3)
Definition: rpc_message.c:591
RpcPktHttpHdr http
Definition: rpc_defs.h:159
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
unsigned int ULONG
Definition: retypes.h:1
static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
unsigned short num_data_items
Definition: rpc_defs.h:139
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22
static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
Definition: ps.c:97

Referenced by rpcrt4_ncacn_http_open().

◆ rpcrt4_http_read_http_packet()

static RPC_STATUS rpcrt4_http_read_http_packet ( HINTERNET  request,
RpcHttpAsyncData async_data,
HANDLE  cancel_event,
RpcPktHdr hdr,
BYTE **  data 
)
static

Definition at line 2181 of file rpc_transport.c.

2183 {
2184  unsigned short data_len;
2185  unsigned int size;
2186 
2187  if (rpcrt4_http_async_read(request, async_data, cancel_event, hdr, sizeof(hdr->common)) < 0)
2188  return RPC_S_SERVER_UNAVAILABLE;
2189  if (hdr->common.ptype != PKT_HTTP || hdr->common.frag_len < sizeof(hdr->http))
2190  {
2191  ERR("wrong packet type received %d or wrong frag_len %d\n",
2192  hdr->common.ptype, hdr->common.frag_len);
2193  return RPC_S_PROTOCOL_ERROR;
2194  }
2195 
2196  size = sizeof(hdr->http) - sizeof(hdr->common);
2197  if (rpcrt4_http_async_read(request, async_data, cancel_event, &hdr->common + 1, size) < 0)
2198  return RPC_S_SERVER_UNAVAILABLE;
2199 
2200  data_len = hdr->common.frag_len - sizeof(hdr->http);
2201  if (data_len)
2202  {
2203  *data = HeapAlloc(GetProcessHeap(), 0, data_len);
2204  if (!*data)
2205  return RPC_S_OUT_OF_RESOURCES;
2206  if (rpcrt4_http_async_read(request, async_data, cancel_event, *data, data_len) < 0)
2207  {
2208  HeapFree(GetProcessHeap(), 0, *data);
2209  return RPC_S_SERVER_UNAVAILABLE;
2210  }
2211  }
2212  else
2213  *data = NULL;
2214 
2215  if (!RPCRT4_IsValidHttpPacket(hdr, *data, data_len))
2216  {
2217  ERR("invalid http packet\n");
2218  HeapFree(GetProcessHeap(), 0, *data);
2219  return RPC_S_PROTOCOL_ERROR;
2220  }
2221 
2222  return RPC_S_OK;
2223 }
static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event, void *buffer, unsigned int count)
char hdr[14]
Definition: iptest.cpp:33
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
smooth NULL
Definition: ftsmooth.c:416
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ERR(fmt,...)
Definition: debug.h:109
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
Definition: tftpd.h:85
BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, unsigned short data_len)
Definition: rpc_message.c:483
#define HeapFree(x, y, z)
Definition: compat.h:402
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_http_prepare_out_pipe().

◆ rpcrt4_http_timer_calc_timeout()

static DWORD rpcrt4_http_timer_calc_timeout ( DWORD last_sent_time)
inlinestatic

Definition at line 1850 of file rpc_transport.c.

1851 {
1853  DWORD cached_last_sent_time = *last_sent_time;
1854  return HTTP_IDLE_TIME - (cur_time - cached_last_sent_time > HTTP_IDLE_TIME ? 0 : cur_time - cached_last_sent_time);
1855 }
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
time_t cur_time
#define HTTP_IDLE_TIME
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by rpcrt4_http_timer_thread().

◆ rpcrt4_http_timer_thread()

static DWORD CALLBACK rpcrt4_http_timer_thread ( PVOID  param)
static

Definition at line 1857 of file rpc_transport.c.

1858 {
1859  HttpTimerThreadData *data_in = param;
1861  DWORD timeout;
1862 
1863  data = *data_in;
1864  HeapFree(GetProcessHeap(), 0, data_in);
1865 
1866  for (timeout = HTTP_IDLE_TIME;
1867  WaitForSingleObject(data.timer_cancelled, timeout) == WAIT_TIMEOUT;
1868  timeout = rpcrt4_http_timer_calc_timeout(data.last_sent_time))
1869  {
1870  /* are we too soon after last send? */
1871  if (GetTickCount() - *data.last_sent_time < HTTP_IDLE_TIME)
1872  continue;
1874  }
1875 
1876  CloseHandle(data.timer_cancelled);
1877  return 0;
1878 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define HTTP_IDLE_TIME
Definition: dhcpd.h:245
GLbitfield GLuint64 timeout
Definition: glext.h:7164
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define GetProcessHeap()
Definition: compat.h:403
GLfloat param
Definition: glext.h:5796
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define WAIT_TIMEOUT
Definition: dderror.h:14
static VOID rpcrt4_http_keep_connection_active_timer_proc(PVOID param, BOOLEAN dummy)
static DWORD rpcrt4_http_timer_calc_timeout(DWORD *last_sent_time)
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by rpcrt4_ncacn_http_open().

◆ rpcrt4_ip_tcp_get_top_of_tower()

static size_t rpcrt4_ip_tcp_get_top_of_tower ( unsigned char tower_data,
const char networkaddr,
unsigned char  tcp_protid,
const char endpoint 
)
static

Definition at line 962 of file rpc_transport.c.

966 {
967  twr_tcp_floor_t *tcp_floor;
968  twr_ipv4_floor_t *ipv4_floor;
969  struct addrinfo *ai;
970  struct addrinfo hints;
971  int ret;
972  size_t size = sizeof(*tcp_floor) + sizeof(*ipv4_floor);
973 
974  TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint);
975 
976  if (!tower_data)
977  return size;
978 
979  tcp_floor = (twr_tcp_floor_t *)tower_data;
980  tower_data += sizeof(*tcp_floor);
981 
982  ipv4_floor = (twr_ipv4_floor_t *)tower_data;
983 
984  tcp_floor->count_lhs = sizeof(tcp_floor->protid);
985  tcp_floor->protid = tcp_protid;
986  tcp_floor->count_rhs = sizeof(tcp_floor->port);
987 
988  ipv4_floor->count_lhs = sizeof(ipv4_floor->protid);
989  ipv4_floor->protid = EPM_PROTOCOL_IP;
990  ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr);
991 
992  hints.ai_flags = AI_NUMERICHOST;
993  /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */
994  hints.ai_family = PF_INET;
995  hints.ai_socktype = SOCK_STREAM;
996  hints.ai_protocol = IPPROTO_TCP;
997  hints.ai_addrlen = 0;
998  hints.ai_addr = NULL;
999  hints.ai_canonname = NULL;
1000  hints.ai_next = NULL;
1001 
1002  ret = getaddrinfo(networkaddr, endpoint, &hints, &ai);
1003  if (ret)
1004  {
1005  ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai);
1006  if (ret)
1007  {
1008  ERR("getaddrinfo failed: %s\n", gai_strerror(ret));
1009  return 0;
1010  }
1011  }
1012 
1013  if (ai->ai_family == PF_INET)
1014  {
1015  const struct sockaddr_in *sin = (const struct sockaddr_in *)ai->ai_addr;
1016  tcp_floor->port = sin->sin_port;
1017  ipv4_floor->ipv4addr = sin->sin_addr.s_addr;
1018  }
1019  else
1020  {
1021  ERR("unexpected protocol family %d\n", ai->ai_family);
1022  freeaddrinfo(ai);
1023  return 0;
1024  }
1025 
1026  freeaddrinfo(ai);
1027 
1028  return size;
1029 }
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
#define freeaddrinfo
Definition: wspiapi.h:46
u_int16 port
Definition: epm_towers.h:70
#define EPM_PROTOCOL_IP
Definition: epm_towers.h:31
smooth NULL
Definition: ftsmooth.c:416
#define PF_INET
Definition: winsock.h:373
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define gai_strerror
Definition: ws2tcpip.h:521
int ret
#define ERR(fmt,...)
Definition: debug.h:109
u_int16 count_lhs
Definition: epm_towers.h:67
#define AI_NUMERICHOST
Definition: ws2def.h:295
Definition: nis.h:10
u_int16 count_rhs
Definition: epm_towers.h:69
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
#define SOCK_STREAM
Definition: tcpip.h:118
struct sockaddr * ai_addr
Definition: ws2def.h:671
#define getaddrinfo
Definition: wspiapi.h:44
int ai_family
Definition: ws2def.h:666

Referenced by rpcrt4_ncacn_http_get_top_of_tower(), and rpcrt4_ncacn_ip_tcp_get_top_of_tower().

◆ rpcrt4_ip_tcp_parse_top_of_tower()

static RPC_STATUS rpcrt4_ip_tcp_parse_top_of_tower ( const unsigned char tower_data,
size_t  tower_size,
char **  networkaddr,
unsigned char  tcp_protid,
char **  endpoint 
)
static

Definition at line 1031 of file rpc_transport.c.

1036 {
1037  const twr_tcp_floor_t *tcp_floor = (const twr_tcp_floor_t *)tower_data;
1038  const twr_ipv4_floor_t *ipv4_floor;
1039  struct in_addr in_addr;
1040 
1041  TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint);
1042 
1043  if (tower_size < sizeof(*tcp_floor))
1044  return EPT_S_NOT_REGISTERED;
1045 
1046  tower_data += sizeof(*tcp_floor);
1047  tower_size -= sizeof(*tcp_floor);
1048 
1049  if (tower_size < sizeof(*ipv4_floor))
1050  return EPT_S_NOT_REGISTERED;
1051 
1052  ipv4_floor = (const twr_ipv4_floor_t *)tower_data;
1053 
1054  if ((tcp_floor->count_lhs != sizeof(tcp_floor->protid)) ||
1055  (tcp_floor->protid != tcp_protid) ||
1056  (tcp_floor->count_rhs != sizeof(tcp_floor->port)) ||
1057  (ipv4_floor->count_lhs != sizeof(ipv4_floor->protid)) ||
1058  (ipv4_floor->protid != EPM_PROTOCOL_IP) ||
1059  (ipv4_floor->count_rhs != sizeof(ipv4_floor->ipv4addr)))
1060  return EPT_S_NOT_REGISTERED;
1061 
1062  if (endpoint)
1063  {
1064  *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */);
1065  if (!*endpoint)
1066  return RPC_S_OUT_OF_RESOURCES;
1067  sprintf(*endpoint, "%u", ntohs(tcp_floor->port));
1068  }
1069 
1070  if (networkaddr)
1071  {
1072  *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN);
1073  if (!*networkaddr)
1074  {
1075  if (endpoint)
1076  {
1077  I_RpcFree(*endpoint);
1078  *endpoint = NULL;
1079  }
1080  return RPC_S_OUT_OF_RESOURCES;
1081  }
1082  in_addr.s_addr = ipv4_floor->ipv4addr;
1083  if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN))
1084  {
1085  ERR("inet_ntop: %u\n", WSAGetLastError());
1086  I_RpcFree(*networkaddr);
1087  *networkaddr = NULL;
1088  if (endpoint)
1089  {
1090  I_RpcFree(*endpoint);
1091  *endpoint = NULL;
1092  }
1093  return EPT_S_NOT_REGISTERED;
1094  }
1095  }
1096 
1097  return RPC_S_OK;
1098 }
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:722
u_int16 count_rhs
Definition: epm_towers.h:77
u_int32 ipv4addr
Definition: epm_towers.h:78
u32_t s_addr
Definition: inet.h:45
#define ntohs(x)
Definition: module.h:208
u_int16 port
Definition: epm_towers.h:70
#define sprintf(buf, format,...)
Definition: sprintf.c:55
#define EPM_PROTOCOL_IP
Definition: epm_towers.h:31
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
INT WSAAPI WSAGetLastError(VOID)
Definition: dllmain.c:112
Definition: tcpip.h:125
#define INET_ADDRSTRLEN
Definition: ws2ipdef.h:131
#define ERR(fmt,...)
Definition: debug.h:109
u_int16 count_lhs
Definition: epm_towers.h:67
Definition: nis.h:10
u_int16 count_rhs
Definition: epm_towers.h:69
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1061
#define AF_INET
Definition: tcpip.h:117
u_int16 count_lhs
Definition: epm_towers.h:75
const char *WSAAPI inet_ntop(int af, const void *src, char *dst, size_t cnt)
Definition: unix_func.c:8
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:714
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by rpcrt4_ncacn_http_parse_top_of_tower(), and rpcrt4_ncacn_ip_tcp_parse_top_of_tower().

◆ RPCRT4_IsServerListening()

RPC_STATUS RPCRT4_IsServerListening ( const char protseq,
const char endpoint 
)

Definition at line 3490 of file rpc_transport.c.

3491 {
3492  const struct connection_ops *ops;
3493 
3494  ops = rpcrt4_get_conn_protseq_ops(protseq);
3495  if (!ops)
3496  {
3497  FIXME("not supported for protseq %s\n", protseq);
3498  return RPC_S_INVALID_BINDING;
3499  }
3500 
3501  return ops->is_server_listening(endpoint);
3502 }
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
#define FIXME(fmt,...)
Definition: debug.h:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
Definition: nis.h:10

Referenced by RpcMgmtIsServerListening().

◆ rpcrt4_ncacn_http_alloc()

static RpcConnection* rpcrt4_ncacn_http_alloc ( void  )
static

Definition at line 1808 of file rpc_transport.c.

1809 {
1810  RpcConnection_http *httpc;
1811  httpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*httpc));
1812  if (!httpc) return NULL;
1814  if (!httpc->async_data)
1815  {
1816  HeapFree(Ge