ReactOS  0.4.13-dev-455-g28ed234
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 "wine/unicode.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 *Connection)
 
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 58 of file rpc_transport.c.

◆ HTTP_IDLE_TIME

#define HTTP_IDLE_TIME   60000

Definition at line 1707 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 2417 of file rpc_transport.c.

2418 {
2419  struct authinfo *ret;
2420 
2421  if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret) ))) return NULL;
2422 
2423  SecInvalidateHandle(&ret->cred);
2424  SecInvalidateHandle(&ret->ctx);
2425  memset(&ret->exp, 0, sizeof(ret->exp));
2426  ret->scheme = 0;
2427  ret->attr = 0;
2428  ret->max_token = 0;
2429  ret->data = NULL;
2430  ret->data_len = 0;
2431  ret->finished = FALSE;
2432  return ret;
2433 }
#define SecInvalidateHandle(x)
Definition: sspi.h:58
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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 2469 of file rpc_transport.c.

2470 {
2471  unsigned int i;
2472  for (i = 0; i < ARRAY_SIZE(auth_schemes); i++)
2473  {
2475  (header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
2476  }
2477  return 0;
2478 }
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
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 @508 auth_schemes[]
struct CFHEADER header
Definition: fdi.c:109

Referenced by do_authorization(), and get_authvalue().

◆ authorize_request()

static RPC_STATUS authorize_request ( RpcConnection_http httpc,
HINTERNET  request 
)
static

Definition at line 2701 of file rpc_transport.c.

2702 {
2703  static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':','\r','\n',0};
2704  struct authinfo *info = NULL;
2706  BOOL ret;
2707 
2708  for (;;)
2709  {
2711  if (status != RPC_S_OK) break;
2712 
2713  status = insert_authorization_header(request, info->scheme, info->data, info->data_len);
2714  if (status != RPC_S_OK) break;
2715 
2717  ret = HttpSendRequestW(request, NULL, 0, NULL, 0);
2719  if (status != RPC_S_OK || info->finished) break;
2720 
2722  if (status != RPC_S_OK && status != ERROR_ACCESS_DENIED) break;
2723  drain_content(request, httpc->async_data, httpc->cancel_event);
2724  }
2725 
2726  if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
2728 
2730  return status;
2731 }
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
union _RPC_SECURITY_QOS_V2_W::@3079 u
#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:5565
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:1354
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 2355 of file rpc_transport.c.

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

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

Referenced by decode_base64().

◆ destroy_authinfo()

static void destroy_authinfo ( struct authinfo info)
static

Definition at line 2435 of file rpc_transport.c.

2436 {
2437  if (!info) return;
2438 
2439  if (SecIsValidHandle(&info->ctx))
2440  DeleteSecurityContext(&info->ctx);
2441  if (SecIsValidHandle(&info->cred))
2442  FreeCredentialsHandle(&info->cred);
2443 
2444  HeapFree(GetProcessHeap(), 0, info->data);
2445  HeapFree(GetProcessHeap(), 0, info);
2446 }
#define SecIsValidHandle(x)
Definition: sspi.h:63
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394
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 2492 of file rpc_transport.c.

2494 {
2495  struct authinfo *info = *auth_ptr;
2498 
2499  if ((!info && !(info = alloc_authinfo()))) return RPC_S_SERVER_UNAVAILABLE;
2500 
2501  switch (creds->AuthnSchemes[0])
2502  {
2504  {
2505  int userlen = WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, NULL, 0, NULL, NULL);
2506  int passlen = WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, NULL, 0, NULL, NULL);
2507 
2508  info->data_len = userlen + passlen + 1;
2509  if (!(info->data = HeapAlloc(GetProcessHeap(), 0, info->data_len)))
2510  {
2512  break;
2513  }
2514  WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, info->data, userlen, NULL, NULL);
2515  info->data[userlen] = ':';
2516  WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, info->data + userlen + 1, passlen, NULL, NULL);
2517 
2519  info->finished = TRUE;
2520  status = RPC_S_OK;
2521  break;
2522  }
2525  {
2526 
2527  static SEC_WCHAR ntlmW[] = {'N','T','L','M',0}, negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
2529  SecBufferDesc out_desc, in_desc;
2530  SecBuffer out, in;
2532  SEC_WCHAR *scheme;
2533  int scheme_len;
2534  const WCHAR *p;
2535  WCHAR auth_value[2048];
2536  DWORD size = sizeof(auth_value);
2537  BOOL first = FALSE;
2538 
2540  else scheme = negotiateW;
2541  scheme_len = strlenW( scheme );
2542 
2543  if (!*auth_ptr)
2544  {
2545  TimeStamp exp;
2546  SecPkgInfoW *pkg_info;
2547 
2549  if (ret != SEC_E_OK) break;
2550 
2551  ret = QuerySecurityPackageInfoW(scheme, &pkg_info);
2552  if (ret != SEC_E_OK) break;
2553 
2554  info->max_token = pkg_info->cbMaxToken;
2555  FreeContextBuffer(pkg_info);
2556  first = TRUE;
2557  }
2558  else
2559  {
2560  if (info->finished || !get_authvalue(request, creds->AuthnSchemes[0], auth_value, size)) break;
2561  if (auth_scheme_from_header(auth_value) != info->scheme)
2562  {
2563  ERR("authentication scheme changed\n");
2564  break;
2565  }
2566  }
2567  in.BufferType = SECBUFFER_TOKEN;
2568  in.cbBuffer = 0;
2569  in.pvBuffer = NULL;
2570 
2571  in_desc.ulVersion = 0;
2572  in_desc.cBuffers = 1;
2573  in_desc.pBuffers = &in;
2574 
2575  p = auth_value + scheme_len;
2576  if (!first && *p == ' ')
2577  {
2578  int len = strlenW(++p);
2579  in.cbBuffer = decode_base64(p, len, NULL);
2580  if (!(in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer))) break;
2581  decode_base64(p, len, in.pvBuffer);
2582  }
2583  out.BufferType = SECBUFFER_TOKEN;
2584  out.cbBuffer = info->max_token;
2585  if (!(out.pvBuffer = HeapAlloc(GetProcessHeap(), 0, out.cbBuffer)))
2586  {
2587  HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2588  break;
2589  }
2590  out_desc.ulVersion = 0;
2591  out_desc.cBuffers = 1;
2592  out_desc.pBuffers = &out;
2593 
2594  ret = InitializeSecurityContextW(first ? &info->cred : NULL, first ? NULL : &info->ctx,
2595  first ? servername : NULL, flags, 0, SECURITY_NETWORK_DREP,
2596  in.pvBuffer ? &in_desc : NULL, 0, &info->ctx, &out_desc,
2597  &info->attr, &info->exp);
2598  HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2599  if (ret == SEC_E_OK)
2600  {
2601  HeapFree(GetProcessHeap(), 0, info->data);
2602  info->data = out.pvBuffer;
2603  info->data_len = out.cbBuffer;
2604  info->finished = TRUE;
2605  TRACE("sending last auth packet\n");
2606  status = RPC_S_OK;
2607  }
2608  else if (ret == SEC_I_CONTINUE_NEEDED)
2609  {
2610  HeapFree(GetProcessHeap(), 0, info->data);
2611  info->data = out.pvBuffer;
2612  info->data_len = out.cbBuffer;
2613  TRACE("sending next auth packet\n");
2614  status = RPC_S_OK;
2615  }
2616  else
2617  {
2618  ERR("InitializeSecurityContextW failed with error 0x%08x\n", ret);
2619  HeapFree(GetProcessHeap(), 0, out.pvBuffer);
2620  break;
2621  }
2622  info->scheme = creds->AuthnSchemes[0];
2623  break;
2624  }
2625  default:
2626  FIXME("scheme %u not supported\n", creds->AuthnSchemes[0]);
2627  break;
2628  }
2629 
2630  if (status != RPC_S_OK)
2631  {
2633  *auth_ptr = NULL;
2634  return status;
2635  }
2636  *auth_ptr = info;
2637  return RPC_S_OK;
2638 }
static struct authinfo * alloc_authinfo(void)
#define TRUE
Definition: types.h:120
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:277
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
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:167
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:348
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:395
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:147
GLenum GLsizei len
Definition: glext.h:6722
#define ISC_REQ_USE_DCE_STYLE
Definition: sspi.h:357
static void destroy_authinfo(struct authinfo *info)
#define SECURITY_NETWORK_DREP
Definition: sspi.h:460
#define SEC_E_OK
Definition: winerror.h:2356
#define ISC_REQ_CONNECTION
Definition: sspi.h:359
#define ERR(fmt,...)
Definition: debug.h:109
GLuint in
Definition: glext.h:9616
DWORD exp
Definition: msg.c:15681
#define ISC_REQ_MUTUAL_AUTH
Definition: sspi.h:349
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:168
static SERVICE_STATUS status
Definition: service.c:31
#define HeapFree(x, y, z)
Definition: compat.h:394
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 2686 of file rpc_transport.c.

2687 {
2688  DWORD count, len = 0, size = sizeof(len);
2689  char buf[2048];
2690 
2692  if (!len) return;
2693  for (;;)
2694  {
2695  count = min(sizeof(buf), len);
2696  if (rpcrt4_http_async_read(request, async_data, cancel_event, buf, count) <= 0) return;
2697  len -= count;
2698  }
2699 }
#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:3807
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 2305 of file rpc_transport.c.

2306 {
2307  static const char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2308  UINT i = 0, x;
2309 
2310  while (len > 0)
2311  {
2312  /* first 6 bits, all from bin[0] */
2313  base64[i++] = enc[(bin[0] & 0xfc) >> 2];
2314  x = (bin[0] & 3) << 4;
2315 
2316  /* next 6 bits, 2 from bin[0] and 4 from bin[1] */
2317  if (len == 1)
2318  {
2319  base64[i++] = enc[x];
2320  base64[i++] = '=';
2321  base64[i++] = '=';
2322  break;
2323  }
2324  base64[i++] = enc[x | ((bin[1] & 0xf0) >> 4)];
2325  x = (bin[1] & 0x0f) << 2;
2326 
2327  /* next 6 bits 4 from bin[1] and 2 from bin[2] */
2328  if (len == 2)
2329  {
2330  base64[i++] = enc[x];
2331  base64[i++] = '=';
2332  break;
2333  }
2334  base64[i++] = enc[x | ((bin[2] & 0xc0) >> 6)];
2335 
2336  /* last 6 bits, all from bin [2] */
2337  base64[i++] = enc[bin[2] & 0x3f];
2338  bin += 3;
2339  len -= 3;
2340  }
2341  base64[i] = 0;
2342  return i;
2343 }
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 2480 of file rpc_transport.c.

2481 {
2482  DWORD len, index = 0;
2483  for (;;)
2484  {
2485  len = buflen;
2487  if (auth_scheme_from_header(buffer) == scheme) break;
2488  }
2489  return TRUE;
2490 }
#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:3807
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 98 of file rpc_transport.c.

99 {
100  HANDLE event = InterlockedExchangePointer(&connection->event_cache, NULL);
101  return event ? event : CreateEventW(NULL, TRUE, FALSE, NULL);
102 }
#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:597
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 2733 of file rpc_transport.c.

2734 {
2737 
2739  return FALSE;
2740 
2741  creds = httpc->common.QOS->qos->u.HttpCredentials;
2743  return FALSE;
2744 
2745  id = creds->TransportCredentials;
2746  if (!id || !id->User || !id->Password) return FALSE;
2747 
2748  return TRUE;
2749 }
#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
union _RPC_SECURITY_QOS_V2_W::@3079 u
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 2640 of file rpc_transport.c.

2641 {
2642  static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '};
2643  static const WCHAR basicW[] = {'B','a','s','i','c',' '};
2644  static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '};
2645  static const WCHAR ntlmW[] = {'N','T','L','M',' '};
2646  int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len + 2) * 4) / 3;
2647  const WCHAR *scheme_str;
2648  WCHAR *header, *ptr;
2650 
2651  switch (scheme)
2652  {
2654  scheme_str = basicW;
2655  scheme_len = ARRAY_SIZE(basicW);
2656  break;
2658  scheme_str = negotiateW;
2659  scheme_len = ARRAY_SIZE(negotiateW);
2660  break;
2662  scheme_str = ntlmW;
2663  scheme_len = ARRAY_SIZE(ntlmW);
2664  break;
2665  default:
2666  ERR("unknown scheme %u\n", scheme);
2667  return RPC_S_SERVER_UNAVAILABLE;
2668  }
2669  if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR))))
2670  {
2671  memcpy(header, authW, auth_len * sizeof(WCHAR));
2672  ptr = header + auth_len;
2673  memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR));
2674  ptr += scheme_len;
2676  ptr[len++] = '\r';
2677  ptr[len++] = '\n';
2678  ptr[len] = 0;
2680  status = RPC_S_OK;
2682  }
2683  return status;
2684 }
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:395
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:1354
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:394
struct CFHEADER header
Definition: fdi.c:109
#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 2129 of file rpc_transport.c.

2130 {
2131  static const WCHAR fmtW[] =
2132  {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
2133  WCHAR header[ARRAY_SIZE(fmtW) + 10];
2134 
2135  sprintfW(header, fmtW, len);
2137  return RPC_S_SERVER_UNAVAILABLE;
2138 }
#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
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1354
GLenum GLsizei len
Definition: glext.h:6722
#define ARRAY_SIZE(a)
Definition: main.h:24
#define sprintfW
Definition: unicode.h:58
Definition: tftpd.h:85
struct CFHEADER header
Definition: fdi.c:109
#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 380 of file rpc_transport.c.

381 {
382  return WaitNamedPipeA(pipe_name, 1) ? RPC_S_OK : RPC_S_NOT_LISTENING;
383 }
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 2751 of file rpc_transport.c.

2752 {
2753  return httpc->common.QOS &&
2756 }
RpcConnection common
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
union _RPC_SECURITY_QOS_V2_W::@3079 u
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 259 of file rpc_transport.c.

261 {
262 #ifdef __REACTOS__
263  static const char prefix[] = "\\\\";
264  static const char local[] = ".";
265  char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
266 #else
267  static const char prefix[] = "\\\\.";
268 #endif
269  char *pipe_name;
270 
271 #ifdef __REACTOS__
272  DWORD bufLen = ARRAYSIZE(ComputerName);
273 
274  GetComputerNameA(ComputerName, &bufLen);
275 
276  if (server == NULL || *server == 0 || stricmp(ComputerName, server) == 0)
277  server = local;
278 #endif
279 
280  /* protseq=ncacn_np: named pipes */
281 #ifdef __REACTOS__
282  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
283  strcpy(pipe_name, prefix);
284  strcat(pipe_name, server);
285  strcat(pipe_name, endpoint);
286 #else
287  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
288  strcat(strcpy(pipe_name, prefix), endpoint);
289 #endif
290  return pipe_name;
291 }
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:717

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 195 of file rpc_transport.c.

196 {
197  static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
198  char *pipe_name;
199 
200  /* protseq=ncalrpc: supposed to use NT LPC ports,
201  * but we'll implement it with named pipes for now */
202  pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
203  strcat(strcpy(pipe_name, prefix), endpoint);
204  return pipe_name;
205 }
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:717

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 1741 of file rpc_transport.c.

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

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 104 of file rpc_transport.c.

105 {
106  event = InterlockedExchangePointer(&connection->event_cache, event);
107  if (event)
109 }
#define CloseHandle
Definition: compat.h:398
#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 1721 of file rpc_transport.c.

1722 {
1723  return InterlockedIncrement(&data->refs);
1724 }
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 1726 of file rpc_transport.c.

1727 {
1728  ULONG refs = InterlockedDecrement(&data->refs);
1729  if (!refs)
1730  {
1731  TRACE("destroying async data %p\n", data);
1732  CloseHandle(data->completion_event);
1733  HeapFree(GetProcessHeap(), 0, data->inet_buffers.lpvBuffer);
1734  data->cs.DebugInfo->Spare[0] = 0;
1736  HeapFree(GetProcessHeap(), 0, data);
1737  }
1738  return refs;
1739 }
#define CloseHandle
Definition: compat.h:398
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:394

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 3703 of file rpc_transport.c.

3704 {
3705  RPC_PROTSEQ_VECTORA *pvector;
3706  unsigned int i;
3708 
3709  TRACE("(%p)\n", protseqs);
3710 
3711  *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned char*)*ARRAY_SIZE(protseq_list)));
3712  if (!*protseqs)
3713  goto end;
3714  pvector = *protseqs;
3715  pvector->Count = 0;
3716  for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3717  {
3718  pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, strlen(protseq_list[i].name)+1);
3719  if (pvector->Protseq[i] == NULL)
3720  goto end;
3721  strcpy((char*)pvector->Protseq[i], protseq_list[i].name);
3722  pvector->Count++;
3723  }
3724  status = RPC_S_OK;
3725 
3726 end:
3727  if (status != RPC_S_OK)
3729  return status;
3730 }
static struct list protseqs
Definition: rpc_server.c:71
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:395
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:36
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 3670 of file rpc_transport.c.

3671 {
3672  RPC_PROTSEQ_VECTORW *pvector;
3673  unsigned int i;
3675 
3676  TRACE("(%p)\n", protseqs);
3677 
3678  *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned short*)*ARRAY_SIZE(protseq_list)));
3679  if (!*protseqs)
3680  goto end;
3681  pvector = *protseqs;
3682  pvector->Count = 0;
3683  for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3684  {
3685  pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, (strlen(protseq_list[i].name)+1)*sizeof(unsigned short));
3686  if (pvector->Protseq[i] == NULL)
3687  goto end;
3689  (WCHAR*)pvector->Protseq[i], strlen(protseq_list[i].name) + 1);
3690  pvector->Count++;
3691  }
3692  status = RPC_S_OK;
3693 
3694 end:
3695  if (status != RPC_S_OK)
3697  return status;
3698 }
static struct list protseqs
Definition: rpc_server.c:71
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:395
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:36
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 3618 of file rpc_transport.c.

3619 {
3620  UNICODE_STRING protseqW;
3621 
3622  if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq))
3623  {
3625  RtlFreeUnicodeString(&protseqW);
3626  return ret;
3627  }
3628  return RPC_S_OUT_OF_MEMORY;
3629 }
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 3601 of file rpc_transport.c.

3602 {
3603  char ps[0x10];
3604 
3605  WideCharToMultiByte(CP_ACP, 0, protseq, -1,
3606  ps, sizeof ps, NULL, NULL);
3608  return RPC_S_OK;
3609 
3610  FIXME("Unknown protseq %s\n", debugstr_w(protseq));
3611 
3613 }
#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 3634 of file rpc_transport.c.

3635 {
3636  TRACE("(%p)\n", protseqs);
3637 
3638  if (*protseqs)
3639  {
3640  unsigned int i;
3641  for (i = 0; i < (*protseqs)->Count; i++)
3642  HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3644  *protseqs = NULL;
3645  }
3646  return RPC_S_OK;
3647 }
static struct list protseqs
Definition: rpc_server.c:71
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:395
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcNetworkInqProtseqsA().

◆ RpcProtseqVectorFreeW()

RPC_STATUS WINAPI RpcProtseqVectorFreeW ( RPC_PROTSEQ_VECTORW **  protseqs)

Definition at line 3652 of file rpc_transport.c.

3653 {
3654  TRACE("(%p)\n", protseqs);
3655 
3656  if (*protseqs)
3657  {
3658  unsigned int i;
3659  for (i = 0; i < (*protseqs)->Count; i++)
3660  HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3662  *protseqs = NULL;
3663  }
3664  return RPC_S_OK;
3665 }
static struct list protseqs
Definition: rpc_server.c:71
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:395
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22

Referenced by RpcNetworkInqProtseqsW().

◆ RPCRT4_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3350 of file rpc_transport.c.

3351 {
3352  TRACE("(Connection == ^%p)\n", Connection);
3353  if (SecIsValidHandle(&Connection->ctx))
3354  {
3355  DeleteSecurityContext(&Connection->ctx);
3356  SecInvalidateHandle(&Connection->ctx);
3357  }
3358  rpcrt4_conn_close(Connection);
3359  return RPC_S_OK;
3360 }
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 111 of file rpc_transport.c.

112 {
113  RpcConnection_np *connection = (RpcConnection_np *) conn;
114 
115  TRACE("listening on %s\n", connection->listen_pipe);
116 
121  if (connection->pipe == INVALID_HANDLE_VALUE)
122  {
123  WARN("CreateNamedPipe failed with error %d\n", GetLastError());
126  else
128  }
129 
130  return RPC_S_OK;
131 }
#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:391
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 92 of file rpc_transport.c.

93 {
95  return &npc->common;
96 }
RpcConnection common
Definition: rpc_transport.c:83
#define GetProcessHeap()
Definition: compat.h:395
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 525 of file rpc_transport.c.

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

◆ rpcrt4_conn_np_close()

static int rpcrt4_conn_np_close ( RpcConnection conn)
static

Definition at line 490 of file rpc_transport.c.

491 {
492  RpcConnection_np *connection = (RpcConnection_np *) conn;
493  if (connection->pipe)
494  {
495  FlushFileBuffers(connection->pipe);
496  CloseHandle(connection->pipe);
497  connection->pipe = 0;
498  }
499  if (connection->listen_event)
500  {
501  CloseHandle(connection->listen_event);
502  connection->listen_event = 0;
503  }
504  if (connection->event_cache)
505  {
506  CloseHandle(connection->event_cache);
507  connection->event_cache = 0;
508  }
509  return 0;
510 }
#define CloseHandle
Definition: compat.h:398
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 512 of file rpc_transport.c.

513 {
514  RpcConnection_np *connection = (RpcConnection_np*)conn;
516 
517  connection->read_closed = TRUE;
518 #ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
519  NtCancelIoFile(connection->pipe, &io_status);
520 #else
521  NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
522 #endif
523 }
#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:87
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 350 of file rpc_transport.c.

351 {
352  /* because of the way named pipes work, we'll transfer the connected pipe
353  * to the child, then reopen the server binding to continue listening */
354 
355  new_npc->pipe = old_npc->pipe;
356  old_npc->pipe = 0;
357  assert(!old_npc->listen_event);
358 }
#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 650 of file rpc_transport.c.

651 {
652  RpcConnection_np *npc = (RpcConnection_np *)conn;
653  BOOL ret;
654 
655  TRACE("(%p)\n", conn);
656 
657  if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
659 
661  if (!ret)
662  {
664  WARN("ImpersonateNamedPipeClient failed with error %u\n", error);
665  switch (error)
666  {
669  }
670  }
671  return RPC_S_OK;
672 }
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 432 of file rpc_transport.c.

433 {
434  RpcConnection_np *connection = (RpcConnection_np *) conn;
435  HANDLE event;
437 
438  event = get_np_event(connection);
439  if (!event)
440  return -1;
441 
442  if (connection->read_closed)
444  else
445  status = NtReadFile(connection->pipe, event, NULL, NULL, &connection->io_status, buffer, count, NULL, NULL);
446  if (status == STATUS_PENDING)
447  {
448  /* check read_closed again before waiting to avoid a race */
449  if (connection->read_closed)
450  {
452 #ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
453  NtCancelIoFile(connection->pipe, &io_status);
454 #else
455  NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
456 #endif
457  }
459  status = connection->io_status.u.Status;
460  }
461  release_np_event(connection, event);
462  return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information;
463 }
static HANDLE get_np_event(RpcConnection_np *connection)
Definition: rpc_transport.c:98
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:87
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:61
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

◆ rpcrt4_conn_np_revert_to_self()

static RPC_STATUS rpcrt4_conn_np_revert_to_self ( RpcConnection conn)
static

Definition at line 674 of file rpc_transport.c.

675 {
676  BOOL ret;
677 
678  TRACE("(%p)\n", conn);
679 
680  if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
681  return RPCRT4_default_revert_to_self(conn);
682 
683  ret = RevertToSelf();
684  if (!ret)
685  {
686  WARN("RevertToSelf failed with error %u\n", GetLastError());
688  }
689  return RPC_S_OK;
690 }
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 Connection)
static

Definition at line 531 of file rpc_transport.c.

532 {
533  /* FIXME: implement when named pipe writes use overlapped I/O */
534  return -1;
535 }

◆ rpcrt4_conn_np_write()

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

Definition at line 465 of file rpc_transport.c.

466 {
467  RpcConnection_np *connection = (RpcConnection_np *) conn;
469  HANDLE event;
471 
472  event = get_np_event(connection);
473  if (!event)
474  return -1;
475 
476  status = NtWriteFile(connection->pipe, event, NULL, NULL, &io_status, buffer, count, NULL, NULL);
477  if (status == STATUS_PENDING)
478  {
480  status = io_status.u.Status;
481  }
482  release_np_event(connection, event);
483  if (status)
484  return -1;
485 
486  assert(io_status.Information == count);
487  return count;
488 }
static HANDLE get_np_event(RpcConnection_np *connection)
Definition: rpc_transport.c:98
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 133 of file rpc_transport.c.

134 {
135  RpcConnection_np *npc = (RpcConnection_np *) Connection;
136  HANDLE pipe;
137  DWORD err, dwMode;
138 
139  TRACE("connecting to %s\n", pname);
140 
141  while (TRUE) {
142  DWORD dwFlags = 0;
143  if (Connection->QOS)
144  {
146  switch (Connection->QOS->qos->ImpersonationType)
147  {
149  /* FIXME: what to do here? */
150  break;
153  break;
156  break;
159  break;
162  break;
163  }
164  if (Connection->QOS->qos->IdentityTracking == RPC_C_QOS_IDENTITY_DYNAMIC)
166  }
169  if (pipe != INVALID_HANDLE_VALUE) break;
170  err = GetLastError();
171  if (err == ERROR_PIPE_BUSY) {
173  TRACE("retrying busy server\n");
174  continue;
175  }
176  TRACE("connection failed, error=%x\n", err);
177  return RPC_S_SERVER_TOO_BUSY;
178  }
179  if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
180  err = GetLastError();
181  WARN("connection failed, error=%x\n", err);
183  }
184  }
185 
186  /* success */
187  /* pipe is connected; change to message-read mode. */
188  dwMode = PIPE_READMODE_MESSAGE;
189  SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
190  npc->pipe = pipe;
191 
192  return RPC_S_OK;
193 }
#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:391
#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:426
#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:399
#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 3426 of file rpc_transport.c.

3427 {
3428  HANDLE event = NULL;
3429 
3430  if (connection->ref > 1)
3431  event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3432 
3433  RPCRT4_ReleaseConnection(connection);
3434 
3435  if(event)
3436  {
3438  CloseHandle(event);
3439  }
3440 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
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:597
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 1175 of file rpc_transport.c.

1176 {
1177  RpcConnection_tcp *tcpc;
1179  if (tcpc == NULL)
1180  return NULL;
1181  tcpc->sock = -1;
1182  if (!rpcrt4_sock_wait_init(tcpc))
1183  {
1184  HeapFree(GetProcessHeap(), 0, tcpc);
1185  return NULL;
1186  }
1187  return &tcpc->common;
1188 }
static BOOL rpcrt4_sock_wait_init(RpcConnection_tcp *tcpc)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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:394

◆ rpcrt4_conn_tcp_cancel_call()

static void rpcrt4_conn_tcp_cancel_call ( RpcConnection conn)
static

Definition at line 1525 of file rpc_transport.c.

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

◆ rpcrt4_conn_tcp_close()

static int rpcrt4_conn_tcp_close ( RpcConnection conn)
static

Definition at line 1505 of file rpc_transport.c.

1506 {
1507  RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1508 
1509  TRACE("%d\n", connection->sock);
1510 
1511  if (connection->sock != -1)
1512  closesocket(connection->sock);
1513  connection->sock = -1;
1514  CloseHandle(connection->sock_event);
1515  CloseHandle(connection->cancel_event);
1516  return 0;
1517 }
#define CloseHandle
Definition: compat.h:398
#define closesocket
Definition: main.c:39
#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 1519 of file rpc_transport.c.

1520 {
1521  RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1522  shutdown(connection->sock, SD_RECEIVE);
1523 }
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 1419 of file rpc_transport.c.

1420 {
1421  int ret;
1422  struct sockaddr_in address;
1423  socklen_t addrsize;
1426  u_long nonblocking;
1427 
1428  addrsize = sizeof(address);
1429  ret = accept(server->sock, (struct sockaddr*) &address, &addrsize);
1430  if (ret < 0)
1431  {
1432  ERR("Failed to accept a TCP connection: error %d\n", ret);
1433  return RPC_S_OUT_OF_RESOURCES;
1434  }
1435 
1436  nonblocking = 1;
1437  ioctlsocket(ret, FIONBIO, &nonblocking);
1438  client->sock = ret;
1439 
1440  client->common.NetworkAddr = HeapAlloc(GetProcessHeap(), 0, INET6_ADDRSTRLEN);
1441  ret = getnameinfo((struct sockaddr*)&address, addrsize, client->common.NetworkAddr, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
1442  if (ret != 0)
1443  {
1444  ERR("Failed to retrieve the IP address, error %d\n", ret);
1445  return RPC_S_OUT_OF_RESOURCES;
1446  }
1447 
1448  TRACE("Accepted a new TCP connection from %s\n", client->common.NetworkAddr);
1449  return RPC_S_OK;
1450 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
unsigned long u_long
Definition: linux.h:269
#define NI_NUMERICHOST
Definition: ws2def.h:354
#define INET6_ADDRSTRLEN
Definition: request.c:1491
smooth NULL
Definition: ftsmooth.c:416
#define ioctlsocket
Definition: main.c:40
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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 getnameinfo
Definition: wspiapi.h:45
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#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 1534 of file rpc_transport.c.

1535 {
1536  FIXME("\n");
1537  return RPC_S_ACCESS_DENIED;
1538 }
#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 1452 of file rpc_transport.c.

1454 {
1455  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1456  int bytes_read = 0;
1457  while (bytes_read != count)
1458  {
1459  int r = recv(tcpc->sock, (char *)buffer + bytes_read, count - bytes_read, 0);
1460  if (!r)
1461  return -1;
1462  else if (r > 0)
1463  bytes_read += r;
1464  else if (WSAGetLastError() == WSAEINTR)
1465  continue;
1466  else if (WSAGetLastError() != WSAEWOULDBLOCK)
1467  {
1468  WARN("recv() failed: %u\n", WSAGetLastError());
1469  return -1;
1470  }
1471  else
1472  {
1473  if (!rpcrt4_sock_wait_for_recv(tcpc))
1474  return -1;
1475  }
1476  }
1477  TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_read);
1478  return bytes_read;
1479 }
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 1540 of file rpc_transport.c.

1541 {
1542  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1543 
1544  TRACE("%p\n", Connection);
1545 
1546  if (!rpcrt4_sock_wait_for_recv(tcpc))
1547  return -1;
1548  return 0;
1549 }
#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 1481 of file rpc_transport.c.

1483 {
1484  RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1485  int bytes_written = 0;
1486  while (bytes_written != count)
1487  {
1488  int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0);
1489  if (r >= 0)
1490  bytes_written += r;
1491  else if (WSAGetLastError() == WSAEINTR)
1492  continue;
1493  else if (WSAGetLastError() != WSAEWOULDBLOCK)
1494  return -1;
1495  else
1496  {
1497  if (!rpcrt4_sock_wait_for_send(tcpc))
1498  return -1;
1499  }
1500  }
1501  TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_written);
1502  return bytes_written;
1503 }
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 3362 of file rpc_transport.c.

3365 {
3366  static LONG next_id;
3367  const struct connection_ops *ops;
3368  RpcConnection* NewConnection;
3369 
3370  ops = rpcrt4_get_conn_protseq_ops(Protseq);
3371  if (!ops)
3372  {
3373  FIXME("not supported for protseq %s\n", Protseq);
3375  }
3376 
3377  NewConnection = ops->alloc();
3378  NewConnection->ref = 1;
3379  NewConnection->server = server;
3380  NewConnection->ops = ops;
3381  NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
3382  NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
3383  NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
3384  NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
3385  NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
3386  NewConnection->NextCallId = 1;
3387 
3388  SecInvalidateHandle(&NewConnection->ctx);
3389  if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3390  NewConnection->AuthInfo = AuthInfo;
3391  NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3393  NewConnection->QOS = QOS;
3394 
3395  list_init(&NewConnection->conn_pool_entry);
3396  list_init(&NewConnection->protseq_entry);
3397 
3398  TRACE("connection: %p\n", NewConnection);
3399  *Connection = NewConnection;
3400 
3401  return RPC_S_OK;
3402 }
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:1180
#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:1357
__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 3331 of file rpc_transport.c.

3332 {
3333  unsigned int i;
3334  for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3335  if (!strcmp(conn_protseq_list[i].name, protseq))
3336  return &conn_protseq_list[i];
3337  return NULL;
3338 }
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:36
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 3322 of file rpc_transport.c.

3323 {
3324  unsigned int i;
3325  for(i = 0; i < ARRAY_SIZE(protseq_list); i++)
3326  if (!strcmp(protseq_list[i].name, protseq))
3327  return &protseq_list[i];
3328  return NULL;
3329 }
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:36
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 3442 of file rpc_transport.c.

3443 {
3444  LONG ref = InterlockedIncrement(&connection->ref);
3445  TRACE("%p ref=%u\n", connection, ref);
3446  return connection;
3447 }
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 2068 of file rpc_transport.c.

2070 {
2071  char *buf = buffer;
2072  BOOL ret;
2073  unsigned int bytes_left = count;
2075 
2076  async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, count);
2077 
2078  while (bytes_left)
2079  {
2080  async_data->inet_buffers.dwBufferLength = bytes_left;
2081  prepare_async_request(async_data);
2082  ret = InternetReadFileExW(req, &async_data->inet_buffers, IRF_ASYNC, 0);
2083  status = wait_async_request(async_data, ret, cancel_event);
2084  if (status != RPC_S_OK)
2085  {
2087  TRACE("call cancelled\n");
2088  break;
2089  }
2090 
2091  if (!async_data->inet_buffers.dwBufferLength)
2092  break;
2093  memcpy(buf, async_data->inet_buffers.lpvBuffer,
2094  async_data->inet_buffers.dwBufferLength);
2095 
2096  bytes_left -= async_data->inet_buffers.dwBufferLength;
2097  buf += async_data->inet_buffers.dwBufferLength;
2098  }
2099 
2100  HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
2101  async_data->inet_buffers.lpvBuffer = NULL;
2102 
2103  TRACE("%p %p %u -> %u\n", req, buffer, count, status);
2104  return status == RPC_S_OK ? count : -1;
2105 }
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:395
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:2270
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPVOID lpvBuffer
Definition: wininet.h:277
#define HeapFree(x, y, z)
Definition: compat.h:394
#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 1907 of file rpc_transport.c.

1908 {
1909  BOOL ret;
1911  DWORD size;
1912  DWORD index;
1913  WCHAR buf[32];
1914  WCHAR *status_text = buf;
1915  TRACE("\n");
1916 
1917  index = 0;
1918  size = sizeof(status_code);
1920  if (!ret)
1921  return GetLastError();
1922  if (status_code == HTTP_STATUS_OK)
1923  return RPC_S_OK;
1924  index = 0;
1925  size = sizeof(buf);
1926  ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
1928  {
1929  status_text = HeapAlloc(GetProcessHeap(), 0, size);
1930  ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
1931  }
1932 
1933  ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
1934  if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text);
1935 
1937  return ERROR_ACCESS_DENIED;
1938  return RPC_S_SERVER_UNAVAILABLE;
1939 }
#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:395
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:3807
#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:394
#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 1882 of file rpc_transport.c.

1888 {
1889  RpcHttpAsyncData *async_data = (RpcHttpAsyncData *)dwContext;
1890 
1891  switch (dwInternetStatus)
1892  {
1894  TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n");
1895  if (async_data)
1896  {
1897  INTERNET_ASYNC_RESULT *async_result = lpvStatusInformation;
1898 
1899  async_data->async_result = async_result->dwResult ? ERROR_SUCCESS : async_result->dwError;
1900  SetEvent(async_data->completion_event);
1901  RpcHttpAsyncData_Release(async_data);
1902  }
1903  break;
1904  }
1905 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static ULONG RpcHttpAsyncData_Release(RpcHttpAsyncData *data)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
#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 1941 of file rpc_transport.c.

1942 {
1943  static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0};
1944  LPWSTR proxy = NULL;
1945  LPWSTR user = NULL;
1946  LPWSTR password = NULL;
1947  LPWSTR servername = NULL;
1948  const WCHAR *option;
1950 
1951  if (httpc->common.QOS &&
1953  {
1954  const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_cred = httpc->common.QOS->qos->u.HttpCredentials;
1955  if (http_cred->TransportCredentials)
1956  {
1957  WCHAR *p;
1958  const SEC_WINNT_AUTH_IDENTITY_W *cred = http_cred->TransportCredentials;
1959  ULONG len = cred->DomainLength + 1 + cred->UserLength;
1960  user = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
1961  if (!user)
1962  return RPC_S_OUT_OF_RESOURCES;
1963  p = user;
1964  if (cred->DomainLength)
1965  {
1966  memcpy(p, cred->Domain, cred->DomainLength * sizeof(WCHAR));
1967  p += cred->DomainLength;
1968  *p = '\\';
1969  p++;
1970  }
1971  memcpy(p, cred->User, cred->UserLength * sizeof(WCHAR));
1972  p[cred->UserLength] = 0;
1973 
1975  }
1976  }
1977 
1978  for (option = httpc->common.NetworkOptions; option;
1979  option = (strchrW(option, ',') ? strchrW(option, ',')+1 : NULL))
1980  {
1981  static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
1982  static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
1983 
1984  if (!strncmpiW(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
1985  {
1986  const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
1987  const WCHAR *value_end;
1988  const WCHAR *p;
1989 
1990  value_end = strchrW(option, ',');
1991  if (!value_end)
1992  value_end = value_start + strlenW(value_start);
1993  for (p = value_start; p < value_end; p++)
1994  if (*p == ':')
1995  {
1996  port = atoiW(p+1);
1997  value_end = p;
1998  break;
1999  }
2000  TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
2001  servername = RPCRT4_strndupW(value_start, value_end-value_start);
2002  }
2003  else if (!strncmpiW(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
2004  {
2005  const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
2006  const WCHAR *value_end;
2007 
2008  value_end = strchrW(option, ',');
2009  if (!value_end)
2010  value_end = value_start + strlenW(value_start);
2011  TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
2012  proxy = RPCRT4_strndupW(value_start, value_end-value_start);
2013  }
2014  else
2015  FIXME("unhandled option %s\n", debugstr_w(option));
2016  }
2017 
2020  if (!httpc->app_info)
2021  {
2023  HeapFree(GetProcessHeap(), 0, user);
2024  HeapFree(GetProcessHeap(), 0, proxy);
2025  HeapFree(GetProcessHeap(), 0, servername);
2026  ERR("InternetOpenW failed with error %d\n", GetLastError());
2027  return RPC_S_SERVER_UNAVAILABLE;
2028  }
2030 
2031  /* if no RpcProxy option specified, set the HTTP server address to the
2032  * RPC server address */
2033  if (!servername)
2034  {
2035  servername = HeapAlloc(GetProcessHeap(), 0, (strlen(httpc->common.NetworkAddr) + 1)*sizeof(WCHAR));
2036  if (!servername)
2037  {
2039  HeapFree(GetProcessHeap(), 0, user);
2040  HeapFree(GetProcessHeap(), 0, proxy);
2041  return RPC_S_OUT_OF_RESOURCES;
2042  }
2043  MultiByteToWideChar(CP_ACP, 0, httpc->common.NetworkAddr, -1, servername, strlen(httpc->common.NetworkAddr) + 1);
2044  }
2045 
2046  port = (httpc->common.QOS &&
2050 
2051  httpc->session = InternetConnectW(httpc->app_info, servername, port, user, password,
2052  INTERNET_SERVICE_HTTP, 0, 0);
2053 
2055  HeapFree(GetProcessHeap(), 0, user);
2056  HeapFree(GetProcessHeap(), 0, proxy);
2057 
2058  if (!httpc->session)
2059  {
2060  ERR("InternetConnectW failed with error %d\n", GetLastError());
2061  HeapFree(GetProcessHeap(), 0, servername);
2062  return RPC_S_SERVER_UNAVAILABLE;
2063  }
2064  httpc->servername = servername;
2065  return RPC_S_OK;
2066 }
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
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
unsigned short * Password
Definition: rpcdce.h:227
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
RpcConnection common
#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
#define strncmpiW(s1, s2, n)
Definition: unicode.h:40
union _RPC_SECURITY_QOS_V2_W::@3079 u
#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:395
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2098
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__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:1281
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:92
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:1002
USHORT port
Definition: uri.c:227
#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:394
#define RPC_S_OK
Definition: rpcnterr.h:22
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315

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 1837 of file rpc_transport.c.

1838 {
1839  HINTERNET in_request = param;
1840  RpcPktHdr *idle_pkt;
1841 
1843  0, 0);
1844  if (idle_pkt)
1845  {
1846  DWORD bytes_written;
1847  InternetWriteFile(in_request, idle_pkt, idle_pkt->common.frag_len, &bytes_written);
1848  RPCRT4_FreeHeader(idle_pkt);
1849  }
1850 }
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:2135
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 2141 of file rpc_transport.c.

2144 {
2145  BOOL ret;
2147  RpcPktHdr *hdr;
2148  INTERNET_BUFFERSW buffers_in;
2149  DWORD bytes_written;
2150 
2151  if (!authorized)
2152  {
2153  /* ask wininet to authorize, if necessary */
2154  status = send_echo_request(in_request, async_data, cancel_event);
2155  if (status != RPC_S_OK) return status;
2156  }
2157  memset(&buffers_in, 0, sizeof(buffers_in));
2158  buffers_in.dwStructSize = sizeof(buffers_in);
2159  /* FIXME: get this from the registry */
2160  buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */
2161  status = insert_content_length_header(in_request, buffers_in.dwBufferTotal);
2162  if (status != RPC_S_OK) return status;
2163 
2164  prepare_async_request(async_data);
2165  ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0);
2166  status = wait_async_request(async_data, ret, cancel_event);
2167  if (status != RPC_S_OK) return status;
2168 
2169  TRACE("sending HTTP connect header to server\n");
2170  hdr = RPCRT4_BuildHttpConnectHeader(FALSE, connection_uuid, in_pipe_uuid, association_uuid);
2171  if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2172  ret = InternetWriteFile(in_request, hdr, hdr->common.frag_len, &bytes_written);
2174  if (!ret)
2175  {
2176  ERR("InternetWriteFile failed with error %d\n", GetLastError());
2177  return RPC_S_SERVER_UNAVAILABLE;
2178  }
2179 
2180  return RPC_S_OK;
2181 }
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:5470
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2135
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 2228 of file rpc_transport.c.

2232 {
2233  BOOL ret;
2235  RpcPktHdr *hdr;
2236  BYTE *data_from_server;
2237  RpcPktHdr pkt_from_server;
2238  ULONG field1, field3;
2239  BYTE buf[20];
2240 
2241  if (!authorized)
2242  {
2243  /* ask wininet to authorize, if necessary */
2244  status = send_echo_request(out_request, async_data, cancel_event);
2245  if (status != RPC_S_OK) return status;
2246  }
2247  else
2248  rpcrt4_http_async_read(out_request, async_data, cancel_event, buf, sizeof(buf));
2249 
2250  hdr = RPCRT4_BuildHttpConnectHeader(TRUE, connection_uuid, out_pipe_uuid, NULL);
2251  if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2252 
2253  status = insert_content_length_header(out_request, hdr->common.frag_len);
2254  if (status != RPC_S_OK)
2255  {
2257  return status;
2258  }
2259 
2260  TRACE("sending HTTP connect header to server\n");
2261  prepare_async_request(async_data);
2262  ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len);
2263  status = wait_async_request(async_data, ret, cancel_event);
2265  if (status != RPC_S_OK) return status;
2266 
2267  status = rpcrt4_http_check_response(out_request);
2268  if (status != RPC_S_OK) return status;
2269 
2270  status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2271  &pkt_from_server, &data_from_server);
2272  if (status != RPC_S_OK) return status;
2273  status = RPCRT4_ParseHttpPrepareHeader1(&pkt_from_server, data_from_server,
2274  &field1);
2275  HeapFree(GetProcessHeap(), 0, data_from_server);
2276  if (status != RPC_S_OK) return status;
2277  TRACE("received (%d) from first prepare header\n", field1);
2278 
2279  for (;;)
2280  {
2281  status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2282  &pkt_from_server, &data_from_server);
2283  if (status != RPC_S_OK) return status;
2284  if (pkt_from_server.http.flags != 0x0001) break;
2285 
2286  TRACE("http idle packet, waiting for real packet\n");
2287  HeapFree(GetProcessHeap(), 0, data_from_server);
2288  if (pkt_from_server.http.num_data_items != 0)
2289  {
2290  ERR("HTTP idle packet should have no data items instead of %d\n",
2291  pkt_from_server.http.num_data_items);
2292  return RPC_S_PROTOCOL_ERROR;
2293  }
2294  }
2295  status = RPCRT4_ParseHttpPrepareHeader2(&pkt_from_server, data_from_server,
2296  &field1, flow_control_increment,
2297  &field3);
2298  HeapFree(GetProcessHeap(), 0, data_from_server);
2299  if (status != RPC_S_OK) return status;
2300  TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1, *flow_control_increment, field3);
2301 
2302  return RPC_S_OK;
2303 }
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:5565
#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:395
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:394
#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 2183 of file rpc_transport.c.

2185 {
2186  unsigned short data_len;
2187  unsigned int size;
2188 
2189  if (rpcrt4_http_async_read(request, async_data, cancel_event, hdr, sizeof(hdr->common)) < 0)
2190  return RPC_S_SERVER_UNAVAILABLE;
2191  if (hdr->common.ptype != PKT_HTTP || hdr->common.frag_len < sizeof(hdr->http))
2192  {
2193  ERR("wrong packet type received %d or wrong frag_len %d\n",
2194  hdr->common.ptype, hdr->common.frag_len);
2195  return RPC_S_PROTOCOL_ERROR;
2196  }
2197 
2198  size = sizeof(hdr->http) - sizeof(hdr->common);
2199  if (rpcrt4_http_async_read(request, async_data, cancel_event, &hdr->common + 1, size) < 0)
2200  return RPC_S_SERVER_UNAVAILABLE;
2201 
2202  data_len = hdr->common.frag_len - sizeof(hdr->http);
2203  if (data_len)
2204  {
2205  *data = HeapAlloc(GetProcessHeap(), 0, data_len);
2206  if (!*data)
2207  return RPC_S_OUT_OF_RESOURCES;
2208  if (rpcrt4_http_async_read(request, async_data, cancel_event, *data, data_len) < 0)
2209  {
2210  HeapFree(GetProcessHeap(), 0, *data);
2211  return RPC_S_SERVER_UNAVAILABLE;
2212  }
2213  }
2214  else
2215  *data = NULL;
2216 
2217  if (!RPCRT4_IsValidHttpPacket(hdr, *data, data_len))
2218  {
2219  ERR("invalid http packet\n");
2220  HeapFree(GetProcessHeap(), 0, *data);
2221  return RPC_S_PROTOCOL_ERROR;
2222  }
2223 
2224  return RPC_S_OK;
2225 }
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:395
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:394
#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 1852 of file rpc_transport.c.

1853 {
1855  DWORD cached_last_sent_time = *last_sent_time;
1856  return HTTP_IDLE_TIME - (cur_time - cached_last_sent_time > HTTP_IDLE_TIME ? 0 : cur_time - cached_last_sent_time);
1857 }
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
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 1859 of file rpc_transport.c.

1860 {
1861  HttpTimerThreadData *data_in = param;
1863  DWORD timeout;
1864 
1865  data = *data_in;
1866  HeapFree(GetProcessHeap(), 0, data_in);
1867 
1868  for (timeout = HTTP_IDLE_TIME;
1869  WaitForSingleObject(data.timer_cancelled, timeout) == WAIT_TIMEOUT;
1870  timeout = rpcrt4_http_timer_calc_timeout(data.last_sent_time))
1871  {
1872  /* are we too soon after last send? */
1873  if (GetTickCount() - *data.last_sent_time < HTTP_IDLE_TIME)
1874  continue;
1876  }
1877 
1878  CloseHandle(data.timer_cancelled);
1879  return 0;
1880 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:445
#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:395
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:394

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 964 of file rpc_transport.c.

968 {
969  twr_tcp_floor_t *tcp_floor;
970  twr_ipv4_floor_t *ipv4_floor;
971  struct addrinfo *ai;
972  struct addrinfo hints;
973  int ret;
974  size_t size = sizeof(*tcp_floor) + sizeof(*ipv4_floor);
975 
976  TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint);
977 
978  if (!tower_data)
979  return size;
980 
981  tcp_floor = (twr_tcp_floor_t *)tower_data;
982  tower_data += sizeof(*tcp_floor);
983 
984  ipv4_floor = (twr_ipv4_floor_t *)tower_data;
985 
986  tcp_floor->count_lhs = sizeof(tcp_floor->protid);
987  tcp_floor->protid = tcp_protid;
988  tcp_floor->count_rhs = sizeof(tcp_floor->port);
989 
990  ipv4_floor->count_lhs = sizeof(ipv4_floor->protid);
991  ipv4_floor->protid = EPM_PROTOCOL_IP;
992  ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr);
993 
994  hints.ai_flags = AI_NUMERICHOST;
995  /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */
996  hints.ai_family = PF_INET;
997  hints.ai_socktype = SOCK_STREAM;
998  hints.ai_protocol = IPPROTO_TCP;
999  hints.ai_addrlen = 0;
1000  hints.ai_addr = NULL;
1001  hints.ai_canonname = NULL;
1002  hints.ai_next = NULL;
1003 
1004  ret = getaddrinfo(networkaddr, endpoint, &hints, &ai);
1005  if (ret)
1006  {
1007  ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai);
1008  if (ret)
1009  {
1010  ERR("getaddrinfo failed: %s\n", gai_strerror(ret));
1011  return 0;
1012  }
1013  }
1014 
1015  if (ai->ai_family == PF_INET)
1016  {
1017  const struct sockaddr_in *sin = (const struct sockaddr_in *)ai->ai_addr;
1018  tcp_floor->port = sin->sin_port;
1019  ipv4_floor->ipv4addr = sin->sin_addr.s_addr;
1020  }
1021  else
1022  {
1023  ERR("unexpected protocol family %d\n", ai->ai_family);
1024  freeaddrinfo(ai);
1025  return 0;
1026  }
1027 
1028  freeaddrinfo(ai);
1029 
1030  return size;
1031 }
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 1033 of file rpc_transport.c.

1038 {
1039  const twr_tcp_floor_t *tcp_floor = (const twr_tcp_floor_t *)tower_data;
1040  const twr_ipv4_floor_t *ipv4_floor;
1041  struct in_addr in_addr;
1042 
1043  TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint);
1044 
1045  if (tower_size < sizeof(*tcp_floor))
1046  return EPT_S_NOT_REGISTERED;
1047 
1048  tower_data += sizeof(*tcp_floor);
1049  tower_size -= sizeof(*tcp_floor);
1050 
1051  if (tower_size < sizeof(*ipv4_floor))
1052  return EPT_S_NOT_REGISTERED;
1053 
1054  ipv4_floor = (const twr_ipv4_floor_t *)tower_data;
1055 
1056  if ((tcp_floor->count_lhs != sizeof(tcp_floor->protid)) ||
1057  (tcp_floor->protid != tcp_protid) ||
1058  (tcp_floor->count_rhs != sizeof(tcp_floor->port)) ||
1059  (ipv4_floor->count_lhs != sizeof(ipv4_floor->protid)) ||
1060  (ipv4_floor->protid != EPM_PROTOCOL_IP) ||
1061  (ipv4_floor->count_rhs != sizeof(ipv4_floor->ipv4addr)))
1062  return EPT_S_NOT_REGISTERED;
1063 
1064  if (endpoint)
1065  {
1066  *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */);
1067  if (!*endpoint)
1068  return RPC_S_OUT_OF_RESOURCES;
1069  sprintf(*endpoint, "%u", ntohs(tcp_floor->port));
1070  }
1071 
1072  if (networkaddr)
1073  {
1074  *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN);
1075  if (!*networkaddr)
1076  {
1077  if (endpoint)
1078  {
1079  I_RpcFree(*endpoint);
1080  *endpoint = NULL;
1081  }
1082  return RPC_S_OUT_OF_RESOURCES;
1083  }
1084  in_addr.s_addr = ipv4_floor->ipv4addr;
1085  if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN))
1086  {
1087  ERR("inet_ntop: %u\n", WSAGetLastError());
1088  I_RpcFree(*networkaddr);
1089  *networkaddr = NULL;
1090  if (endpoint)
1091  {
1092  I_RpcFree(*endpoint);
1093  *endpoint = NULL;
1094  }
1095  return EPT_S_NOT_REGISTERED;
1096  }
1097  }
1098 
1099  return RPC_S_OK;
1100 }
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
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:717
#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 3492 of file rpc_transport.c.

3493 {
3494  const struct connection_ops *ops;
3495 
3496  ops = rpcrt4_get_conn_protseq_ops(protseq);
3497  if (!ops)
3498  {
3499  FIXME("not supported for protseq %s\n", protseq);
3500  return RPC_S_INVALID_BINDING;
3501  }
3502 
3503  return ops->is_server_listening(endpoint);
3504 }
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 1810 of file rpc_transport.c.

1811 {
1812  RpcConnection_http *httpc;
1813  httpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*httpc));
1814  if (!httpc) return NULL;
1816  if (!httpc->async_data)
1817  {
1818  HeapFree(GetProcessHeap(), 0, httpc);
1819  return NULL;
1820  }
1821  TRACE("async data = %p\n", httpc->async_data);
1823  httpc->async_data->refs = 1;
1826  httpc->async_data->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcHttpAsyncData.cs");
1827  return &httpc->common;
1828 }
DWORD dwStructSize
Definition: wininet.h:272
#define DWORD_PTR
Definition: treelist.c:76
RpcConnection common
INTERNET_BUFFERSW inet_buffers
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
Definition: