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

Go to the source code of this file.

Classes

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Macro Definition Documentation

◆ DEFAULT_NCACN_HTTP_TIMEOUT

#define DEFAULT_NCACN_HTTP_TIMEOUT   (60 * 1000)

Definition at line 57 of file rpc_transport.c.

◆ HTTP_IDLE_TIME

#define HTTP_IDLE_TIME   60000

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

2686{
2687 struct authinfo *ret;
2688
2689 if (!(ret = HeapAlloc(GetProcessHeap(), 0, sizeof(*ret) ))) return NULL;
2690
2691 SecInvalidateHandle(&ret->cred);
2692 SecInvalidateHandle(&ret->ctx);
2693 memset(&ret->exp, 0, sizeof(ret->exp));
2694 ret->scheme = 0;
2695 ret->attr = 0;
2696 ret->max_token = 0;
2697 ret->data = NULL;
2698 ret->data_len = 0;
2699 ret->finished = FALSE;
2700 return ret;
2701}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define SecInvalidateHandle(x)
Definition: sspi.h:58
#define memset(x, y, z)
Definition: compat.h:39
int ret

Referenced by do_authorization().

◆ auth_scheme_from_header()

static DWORD auth_scheme_from_header ( const WCHAR header)
static

Definition at line 2737 of file rpc_transport.c.

2738{
2739 unsigned int i;
2740 for (i = 0; i < ARRAY_SIZE(auth_schemes); i++)
2741 {
2743 (header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
2744 }
2745 return 0;
2746}
#define ARRAY_SIZE(A)
Definition: main.h:33
GLenum GLsizei len
Definition: glext.h:6722
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
static const struct @541 auth_schemes[]
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)

Referenced by do_authorization(), and get_authvalue().

◆ authorize_request()

static RPC_STATUS authorize_request ( RpcConnection_http httpc,
HINTERNET  request 
)
static

Definition at line 2969 of file rpc_transport.c.

2970{
2971 static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':','\r','\n',0};
2972 struct authinfo *info = NULL;
2974 BOOL ret;
2975
2976 for (;;)
2977 {
2979 if (status != RPC_S_OK) break;
2980
2981 status = insert_authorization_header(request, info->scheme, info->data, info->data_len);
2982 if (status != RPC_S_OK) break;
2983
2987 if (status != RPC_S_OK || info->finished) break;
2988
2990 if (status != RPC_S_OK && status != ERROR_ACCESS_DENIED) break;
2992 }
2993
2994 if (info->scheme != RPC_C_HTTP_AUTHN_SCHEME_BASIC)
2996
2998 return status;
2999}
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
Definition: http.c:1297
BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength)
Definition: http.c:5595
unsigned int BOOL
Definition: ntddk_ex.h:94
static void drain_content(HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event)
static RPC_STATUS wait_async_request(RpcHttpAsyncData *async_data, BOOL call_ret, HANDLE cancel_event)
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 prepare_async_request(RpcHttpAsyncData *async_data)
static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor)
static void destroy_authinfo(struct authinfo *info)
#define RPC_C_HTTP_AUTHN_SCHEME_BASIC
Definition: rpcdce.h:205
#define RPC_S_OK
Definition: rpcnterr.h:22
long RPC_STATUS
Definition: rpc.h:52
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
union _RPC_SECURITY_QOS_V2_W::@3217 u
RpcConnection common
RpcHttpAsyncData * async_data
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
Definition: tftpd.h:86
Definition: ps.c:97
#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

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

2624{
2625 unsigned int i = 0;
2626 char c0, c1, c2, c3;
2627 const WCHAR *p = base64;
2628
2629 while (len > 4)
2630 {
2631 if ((c0 = decode_char( p[0] )) > 63) return 0;
2632 if ((c1 = decode_char( p[1] )) > 63) return 0;
2633 if ((c2 = decode_char( p[2] )) > 63) return 0;
2634 if ((c3 = decode_char( p[3] )) > 63) return 0;
2635
2636 if (buf)
2637 {
2638 buf[i + 0] = (c0 << 2) | (c1 >> 4);
2639 buf[i + 1] = (c1 << 4) | (c2 >> 2);
2640 buf[i + 2] = (c2 << 6) | c3;
2641 }
2642 len -= 4;
2643 i += 3;
2644 p += 4;
2645 }
2646 if (p[2] == '=')
2647 {
2648 if ((c0 = decode_char( p[0] )) > 63) return 0;
2649 if ((c1 = decode_char( p[1] )) > 63) return 0;
2650
2651 if (buf) buf[i] = (c0 << 2) | (c1 >> 4);
2652 i++;
2653 }
2654 else if (p[3] == '=')
2655 {
2656 if ((c0 = decode_char( p[0] )) > 63) return 0;
2657 if ((c1 = decode_char( p[1] )) > 63) return 0;
2658 if ((c2 = decode_char( p[2] )) > 63) return 0;
2659
2660 if (buf)
2661 {
2662 buf[i + 0] = (c0 << 2) | (c1 >> 4);
2663 buf[i + 1] = (c1 << 4) | (c2 >> 2);
2664 }
2665 i += 2;
2666 }
2667 else
2668 {
2669 if ((c0 = decode_char( p[0] )) > 63) return 0;
2670 if ((c1 = decode_char( p[1] )) > 63) return 0;
2671 if ((c2 = decode_char( p[2] )) > 63) return 0;
2672 if ((c3 = decode_char( p[3] )) > 63) return 0;
2673
2674 if (buf)
2675 {
2676 buf[i + 0] = (c0 << 2) | (c1 >> 4);
2677 buf[i + 1] = (c1 << 4) | (c2 >> 2);
2678 buf[i + 2] = (c2 << 6) | c3;
2679 }
2680 i += 3;
2681 }
2682 return i;
2683}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLfloat GLfloat p
Definition: glext.h:8902
static char decode_char(WCHAR c)

Referenced by do_authorization().

◆ decode_char()

static char decode_char ( WCHAR  c)
inlinestatic

Definition at line 2613 of file rpc_transport.c.

2614{
2615 if (c >= 'A' && c <= 'Z') return c - 'A';
2616 if (c >= 'a' && c <= 'z') return c - 'a' + 26;
2617 if (c >= '0' && c <= '9') return c - '0' + 52;
2618 if (c == '+') return 62;
2619 if (c == '/') return 63;
2620 return 64;
2621}
const GLubyte * c
Definition: glext.h:8905

Referenced by decode_base64().

◆ destroy_authinfo()

static void destroy_authinfo ( struct authinfo info)
static

Definition at line 2703 of file rpc_transport.c.

2704{
2705 if (!info) return;
2706
2707 if (SecIsValidHandle(&info->ctx))
2709 if (SecIsValidHandle(&info->cred))
2711
2712 HeapFree(GetProcessHeap(), 0, info->data);
2714}
#define HeapFree(x, y, z)
Definition: compat.h:735
#define SecIsValidHandle(x)
Definition: sspi.h:63
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151

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

2762{
2763 struct authinfo *info = *auth_ptr;
2766
2767 if ((!info && !(info = alloc_authinfo()))) return RPC_S_SERVER_UNAVAILABLE;
2768
2769 switch (creds->AuthnSchemes[0])
2770 {
2772 {
2773 int userlen = WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, NULL, 0, NULL, NULL);
2774 int passlen = WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, NULL, 0, NULL, NULL);
2775
2776 info->data_len = userlen + passlen + 1;
2777 if (!(info->data = HeapAlloc(GetProcessHeap(), 0, info->data_len)))
2778 {
2780 break;
2781 }
2782 WideCharToMultiByte(CP_UTF8, 0, id->User, id->UserLength, info->data, userlen, NULL, NULL);
2783 info->data[userlen] = ':';
2784 WideCharToMultiByte(CP_UTF8, 0, id->Password, id->PasswordLength, info->data + userlen + 1, passlen, NULL, NULL);
2785
2787 info->finished = TRUE;
2788 status = RPC_S_OK;
2789 break;
2790 }
2793 {
2794
2795 static SEC_WCHAR ntlmW[] = {'N','T','L','M',0}, negotiateW[] = {'N','e','g','o','t','i','a','t','e',0};
2797 SecBufferDesc out_desc, in_desc;
2798 SecBuffer out, in;
2801 int scheme_len;
2802 const WCHAR *p;
2803 WCHAR auth_value[2048];
2804 DWORD size = sizeof(auth_value);
2805 BOOL first = FALSE;
2806
2808 else scheme = negotiateW;
2809 scheme_len = lstrlenW( scheme );
2810
2811 if (!*auth_ptr)
2812 {
2813 TimeStamp exp;
2814 SecPkgInfoW *pkg_info;
2815
2817 if (ret != SEC_E_OK) break;
2818
2819 ret = QuerySecurityPackageInfoW(scheme, &pkg_info);
2820 if (ret != SEC_E_OK) break;
2821
2822 info->max_token = pkg_info->cbMaxToken;
2823 FreeContextBuffer(pkg_info);
2824 first = TRUE;
2825 }
2826 else
2827 {
2828 if (info->finished || !get_authvalue(request, creds->AuthnSchemes[0], auth_value, size)) break;
2829 if (auth_scheme_from_header(auth_value) != info->scheme)
2830 {
2831 ERR("authentication scheme changed\n");
2832 break;
2833 }
2834 }
2835 in.BufferType = SECBUFFER_TOKEN;
2836 in.cbBuffer = 0;
2837 in.pvBuffer = NULL;
2838
2839 in_desc.ulVersion = 0;
2840 in_desc.cBuffers = 1;
2841 in_desc.pBuffers = &in;
2842
2843 p = auth_value + scheme_len;
2844 if (!first && *p == ' ')
2845 {
2846 int len = lstrlenW(++p);
2847 in.cbBuffer = decode_base64(p, len, NULL);
2848 if (!(in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer))) break;
2849 decode_base64(p, len, in.pvBuffer);
2850 }
2851 out.BufferType = SECBUFFER_TOKEN;
2852 out.cbBuffer = info->max_token;
2853 if (!(out.pvBuffer = HeapAlloc(GetProcessHeap(), 0, out.cbBuffer)))
2854 {
2855 HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2856 break;
2857 }
2858 out_desc.ulVersion = 0;
2859 out_desc.cBuffers = 1;
2860 out_desc.pBuffers = &out;
2861
2862 ret = InitializeSecurityContextW(first ? &info->cred : NULL, first ? NULL : &info->ctx,
2863 first ? servername : NULL, flags, 0, SECURITY_NETWORK_DREP,
2864 in.pvBuffer ? &in_desc : NULL, 0, &info->ctx, &out_desc,
2865 &info->attr, &info->exp);
2866 HeapFree(GetProcessHeap(), 0, in.pvBuffer);
2867 if (ret == SEC_E_OK)
2868 {
2869 HeapFree(GetProcessHeap(), 0, info->data);
2870 info->data = out.pvBuffer;
2871 info->data_len = out.cbBuffer;
2872 info->finished = TRUE;
2873 TRACE("sending last auth packet\n");
2874 status = RPC_S_OK;
2875 }
2876 else if (ret == SEC_I_CONTINUE_NEEDED)
2877 {
2878 HeapFree(GetProcessHeap(), 0, info->data);
2879 info->data = out.pvBuffer;
2880 info->data_len = out.cbBuffer;
2881 TRACE("sending next auth packet\n");
2882 status = RPC_S_OK;
2883 }
2884 else
2885 {
2886 ERR("InitializeSecurityContextW failed with error 0x%08x\n", ret);
2887 HeapFree(GetProcessHeap(), 0, out.pvBuffer);
2888 break;
2889 }
2890 info->scheme = creds->AuthnSchemes[0];
2891 break;
2892 }
2893 default:
2894 FIXME("scheme %u not supported\n", creds->AuthnSchemes[0]);
2895 break;
2896 }
2897
2898 if (status != RPC_S_OK)
2899 {
2901 *auth_ptr = NULL;
2902 return status;
2903 }
2904 *auth_ptr = info;
2905 return RPC_S_OK;
2906}
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERR(fmt,...)
Definition: debug.h:110
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint in
Definition: glext.h:9616
GLbitfield flags
Definition: glext.h:7161
const GLint * first
Definition: glext.h:5794
GLuint id
Definition: glext.h:5910
DWORD exp
Definition: msg.c:16058
LONG SECURITY_STATUS
Definition: sspi.h:34
#define SECPKG_CRED_OUTBOUND
Definition: sspi.h:291
#define SECBUFFER_TOKEN
Definition: sspi.h:161
#define SECURITY_NETWORK_DREP
Definition: sspi.h:474
#define ISC_REQ_DELEGATE
Definition: sspi.h:362
#define ISC_REQ_MUTUAL_AUTH
Definition: sspi.h:363
WCHAR SEC_WCHAR
Definition: sspi.h:29
#define ISC_REQ_CONNECTION
Definition: sspi.h:373
#define ISC_REQ_USE_DCE_STYLE
Definition: sspi.h:371
static FILE * out
Definition: regtests2xml.c:44
static DWORD auth_scheme_from_header(const WCHAR *header)
static unsigned int decode_base64(const WCHAR *base64, unsigned int len, char *buf)
static const WCHAR negotiateW[]
static struct authinfo * alloc_authinfo(void)
static BOOL get_authvalue(HINTERNET request, DWORD scheme, WCHAR *buffer, DWORD buflen)
static const WCHAR ntlmW[]
DWORD scheme
#define RPC_C_HTTP_AUTHN_SCHEME_NEGOTIATE
Definition: rpcdce.h:209
#define RPC_C_HTTP_AUTHN_SCHEME_NTLM
Definition: rpcdce.h:206
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
#define CP_UTF8
Definition: nls.h:20
#define TRACE(s)
Definition: solgame.cpp:4
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
ULONG cBuffers
Definition: sspi.h:182
ULONG ulVersion
Definition: sspi.h:181
ULONG cbMaxToken
Definition: sspi.h:117
uint32_t ULONG
Definition: typedefs.h:59
#define SEC_E_OK
Definition: winerror.h:2356
#define SEC_I_CONTINUE_NEEDED
Definition: winerror.h:2927
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
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
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
SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo)
Definition: wrapper.c:750

Referenced by authorize_request().

◆ drain_content()

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

Definition at line 2954 of file rpc_transport.c.

2955{
2956 DWORD count, len = 0, size = sizeof(len);
2957 char buf[2048];
2958
2960 if (!len) return;
2961 for (;;)
2962 {
2963 count = min(sizeof(buf), len);
2964 if (rpcrt4_http_async_read(request, async_data, cancel_event, buf, count) <= 0) return;
2965 len -= count;
2966 }
2967}
BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex)
Definition: http.c:3870
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define min(a, b)
Definition: monoChain.cc:55
unsigned int len
static int rpcrt4_http_async_read(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event, void *buffer, unsigned int count)
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
#define HTTP_QUERY_CONTENT_LENGTH
Definition: wininet.h:1528

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

2574{
2575 static const char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2576 UINT i = 0, x;
2577
2578 while (len > 0)
2579 {
2580 /* first 6 bits, all from bin[0] */
2581 base64[i++] = enc[(bin[0] & 0xfc) >> 2];
2582 x = (bin[0] & 3) << 4;
2583
2584 /* next 6 bits, 2 from bin[0] and 4 from bin[1] */
2585 if (len == 1)
2586 {
2587 base64[i++] = enc[x];
2588 base64[i++] = '=';
2589 base64[i++] = '=';
2590 break;
2591 }
2592 base64[i++] = enc[x | ((bin[1] & 0xf0) >> 4)];
2593 x = (bin[1] & 0x0f) << 2;
2594
2595 /* next 6 bits 4 from bin[1] and 2 from bin[2] */
2596 if (len == 2)
2597 {
2598 base64[i++] = enc[x];
2599 base64[i++] = '=';
2600 break;
2601 }
2602 base64[i++] = enc[x | ((bin[2] & 0xc0) >> 6)];
2603
2604 /* last 6 bits, all from bin [2] */
2605 base64[i++] = enc[bin[2] & 0x3f];
2606 bin += 3;
2607 len -= 3;
2608 }
2609 base64[i] = 0;
2610 return i;
2611}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static struct _PeImage bin
unsigned int UINT
Definition: ndis.h:50

Referenced by insert_authorization_header().

◆ get_authvalue()

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

Definition at line 2748 of file rpc_transport.c.

2749{
2750 DWORD len, index = 0;
2751 for (;;)
2752 {
2753 len = buflen;
2755 if (auth_scheme_from_header(buffer) == scheme) break;
2756 }
2757 return TRUE;
2758}
GLuint buffer
Definition: glext.h:5915
GLuint index
Definition: glext.h:6031
#define HTTP_QUERY_WWW_AUTHENTICATE
Definition: wininet.h:1563

Referenced by do_authorization().

◆ get_np_event()

static HANDLE get_np_event ( RpcConnection_np connection)
static

Definition at line 97 of file rpc_transport.c.

98{
100 return event ? event : CreateEventW(NULL, TRUE, FALSE, NULL);
101}
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
struct _cl_event * event
Definition: glext.h:7739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651

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

3002{
3005
3007 return FALSE;
3008
3009 creds = httpc->common.QOS->qos->u.HttpCredentials;
3011 return FALSE;
3012
3013 id = creds->TransportCredentials;
3014 if (!id || !id->User || !id->Password) return FALSE;
3015
3016 return TRUE;
3017}
#define RPC_C_HTTP_AUTHN_TARGET_SERVER
Definition: rpcdce.h:202
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276

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

2909{
2910 static const WCHAR authW[] = {'A','u','t','h','o','r','i','z','a','t','i','o','n',':',' '};
2911 static const WCHAR basicW[] = {'B','a','s','i','c',' '};
2912 static const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',' '};
2913 static const WCHAR ntlmW[] = {'N','T','L','M',' '};
2914 int scheme_len, auth_len = ARRAY_SIZE(authW), len = ((data_len + 2) * 4) / 3;
2915 const WCHAR *scheme_str;
2916 WCHAR *header, *ptr;
2918
2919 switch (scheme)
2920 {
2922 scheme_str = basicW;
2923 scheme_len = ARRAY_SIZE(basicW);
2924 break;
2926 scheme_str = negotiateW;
2927 scheme_len = ARRAY_SIZE(negotiateW);
2928 break;
2930 scheme_str = ntlmW;
2931 scheme_len = ARRAY_SIZE(ntlmW);
2932 break;
2933 default:
2934 ERR("unknown scheme %u\n", scheme);
2936 }
2937 if ((header = HeapAlloc(GetProcessHeap(), 0, (auth_len + scheme_len + len + 2) * sizeof(WCHAR))))
2938 {
2939 memcpy(header, authW, auth_len * sizeof(WCHAR));
2940 ptr = header + auth_len;
2941 memcpy(ptr, scheme_str, scheme_len * sizeof(WCHAR));
2942 ptr += scheme_len;
2943 len = encode_base64(data, data_len, ptr);
2944 ptr[len++] = '\r';
2945 ptr[len++] = '\n';
2946 ptr[len] = 0;
2948 status = RPC_S_OK;
2950 }
2951 return status;
2952}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
static const WCHAR basicW[]
static UINT encode_base64(const char *bin, unsigned int len, WCHAR *base64)

Referenced by authorize_request().

◆ insert_content_length_header()

static RPC_STATUS insert_content_length_header ( HINTERNET  request,
DWORD  len 
)
static

Definition at line 2397 of file rpc_transport.c.

2398{
2399 static const WCHAR fmtW[] =
2400 {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',':',' ','%','u','\r','\n',0};
2401 WCHAR header[ARRAY_SIZE(fmtW) + 10];
2402
2403 swprintf(header, fmtW, len);
2406}
#define swprintf
Definition: precomp.h:40

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

638{
639 return WaitNamedPipeA(pipe_name, 1) ? RPC_S_OK : RPC_S_NOT_LISTENING;
640}
BOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
Definition: npipe.c:433
#define RPC_S_NOT_LISTENING
Definition: winerror.h:1026

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

3020{
3021 return httpc->common.QOS &&
3024}
#define RPC_C_HTTP_FLAG_USE_SSL
Definition: rpcdce.h:198

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

505{
506#ifdef __REACTOS__
507 static const char prefix[] = "\\\\";
508 static const char local[] = ".";
509 char ComputerName[MAX_COMPUTERNAME_LENGTH + 1];
510 DWORD bufLen = ARRAY_SIZE(ComputerName);
511#else
512 static const char prefix[] = "\\\\.";
513#endif
514 char *pipe_name;
515
516#ifdef __REACTOS__
517 if (server != NULL && *server != 0)
518 {
519 /* Trim any leading UNC server prefix. */
520 if (server[0] == '\\' && server[1] == '\\')
521 server += 2;
522
523 /* If the server represents the local computer, use instead
524 * the local prefix to avoid a round in UNC name resolution. */
525 if (GetComputerNameA(ComputerName, &bufLen) &&
526 (stricmp(ComputerName, server) == 0))
527 {
528 server = local;
529 }
530 }
531 else
532 {
533 server = local;
534 }
535#endif
536
537 /* protseq=ncacn_np: named pipes */
538#ifdef __REACTOS__
539 pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(server) + strlen(endpoint));
540 strcpy(pipe_name, prefix);
541 strcat(pipe_name, server);
542 strcat(pipe_name, endpoint);
543#else
544 pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
545 strcat(strcpy(pipe_name, prefix), endpoint);
546#endif
547 return pipe_name;
548}
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define stricmp(_String1, _String2)
Definition: compat.h:24
#define local
Definition: zutil.h:30
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:716
BOOL WINAPI SHIM_OBJ_NAME() GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
Definition: shimtest.c:21
Definition: nis.h:10
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243

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

440{
441 static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
442 char *pipe_name;
443
444 /* protseq=ncalrpc: supposed to use NT LPC ports,
445 * but we'll implement it with named pipes for now */
446 pipe_name = I_RpcAllocate(sizeof(prefix) + strlen(endpoint));
447 strcat(strcpy(pipe_name, prefix), endpoint);
448 return pipe_name;
449}

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

2010{
2011 ResetEvent(async_data->completion_event);
2012 RpcHttpAsyncData_AddRef(async_data);
2013}
static ULONG RpcHttpAsyncData_AddRef(RpcHttpAsyncData *data)
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:714

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

◆ release_np_event()

static void release_np_event ( RpcConnection_np connection,
HANDLE  event 
)
static

Definition at line 103 of file rpc_transport.c.

104{
105 event = InterlockedExchangePointer(&connection->event_cache, event);
106 if (event)
108}
#define CloseHandle
Definition: compat.h:739

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

1990{
1991 return InterlockedIncrement(&data->refs);
1992}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by prepare_async_request().

◆ RpcHttpAsyncData_Release()

static ULONG RpcHttpAsyncData_Release ( RpcHttpAsyncData data)
static

Definition at line 1994 of file rpc_transport.c.

1995{
1996 ULONG refs = InterlockedDecrement(&data->refs);
1997 if (!refs)
1998 {
1999 TRACE("destroying async data %p\n", data);
2000 CloseHandle(data->completion_event);
2001 HeapFree(GetProcessHeap(), 0, data->inet_buffers.lpvBuffer);
2002 data->cs.DebugInfo->Spare[0] = 0;
2005 }
2006 return refs;
2007}
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

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

3972{
3973 RPC_PROTSEQ_VECTORA *pvector;
3974 unsigned int i;
3976
3977 TRACE("(%p)\n", protseqs);
3978
3979 *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned char*)*ARRAY_SIZE(protseq_list)));
3980 if (!*protseqs)
3981 goto end;
3982 pvector = *protseqs;
3983 pvector->Count = 0;
3984 for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3985 {
3986 pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, strlen(protseq_list[i].name)+1);
3987 if (pvector->Protseq[i] == NULL)
3988 goto end;
3989 strcpy((char*)pvector->Protseq[i], protseq_list[i].name);
3990 pvector->Count++;
3991 }
3992 status = RPC_S_OK;
3993
3994end:
3995 if (status != RPC_S_OK)
3997 return status;
3998}
GLuint GLuint end
Definition: gl.h:1545
static struct list protseqs
Definition: rpc_server.c:68
RPC_STATUS WINAPI RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA **protseqs)
static const struct protseq_ops protseq_list[]
unsigned char * Protseq[1]
Definition: rpcdce.h:91
unsigned int Count
Definition: rpcdce.h:90
Definition: name.c:39

◆ RpcNetworkInqProtseqsW()

RPC_STATUS WINAPI RpcNetworkInqProtseqsW ( RPC_PROTSEQ_VECTORW **  protseqs)

Definition at line 3938 of file rpc_transport.c.

3939{
3940 RPC_PROTSEQ_VECTORW *pvector;
3941 unsigned int i;
3943
3944 TRACE("(%p)\n", protseqs);
3945
3946 *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned short*)*ARRAY_SIZE(protseq_list)));
3947 if (!*protseqs)
3948 goto end;
3949 pvector = *protseqs;
3950 pvector->Count = 0;
3951 for (i = 0; i < ARRAY_SIZE(protseq_list); i++)
3952 {
3953 pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, (strlen(protseq_list[i].name)+1)*sizeof(unsigned short));
3954 if (pvector->Protseq[i] == NULL)
3955 goto end;
3957 (WCHAR*)pvector->Protseq[i], strlen(protseq_list[i].name) + 1);
3958 pvector->Count++;
3959 }
3960 status = RPC_S_OK;
3961
3962end:
3963 if (status != RPC_S_OK)
3965 return status;
3966}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
RPC_STATUS WINAPI RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW **protseqs)
unsigned int Count
Definition: rpcdce.h:96
unsigned short * Protseq[1]
Definition: rpcdce.h:97
char CHAR
Definition: xmlstorage.h:175

◆ RpcNetworkIsProtseqValidA()

RPC_STATUS WINAPI RpcNetworkIsProtseqValidA ( RPC_CSTR  protseq)

Definition at line 3886 of file rpc_transport.c.

3887{
3888 UNICODE_STRING protseqW;
3889
3890 if (RtlCreateUnicodeStringFromAsciiz(&protseqW, (char*)protseq))
3891 {
3893 RtlFreeUnicodeString(&protseqW);
3894 return ret;
3895 }
3896 return RPC_S_OUT_OF_MEMORY;
3897}
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
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 3869 of file rpc_transport.c.

3870{
3871 char ps[0x10];
3872
3873 WideCharToMultiByte(CP_ACP, 0, protseq, -1,
3874 ps, sizeof ps, NULL, NULL);
3876 return RPC_S_OK;
3877
3878 FIXME("Unknown protseq %s\n", debugstr_w(protseq));
3879
3881}
#define debugstr_w
Definition: kernel32.h:32
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
#define RPC_S_INVALID_RPC_PROTSEQ
Definition: winerror.h:1015

Referenced by RpcNetworkIsProtseqValidA().

◆ RpcProtseqVectorFreeA()

RPC_STATUS WINAPI RpcProtseqVectorFreeA ( RPC_PROTSEQ_VECTORA **  protseqs)

Definition at line 3902 of file rpc_transport.c.

3903{
3904 TRACE("(%p)\n", protseqs);
3905
3906 if (*protseqs)
3907 {
3908 unsigned int i;
3909 for (i = 0; i < (*protseqs)->Count; i++)
3910 HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3912 *protseqs = NULL;
3913 }
3914 return RPC_S_OK;
3915}

Referenced by RpcNetworkInqProtseqsA().

◆ RpcProtseqVectorFreeW()

RPC_STATUS WINAPI RpcProtseqVectorFreeW ( RPC_PROTSEQ_VECTORW **  protseqs)

Definition at line 3920 of file rpc_transport.c.

3921{
3922 TRACE("(%p)\n", protseqs);
3923
3924 if (*protseqs)
3925 {
3926 unsigned int i;
3927 for (i = 0; i < (*protseqs)->Count; i++)
3928 HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]);
3930 *protseqs = NULL;
3931 }
3932 return RPC_S_OK;
3933}

Referenced by RpcNetworkInqProtseqsW().

◆ RPCRT4_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3618 of file rpc_transport.c.

3619{
3620 TRACE("(Connection == ^%p)\n", Connection);
3621 if (SecIsValidHandle(&Connection->ctx))
3622 {
3623 DeleteSecurityContext(&Connection->ctx);
3624 SecInvalidateHandle(&Connection->ctx);
3625 }
3626 rpcrt4_conn_close(Connection);
3627 return RPC_S_OK;
3628}
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:200
CtxtHandle ctx
Definition: rpc_binding.h:74

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

323{
324 RpcConnection_np *connection = (RpcConnection_np *) conn;
325#ifdef __REACTOS__
326 DWORD ErrCode;
327 SECURITY_ATTRIBUTES SecurityAttributes;
328 PSECURITY_DESCRIPTOR PipeSecDesc;
329#endif
330
331 TRACE("listening on %s\n", connection->listen_pipe);
332
333#ifdef __REACTOS__
334 ErrCode = rpcrt4_create_pipe_security(&PipeSecDesc);
335 if (ErrCode != ERROR_SUCCESS)
336 {
337 ERR("rpcrt4_conn_create_pipe(): Pipe security descriptor creation failed!\n");
339 }
340
341 SecurityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
342 SecurityAttributes.lpSecurityDescriptor = PipeSecDesc;
343 SecurityAttributes.bInheritHandle = FALSE;
344
348 RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, &SecurityAttributes);
349 HeapFree(GetProcessHeap(), 0, PipeSecDesc);
350#else
355#endif
356 if (connection->pipe == INVALID_HANDLE_VALUE)
357 {
358 WARN("CreateNamedPipe failed with error %d\n", GetLastError());
360 {
362 }
363 else
364 {
366 }
367 }
368
369 return RPC_S_OK;
370}
#define WARN(fmt,...)
Definition: debug.h:112
#define ERROR_SUCCESS
Definition: deptool.c:10
struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
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 RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
LPVOID lpSecurityDescriptor
Definition: compat.h:193
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define PIPE_ACCESS_DUPLEX
Definition: winbase.h:164
#define PIPE_READMODE_MESSAGE
Definition: winbase.h:170
#define PIPE_TYPE_MESSAGE
Definition: winbase.h:168
#define PIPE_UNLIMITED_INSTANCES
Definition: winbase.h:175
#define RPC_S_CANT_CREATE_ENDPOINT
Definition: winerror.h:1031
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define RPC_S_DUPLICATE_ENDPOINT
Definition: winerror.h:1048

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

◆ rpcrt4_conn_np_alloc()

static RpcConnection * rpcrt4_conn_np_alloc ( void  )
static

Definition at line 91 of file rpc_transport.c.

92{
94 return &npc->common;
95}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
RpcConnection common
Definition: rpc_transport.c:82

◆ rpcrt4_conn_np_cancel_call()

static void rpcrt4_conn_np_cancel_call ( RpcConnection conn)
static

Definition at line 782 of file rpc_transport.c.

783{
784 RpcConnection_np *connection = (RpcConnection_np *)conn;
785 CancelIoEx(connection->pipe, NULL);
786}

◆ rpcrt4_conn_np_close()

static int rpcrt4_conn_np_close ( RpcConnection conn)
static

Definition at line 747 of file rpc_transport.c.

748{
749 RpcConnection_np *connection = (RpcConnection_np *) conn;
750 if (connection->pipe)
751 {
752 FlushFileBuffers(connection->pipe);
753 CloseHandle(connection->pipe);
754 connection->pipe = 0;
755 }
756 if (connection->listen_event)
757 {
758 CloseHandle(connection->listen_event);
759 connection->listen_event = 0;
760 }
761 if (connection->event_cache)
762 {
763 CloseHandle(connection->event_cache);
764 connection->event_cache = 0;
765 }
766 return 0;
767}
BOOL WINAPI FlushFileBuffers(IN HANDLE hFile)
Definition: fileinfo.c:25

◆ rpcrt4_conn_np_close_read()

static void rpcrt4_conn_np_close_read ( RpcConnection conn)
static

Definition at line 769 of file rpc_transport.c.

770{
771 RpcConnection_np *connection = (RpcConnection_np*)conn;
773
774 connection->read_closed = TRUE;
775#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
776 NtCancelIoFile(connection->pipe, &io_status);
777#else
778 NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
779#endif
780}
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE, PIO_STATUS_BLOCK, PIO_STATUS_BLOCK)
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:56
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:4019
IO_STATUS_BLOCK io_status
Definition: rpc_transport.c:86

◆ rpcrt4_conn_np_handoff()

static void rpcrt4_conn_np_handoff ( RpcConnection_np old_npc,
RpcConnection_np new_npc 
)
static

Definition at line 607 of file rpc_transport.c.

608{
609 /* because of the way named pipes work, we'll transfer the connected pipe
610 * to the child, then reopen the server binding to continue listening */
611
612 new_npc->pipe = old_npc->pipe;
613 old_npc->pipe = 0;
614 assert(!old_npc->listen_event);
615}
#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 906 of file rpc_transport.c.

907{
908 RpcConnection_np *npc = (RpcConnection_np *)conn;
909 BOOL ret;
910
911 TRACE("(%p)\n", conn);
912
913 if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
915
917 if (!ret)
918 {
920 WARN("ImpersonateNamedPipeClient failed with error %u\n", error);
921 switch (error)
922 {
925 }
926 }
927 return RPC_S_OK;
928}
BOOL WINAPI ImpersonateNamedPipeClient(HANDLE hNamedPipe)
Definition: security.c:1024
#define error(str)
Definition: mkdosfs.c:1605
RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn)
Definition: rpc_message.c:1131
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define ERROR_CANNOT_IMPERSONATE
Definition: winerror.h:849
#define RPC_S_NO_CONTEXT_AVAILABLE
Definition: winerror.h:1073

◆ rpcrt4_conn_np_read()

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

Definition at line 689 of file rpc_transport.c.

690{
691 RpcConnection_np *connection = (RpcConnection_np *) conn;
694
695 event = get_np_event(connection);
696 if (!event)
697 return -1;
698
699 if (connection->read_closed)
701 else
702 status = NtReadFile(connection->pipe, event, NULL, NULL, &connection->io_status, buffer, count, NULL, NULL);
703 if (status == STATUS_PENDING)
704 {
705 /* check read_closed again before waiting to avoid a race */
706 if (connection->read_closed)
707 {
709#ifdef __REACTOS__ /* FIXME: We should also cancel I/O for other threads */
710 NtCancelIoFile(connection->pipe, &io_status);
711#else
712 NtCancelIoFileEx(connection->pipe, &connection->io_status, &io_status);
713#endif
714 }
716 status = connection->io_status.u.Status;
717 }
718 release_np_event(connection, event);
719 return status && status != STATUS_BUFFER_OVERFLOW ? -1 : connection->io_status.Information;
720}
LONG NTSTATUS
Definition: precomp.h:26
#define INFINITE
Definition: serial.h:102
#define STATUS_PENDING
Definition: ntstatus.h:82
static HANDLE get_np_event(RpcConnection_np *connection)
Definition: rpc_transport.c:97
static void release_np_event(RpcConnection_np *connection, HANDLE event)
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
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)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define STATUS_CANCELLED
Definition: udferr_usr.h:170

Referenced by rpcrt4_conn_np_wait_for_incoming_data().

◆ rpcrt4_conn_np_revert_to_self()

static RPC_STATUS rpcrt4_conn_np_revert_to_self ( RpcConnection conn)
static

Definition at line 930 of file rpc_transport.c.

931{
932 BOOL ret;
933
934 TRACE("(%p)\n", conn);
935
936 if (conn->AuthInfo && SecIsValidHandle(&conn->ctx))
938
939 ret = RevertToSelf();
940 if (!ret)
941 {
942 WARN("RevertToSelf failed with error %u\n", GetLastError());
944 }
945 return RPC_S_OK;
946}
RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn)
Definition: rpc_message.c:1159
BOOL WINAPI RevertToSelf(void)
Definition: security.c:1608

◆ rpcrt4_conn_np_wait_for_incoming_data()

static int rpcrt4_conn_np_wait_for_incoming_data ( RpcConnection conn)
static

Definition at line 788 of file rpc_transport.c.

789{
790 return rpcrt4_conn_np_read(conn, NULL, 0);
791}
static int rpcrt4_conn_np_read(RpcConnection *conn, void *buffer, unsigned int count)

◆ rpcrt4_conn_np_write()

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

Definition at line 722 of file rpc_transport.c.

723{
724 RpcConnection_np *connection = (RpcConnection_np *) conn;
728
729 event = get_np_event(connection);
730 if (!event)
731 return -1;
732
734 if (status == STATUS_PENDING)
735 {
737 status = io_status.u.Status;
738 }
739 release_np_event(connection, event);
740 if (status)
741 return -1;
742
743 assert(io_status.Information == count);
744 return count;
745}
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)

◆ rpcrt4_conn_open_pipe()

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

Definition at line 372 of file rpc_transport.c.

373{
374 RpcConnection_np *npc = (RpcConnection_np *) Connection;
375 HANDLE pipe;
376 DWORD err, dwMode;
377
378 TRACE("connecting to %s\n", pname);
379
380 while (TRUE) {
381 DWORD dwFlags = 0;
382 if (Connection->QOS)
383 {
385 switch (Connection->QOS->qos->ImpersonationType)
386 {
388 /* FIXME: what to do here? */
389 break;
392 break;
395 break;
398 break;
401 break;
402 }
405 }
408 if (pipe != INVALID_HANDLE_VALUE) break;
409 err = GetLastError();
410 if (err == ERROR_PIPE_BUSY) {
412 TRACE("retrying busy server\n");
413 continue;
414 }
415 TRACE("connection failed, error=%x\n", err);
417#ifdef __REACTOS__
418 } else if (err == ERROR_BAD_NETPATH) {
419 TRACE("connection failed, error=%x\n", err);
421#endif
422 }
423 if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
424 err = GetLastError();
425 WARN("connection failed, error=%x\n", err);
427 }
428 }
429
430 /* success */
431 /* pipe is connected; change to message-read mode. */
432 dwMode = PIPE_READMODE_MESSAGE;
433 SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL);
434 npc->pipe = pipe;
435
436 return RPC_S_OK;
437}
#define OPEN_EXISTING
Definition: compat.h:775
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
GLenum pname
Definition: glext.h:5645
BOOL WINAPI SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout)
Definition: npipe.c:774
#define GENERIC_WRITE
Definition: nt_native.h:90
#define err(...)
#define RPC_C_IMP_LEVEL_IDENTIFY
Definition: rpcdce.h:175
#define RPC_C_QOS_IDENTITY_DYNAMIC
Definition: rpcdce.h:181
#define RPC_C_IMP_LEVEL_DELEGATE
Definition: rpcdce.h:177
#define RPC_C_IMP_LEVEL_IMPERSONATE
Definition: rpcdce.h:176
#define RPC_C_IMP_LEVEL_ANONYMOUS
Definition: rpcdce.h:174
#define RPC_C_IMP_LEVEL_DEFAULT
Definition: rpcdce.h:173
#define NMPWAIT_WAIT_FOREVER
Definition: winbase.h:133
#define SECURITY_DELEGATION
Definition: winbase.h:543
#define NMPWAIT_USE_DEFAULT_WAIT
Definition: winbase.h:134
#define SECURITY_IMPERSONATION
Definition: winbase.h:542
#define SECURITY_ANONYMOUS
Definition: winbase.h:540
#define SECURITY_SQOS_PRESENT
Definition: winbase.h:546
#define SECURITY_IDENTIFICATION
Definition: winbase.h:541
#define SECURITY_CONTEXT_TRACKING
Definition: winbase.h:544
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176
#define RPC_S_SERVER_TOO_BUSY
Definition: winerror.h:1034
#define ERROR_BAD_NETPATH
Definition: winerror.h:145
#define ERROR_PIPE_BUSY
Definition: winerror.h:283

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

3695{
3696 HANDLE event = NULL;
3697
3698 if (connection->ref > 1)
3699 event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3700
3701 RPCRT4_ReleaseConnection(connection);
3702
3703 if(event)
3704 {
3707 }
3708}
void RPCRT4_ReleaseConnection(RpcConnection *connection)
HANDLE wait_release
Definition: rpc_binding.h:66

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_tcp_alloc()

static RpcConnection * rpcrt4_conn_tcp_alloc ( void  )
static

Definition at line 1443 of file rpc_transport.c.

1444{
1445 RpcConnection_tcp *tcpc;
1447 if (tcpc == NULL)
1448 return NULL;
1449 tcpc->sock = -1;
1450 if (!rpcrt4_sock_wait_init(tcpc))
1451 {
1452 HeapFree(GetProcessHeap(), 0, tcpc);
1453 return NULL;
1454 }
1455 return &tcpc->common;
1456}
static BOOL rpcrt4_sock_wait_init(RpcConnection_tcp *tcpc)
RpcConnection common

◆ rpcrt4_conn_tcp_cancel_call()

static void rpcrt4_conn_tcp_cancel_call ( RpcConnection conn)
static

Definition at line 1793 of file rpc_transport.c.

1794{
1795 RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1796
1797 TRACE("%p\n", connection);
1798
1799 SetEvent(connection->cancel_event);
1800}
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733

◆ rpcrt4_conn_tcp_close()

static int rpcrt4_conn_tcp_close ( RpcConnection conn)
static

Definition at line 1773 of file rpc_transport.c.

1774{
1775 RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1776
1777 TRACE("%d\n", connection->sock);
1778
1779 if (connection->sock != -1)
1780 closesocket(connection->sock);
1781 connection->sock = -1;
1782 CloseHandle(connection->sock_event);
1783 CloseHandle(connection->cancel_event);
1784 return 0;
1785}
#define closesocket
Definition: ncftp.h:477

◆ rpcrt4_conn_tcp_close_read()

static void rpcrt4_conn_tcp_close_read ( RpcConnection conn)
static

Definition at line 1787 of file rpc_transport.c.

1788{
1789 RpcConnection_tcp *connection = (RpcConnection_tcp *) conn;
1790 shutdown(connection->sock, SD_RECEIVE);
1791}
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 1687 of file rpc_transport.c.

1688{
1689 int ret;
1690 struct sockaddr_in address;
1691 socklen_t addrsize;
1694 u_long nonblocking;
1695
1696 addrsize = sizeof(address);
1697 ret = accept(server->sock, (struct sockaddr*) &address, &addrsize);
1698 if (ret < 0)
1699 {
1700 ERR("Failed to accept a TCP connection: error %d\n", ret);
1702 }
1703
1704 nonblocking = 1;
1705 ioctlsocket(ret, FIONBIO, &nonblocking);
1706 client->sock = ret;
1707
1708 client->common.NetworkAddr = HeapAlloc(GetProcessHeap(), 0, INET6_ADDRSTRLEN);
1709 ret = getnameinfo((struct sockaddr*)&address, addrsize, client->common.NetworkAddr, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
1710 if (ret != 0)
1711 {
1712 ERR("Failed to retrieve the IP address, error %d\n", ret);
1714 }
1715
1716 TRACE("Accepted a new TCP connection from %s\n", client->common.NetworkAddr);
1717 return RPC_S_OK;
1718}
unsigned long u_long
Definition: linux.h:269
GLuint address
Definition: glext.h:9393
int socklen_t
Definition: tcp.c:35
#define ioctlsocket
Definition: ncftp.h:481
static FILE * client
Definition: client.c:41
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define FIONBIO
Definition: winsock.h:149
#define NI_NUMERICHOST
Definition: ws2def.h:354
#define INET6_ADDRSTRLEN
Definition: ws2ipdef.h:132
#define getnameinfo
Definition: wspiapi.h:45

◆ rpcrt4_conn_tcp_is_server_listening()

static RPC_STATUS rpcrt4_conn_tcp_is_server_listening ( const char endpoint)
static

Definition at line 1802 of file rpc_transport.c.

1803{
1804 FIXME("\n");
1805 return RPC_S_ACCESS_DENIED;
1806}
#define RPC_S_ACCESS_DENIED
Definition: rpcnterr.h:29

◆ rpcrt4_conn_tcp_read()

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

Definition at line 1720 of file rpc_transport.c.

1722{
1723 RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1724 int bytes_read = 0;
1725 while (bytes_read != count)
1726 {
1727 int r = recv(tcpc->sock, (char *)buffer + bytes_read, count - bytes_read, 0);
1728 if (!r)
1729 return -1;
1730 else if (r > 0)
1731 bytes_read += r;
1732 else if (WSAGetLastError() == WSAEINTR)
1733 continue;
1734 else if (WSAGetLastError() != WSAEWOULDBLOCK)
1735 {
1736 WARN("recv() failed: %u\n", WSAGetLastError());
1737 return -1;
1738 }
1739 else
1740 {
1741 if (!rpcrt4_sock_wait_for_recv(tcpc))
1742 return -1;
1743 }
1744 }
1745 TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_read);
1746 return bytes_read;
1747}
INT WSAAPI recv(IN SOCKET s, OUT CHAR FAR *buf, IN INT len, IN INT flags)
Definition: recv.c:23
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static BOOL rpcrt4_sock_wait_for_recv(RpcConnection_tcp *tcpc)
#define WSAEWOULDBLOCK
Definition: winerror.h:1948
#define WSAEINTR
Definition: winerror.h:1942
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:112

◆ rpcrt4_conn_tcp_wait_for_incoming_data()

static int rpcrt4_conn_tcp_wait_for_incoming_data ( RpcConnection Connection)
static

Definition at line 1808 of file rpc_transport.c.

1809{
1810 RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1811
1812 TRACE("%p\n", Connection);
1813
1814 if (!rpcrt4_sock_wait_for_recv(tcpc))
1815 return -1;
1816 return 0;
1817}

◆ rpcrt4_conn_tcp_write()

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

Definition at line 1749 of file rpc_transport.c.

1751{
1752 RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1753 int bytes_written = 0;
1754 while (bytes_written != count)
1755 {
1756 int r = send(tcpc->sock, (const char *)buffer + bytes_written, count - bytes_written, 0);
1757 if (r >= 0)
1758 bytes_written += r;
1759 else if (WSAGetLastError() == WSAEINTR)
1760 continue;
1761 else if (WSAGetLastError() != WSAEWOULDBLOCK)
1762 return -1;
1763 else
1764 {
1765 if (!rpcrt4_sock_wait_for_send(tcpc))
1766 return -1;
1767 }
1768 }
1769 TRACE("%d %p %u -> %d\n", tcpc->sock, buffer, count, bytes_written);
1770 return bytes_written;
1771}
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)

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

3633{
3634 static LONG next_id;
3635 const struct connection_ops *ops;
3636 RpcConnection* NewConnection;
3637
3638 ops = rpcrt4_get_conn_protseq_ops(Protseq);
3639 if (!ops)
3640 {
3641 FIXME("not supported for protseq %s\n", Protseq);
3643 }
3644
3645 NewConnection = ops->alloc();
3646 NewConnection->ref = 1;
3647 NewConnection->server = server;
3648 NewConnection->ops = ops;
3649 NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
3650 NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
3651 NewConnection->NetworkOptions = RPCRT4_strdupW(NetworkOptions);
3652 NewConnection->CookieAuth = RPCRT4_strdupW(CookieAuth);
3654 NewConnection->NextCallId = 1;
3655
3656 SecInvalidateHandle(&NewConnection->ctx);
3657 if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3658 NewConnection->AuthInfo = AuthInfo;
3659 NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3661 NewConnection->QOS = QOS;
3662
3663 list_init(&NewConnection->conn_pool_entry);
3664 list_init(&NewConnection->protseq_entry);
3665
3666 TRACE("connection: %p\n", NewConnection);
3667 *Connection = NewConnection;
3668
3669 return RPC_S_OK;
3670}
static void list_init(struct list_entry *head)
Definition: list.h:51
long LONG
Definition: pedump.c:60
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1183
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
Definition: rpc_binding.c:1360
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
LPSTR NetworkAddr
Definition: rpc_binding.h:67
struct list conn_pool_entry
Definition: rpc_binding.h:85
USHORT NextCallId
Definition: rpc_binding.h:93
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
const struct connection_ops * ops
Definition: rpc_binding.h:70
struct list protseq_entry
Definition: rpc_binding.h:94
LPWSTR CookieAuth
Definition: rpc_binding.h:82
ULONG auth_context_id
Definition: rpc_binding.h:78
RpcConnection *(* alloc)(void)
Definition: rpc_binding.h:102
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1014
struct _QualityOfService QOS

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

3600{
3601 unsigned int i;
3602 for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3603 if (!strcmp(conn_protseq_list[i].name, protseq))
3604 return &conn_protseq_list[i];
3605 return NULL;
3606}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const struct connection_ops conn_protseq_list[]

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

3591{
3592 unsigned int i;
3593 for(i = 0; i < ARRAY_SIZE(protseq_list); i++)
3594 if (!strcmp(protseq_list[i].name, protseq))
3595 return &protseq_list[i];
3596 return NULL;
3597}

Referenced by alloc_serverprotoseq().

◆ RPCRT4_GrabConnection()

RpcConnection * RPCRT4_GrabConnection ( RpcConnection connection)

Definition at line 3710 of file rpc_transport.c.

3711{
3712 LONG ref = InterlockedIncrement(&connection->ref);
3713 TRACE("%p ref=%u\n", connection, ref);
3714 return connection;
3715}
Definition: send.c:48

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

2338{
2339 char *buf = buffer;
2340 BOOL ret;
2341 unsigned int bytes_left = count;
2343
2345
2346 while (bytes_left)
2347 {
2348 async_data->inet_buffers.dwBufferLength = bytes_left;
2349 prepare_async_request(async_data);
2350 ret = InternetReadFileExW(req, &async_data->inet_buffers, IRF_ASYNC, 0);
2351 status = wait_async_request(async_data, ret, cancel_event);
2352 if (status != RPC_S_OK)
2353 {
2355 TRACE("call cancelled\n");
2356 break;
2357 }
2358
2359 if (!async_data->inet_buffers.dwBufferLength)
2360 break;
2361 memcpy(buf, async_data->inet_buffers.lpvBuffer,
2362 async_data->inet_buffers.dwBufferLength);
2363
2364 bytes_left -= async_data->inet_buffers.dwBufferLength;
2365 buf += async_data->inet_buffers.dwBufferLength;
2366 }
2367
2368 HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer);
2369 async_data->inet_buffers.lpvBuffer = NULL;
2370
2371 TRACE("%p %p %u -> %u\n", req, buffer, count, status);
2372 return status == RPC_S_OK ? count : -1;
2373}
BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:2248
DWORD dwBufferLength
Definition: wininet.h:278
LPVOID lpvBuffer
Definition: wininet.h:277
INTERNET_BUFFERSW inet_buffers
#define RPC_S_CALL_CANCELLED
Definition: winerror.h:1125
#define IRF_ASYNC
Definition: wininet.h:622

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

2176{
2177 BOOL ret;
2179 DWORD size;
2180 DWORD index;
2181 WCHAR buf[32];
2182 WCHAR *status_text = buf;
2183 TRACE("\n");
2184
2185 index = 0;
2186 size = sizeof(status_code);
2188 if (!ret)
2189 return GetLastError();
2191 return RPC_S_OK;
2192 index = 0;
2193 size = sizeof(buf);
2194 ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
2196 {
2197 status_text = HeapAlloc(GetProcessHeap(), 0, size);
2198 ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index);
2199 }
2200
2201 ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : "<status text unavailable>");
2202 if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text);
2203
2205 return ERROR_ACCESS_DENIED;
2207}
#define index(s, c)
Definition: various.h:29
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define HTTP_STATUS_OK
Definition: winhttp.h:240
#define HTTP_STATUS_DENIED
Definition: winhttp.h:256
#define HTTP_QUERY_STATUS_TEXT
Definition: wininet.h:1543
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542

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

2156{
2157 RpcHttpAsyncData *async_data = (RpcHttpAsyncData *)dwContext;
2158
2159 switch (dwInternetStatus)
2160 {
2162 TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n");
2163 if (async_data)
2164 {
2165 INTERNET_ASYNC_RESULT *async_result = lpvStatusInformation;
2166
2167 async_data->async_result = async_result->dwResult ? ERROR_SUCCESS : async_result->dwError;
2168 SetEvent(async_data->completion_event);
2169 RpcHttpAsyncData_Release(async_data);
2170 }
2171 break;
2172 }
2173}
static ULONG RpcHttpAsyncData_Release(RpcHttpAsyncData *data)
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 2209 of file rpc_transport.c.

2210{
2211 static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0};
2212 LPWSTR proxy = NULL;
2213 LPWSTR user = NULL;
2215 LPWSTR servername = NULL;
2216 const WCHAR *option;
2218
2219 if (httpc->common.QOS &&
2221 {
2222 const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_cred = httpc->common.QOS->qos->u.HttpCredentials;
2223 if (http_cred->TransportCredentials)
2224 {
2225 WCHAR *p;
2226 const SEC_WINNT_AUTH_IDENTITY_W *cred = http_cred->TransportCredentials;
2227 ULONG len = cred->DomainLength + 1 + cred->UserLength;
2228 user = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR));
2229 if (!user)
2231 p = user;
2232 if (cred->DomainLength)
2233 {
2234 memcpy(p, cred->Domain, cred->DomainLength * sizeof(WCHAR));
2235 p += cred->DomainLength;
2236 *p = '\\';
2237 p++;
2238 }
2239 memcpy(p, cred->User, cred->UserLength * sizeof(WCHAR));
2240 p[cred->UserLength] = 0;
2241
2243 }
2244 }
2245
2246 for (option = httpc->common.NetworkOptions; option;
2247 option = (wcschr(option, ',') ? wcschr(option, ',')+1 : NULL))
2248 {
2249 static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0};
2250 static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0};
2251
2252 if (!_wcsnicmp(option, wszRpcProxy, ARRAY_SIZE(wszRpcProxy)-1))
2253 {
2254 const WCHAR *value_start = option + ARRAY_SIZE(wszRpcProxy)-1;
2255 const WCHAR *value_end;
2256 const WCHAR *p;
2257
2258 value_end = wcschr(option, ',');
2259 if (!value_end)
2260 value_end = value_start + lstrlenW(value_start);
2261 for (p = value_start; p < value_end; p++)
2262 if (*p == ':')
2263 {
2264 port = wcstol(p+1, NULL, 10);
2265 value_end = p;
2266 break;
2267 }
2268 TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
2269 servername = RPCRT4_strndupW(value_start, value_end-value_start);
2270 }
2271 else if (!_wcsnicmp(option, wszHttpProxy, ARRAY_SIZE(wszHttpProxy)-1))
2272 {
2273 const WCHAR *value_start = option + ARRAY_SIZE(wszHttpProxy)-1;
2274 const WCHAR *value_end;
2275
2276 value_end = wcschr(option, ',');
2277 if (!value_end)
2278 value_end = value_start + lstrlenW(value_start);
2279 TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start));
2280 proxy = RPCRT4_strndupW(value_start, value_end-value_start);
2281 }
2282 else
2283 FIXME("unhandled option %s\n", debugstr_w(option));
2284 }
2285
2288 if (!httpc->app_info)
2289 {
2293 HeapFree(GetProcessHeap(), 0, servername);
2294 ERR("InternetOpenW failed with error %d\n", GetLastError());
2296 }
2298
2299 /* if no RpcProxy option specified, set the HTTP server address to the
2300 * RPC server address */
2301 if (!servername)
2302 {
2303 servername = HeapAlloc(GetProcessHeap(), 0, (strlen(httpc->common.NetworkAddr) + 1)*sizeof(WCHAR));
2304 if (!servername)
2305 {
2310 }
2311 MultiByteToWideChar(CP_ACP, 0, httpc->common.NetworkAddr, -1, servername, strlen(httpc->common.NetworkAddr) + 1);
2312 }
2313
2314 port = (httpc->common.QOS &&
2318
2319 httpc->session = InternetConnectW(httpc->app_info, servername, port, user, password,
2320 INTERNET_SERVICE_HTTP, 0, 0);
2321
2325
2326 if (!httpc->session)
2327 {
2328 ERR("InternetConnectW failed with error %d\n", GetLastError());
2329 HeapFree(GetProcessHeap(), 0, servername);
2331 }
2332 httpc->servername = servername;
2333 return RPC_S_OK;
2334}
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define wcschr
Definition: compat.h:17
USHORT port
Definition: uri.c:228
INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW(HINTERNET hInternet, INTERNET_STATUS_CALLBACK lpfnIntCB)
Definition: internet.c:2075
HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:1258
HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags)
Definition: internet.c:979
int proxy
Definition: main.c:67
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define debugstr_wn
Definition: kernel32.h:33
static WCHAR password[]
Definition: url.c:33
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:91
static VOID WINAPI rpcrt4_http_internet_callback(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation, DWORD dwStatusInformationLength)
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
unsigned short * Password
Definition: rpcdce.h:227
Definition: getopt.h:109
WORD INTERNET_PORT
Definition: winhttp.h:38
#define INTERNET_DEFAULT_HTTP_PORT
Definition: winhttp.h:36
#define INTERNET_DEFAULT_HTTPS_PORT
Definition: winhttp.h:37
#define INTERNET_FLAG_ASYNC
Definition: wininet.h:64
#define INTERNET_OPEN_TYPE_PROXY
Definition: wininet.h:523
#define INTERNET_OPEN_TYPE_PRECONFIG
Definition: wininet.h:521
#define INTERNET_SERVICE_HTTP
Definition: wininet.h:562
WCHAR * LPWSTR
Definition: xmlstorage.h:184

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

2106{
2107 HINTERNET in_request = param;
2108 RpcPktHdr *idle_pkt;
2109
2111 0, 0);
2112 if (idle_pkt)
2113 {
2114 DWORD bytes_written;
2115 InternetWriteFile(in_request, idle_pkt, idle_pkt->common.frag_len, &bytes_written);
2116 RPCRT4_FreeHeader(idle_pkt);
2117 }
2118}
BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, DWORD dwNumOfBytesToWrite, LPDWORD lpdwNumOfBytesWritten)
Definition: internet.c:2114
GLfloat param
Definition: glext.h:5796
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
RpcPktHdr * RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size)
Definition: rpc_message.c:291
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
unsigned short frag_len
Definition: rpc_defs.h:33
RpcPktCommonHdr common
Definition: rpc_defs.h:152

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

2412{
2413 BOOL ret;
2415 RpcPktHdr *hdr;
2416 INTERNET_BUFFERSW buffers_in;
2417 DWORD bytes_written;
2418
2419 if (!authorized)
2420 {
2421 /* ask wininet to authorize, if necessary */
2422 status = send_echo_request(in_request, async_data, cancel_event);
2423 if (status != RPC_S_OK) return status;
2424 }
2425 memset(&buffers_in, 0, sizeof(buffers_in));
2426 buffers_in.dwStructSize = sizeof(buffers_in);
2427 /* FIXME: get this from the registry */
2428 buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */
2429 status = insert_content_length_header(in_request, buffers_in.dwBufferTotal);
2430 if (status != RPC_S_OK) return status;
2431
2432 prepare_async_request(async_data);
2433 ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0);
2434 status = wait_async_request(async_data, ret, cancel_event);
2435 if (status != RPC_S_OK) return status;
2436
2437 TRACE("sending HTTP connect header to server\n");
2438 hdr = RPCRT4_BuildHttpConnectHeader(FALSE, connection_uuid, in_pipe_uuid, association_uuid);
2439 if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2440 ret = InternetWriteFile(in_request, hdr, hdr->common.frag_len, &bytes_written);
2442 if (!ret)
2443 {
2444 ERR("InternetWriteFile failed with error %d\n", GetLastError());
2446 }
2447
2448 return RPC_S_OK;
2449}
BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersIn, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:5500
char hdr[14]
Definition: iptest.cpp:33
RpcPktHdr * RPCRT4_BuildHttpConnectHeader(int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid)
Definition: rpc_message.c:344
static RPC_STATUS insert_content_length_header(HINTERNET request, DWORD len)
static RPC_STATUS send_echo_request(HINTERNET req, RpcHttpAsyncData *async_data, HANDLE cancel_event)
DWORD dwBufferTotal
Definition: wininet.h:279
DWORD dwStructSize
Definition: wininet.h:272

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

2500{
2501 BOOL ret;
2503 RpcPktHdr *hdr;
2504 BYTE *data_from_server;
2505 RpcPktHdr pkt_from_server;
2506 ULONG field1, field3;
2507 BYTE buf[20];
2508
2509 if (!authorized)
2510 {
2511 /* ask wininet to authorize, if necessary */
2512 status = send_echo_request(out_request, async_data, cancel_event);
2513 if (status != RPC_S_OK) return status;
2514 }
2515 else
2516 rpcrt4_http_async_read(out_request, async_data, cancel_event, buf, sizeof(buf));
2517
2518 hdr = RPCRT4_BuildHttpConnectHeader(TRUE, connection_uuid, out_pipe_uuid, NULL);
2519 if (!hdr) return RPC_S_OUT_OF_RESOURCES;
2520
2521 status = insert_content_length_header(out_request, hdr->common.frag_len);
2522 if (status != RPC_S_OK)
2523 {
2525 return status;
2526 }
2527
2528 TRACE("sending HTTP connect header to server\n");
2529 prepare_async_request(async_data);
2530 ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len);
2531 status = wait_async_request(async_data, ret, cancel_event);
2533 if (status != RPC_S_OK) return status;
2534
2535 status = rpcrt4_http_check_response(out_request);
2536 if (status != RPC_S_OK) return status;
2537
2538 status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2539 &pkt_from_server, &data_from_server);
2540 if (status != RPC_S_OK) return status;
2541 status = RPCRT4_ParseHttpPrepareHeader1(&pkt_from_server, data_from_server,
2542 &field1);
2543 HeapFree(GetProcessHeap(), 0, data_from_server);
2544 if (status != RPC_S_OK) return status;
2545 TRACE("received (%d) from first prepare header\n", field1);
2546
2547 for (;;)
2548 {
2549 status = rpcrt4_http_read_http_packet(out_request, async_data, cancel_event,
2550 &pkt_from_server, &data_from_server);
2551 if (status != RPC_S_OK) return status;
2552 if (pkt_from_server.http.flags != 0x0001) break;
2553
2554 TRACE("http idle packet, waiting for real packet\n");
2555 HeapFree(GetProcessHeap(), 0, data_from_server);
2556 if (pkt_from_server.http.num_data_items != 0)
2557 {
2558 ERR("HTTP idle packet should have no data items instead of %d\n",
2559 pkt_from_server.http.num_data_items);
2560 return RPC_S_PROTOCOL_ERROR;
2561 }
2562 }
2563 status = RPCRT4_ParseHttpPrepareHeader2(&pkt_from_server, data_from_server,
2564 &field1, flow_control_increment,
2565 &field3);
2566 HeapFree(GetProcessHeap(), 0, data_from_server);
2567 if (status != RPC_S_OK) return status;
2568 TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1, *flow_control_increment, field3);
2569
2570 return RPC_S_OK;
2571}
RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, unsigned char *data, ULONG *field1, ULONG *bytes_until_next_packet, ULONG *field3)
Definition: rpc_message.c:591
RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, unsigned char *data, ULONG *field1)
Definition: rpc_message.c:566
static RPC_STATUS rpcrt4_http_read_http_packet(HINTERNET request, RpcHttpAsyncData *async_data, HANDLE cancel_event, RpcPktHdr *hdr, BYTE **data)
unsigned short num_data_items
Definition: rpc_defs.h:139
unsigned short flags
Definition: rpc_defs.h:138
RpcPktHttpHdr http
Definition: rpc_defs.h:159
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
unsigned char BYTE
Definition: xxhash.c:193

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

2453{
2454 unsigned short data_len;
2455 unsigned int size;
2456
2457 if (rpcrt4_http_async_read(request, async_data, cancel_event, hdr, sizeof(hdr->common)) < 0)
2459 if (hdr->common.ptype != PKT_HTTP || hdr->common.frag_len < sizeof(hdr->http))
2460 {
2461 ERR("wrong packet type received %d or wrong frag_len %d\n",
2462 hdr->common.ptype, hdr->common.frag_len);
2463 return RPC_S_PROTOCOL_ERROR;
2464 }
2465
2466 size = sizeof(hdr->http) - sizeof(hdr->common);
2467 if (rpcrt4_http_async_read(request, async_data, cancel_event, &hdr->common + 1, size) < 0)
2469
2470 data_len = hdr->common.frag_len - sizeof(hdr->http);
2471 if (data_len)
2472 {
2473 *data = HeapAlloc(GetProcessHeap(), 0, data_len);
2474 if (!*data)
2476 if (rpcrt4_http_async_read(request, async_data, cancel_event, *data, data_len) < 0)
2477 {
2480 }
2481 }
2482 else
2483 *data = NULL;
2484
2485 if (!RPCRT4_IsValidHttpPacket(hdr, *data, data_len))
2486 {
2487 ERR("invalid http packet\n");
2489 return RPC_S_PROTOCOL_ERROR;
2490 }
2491
2492 return RPC_S_OK;
2493}
@ PKT_HTTP
Definition: rpc_defs.h:208
BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, unsigned short data_len)
Definition: rpc_message.c:483

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

2121{
2123 DWORD cached_last_sent_time = *last_sent_time;
2124 return HTTP_IDLE_TIME - (cur_time - cached_last_sent_time > HTTP_IDLE_TIME ? 0 : cur_time - cached_last_sent_time);
2125}
time_t cur_time
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
#define HTTP_IDLE_TIME

Referenced by rpcrt4_http_timer_thread().

◆ rpcrt4_http_timer_thread()

static DWORD CALLBACK rpcrt4_http_timer_thread ( PVOID  param)
static

Definition at line 2127 of file rpc_transport.c.

2128{
2129 HttpTimerThreadData *data_in = param;
2131 DWORD timeout;
2132
2133 data = *data_in;
2134 HeapFree(GetProcessHeap(), 0, data_in);
2135
2136 for (timeout = HTTP_IDLE_TIME;
2137 WaitForSingleObject(data.timer_cancelled, timeout) == WAIT_TIMEOUT;
2139 {
2140 /* are we too soon after last send? */
2141 if (GetTickCount() - *data.last_sent_time < HTTP_IDLE_TIME)
2142 continue;
2144 }
2145
2146 CloseHandle(data.timer_cancelled);
2147 return 0;
2148}
#define WAIT_TIMEOUT
Definition: dderror.h:14
static DWORD rpcrt4_http_timer_calc_timeout(DWORD *last_sent_time)
static VOID rpcrt4_http_keep_connection_active_timer_proc(PVOID param, BOOLEAN dummy)
Definition: dhcpd.h:245

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

1224{
1225 twr_tcp_floor_t *tcp_floor;
1226 twr_ipv4_floor_t *ipv4_floor;
1227 struct addrinfo *ai;
1228 struct addrinfo hints;
1229 int ret;
1230 size_t size = sizeof(*tcp_floor) + sizeof(*ipv4_floor);
1231
1232 TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint);
1233
1234 if (!tower_data)
1235 return size;
1236
1237 tcp_floor = (twr_tcp_floor_t *)tower_data;
1238 tower_data += sizeof(*tcp_floor);
1239
1240 ipv4_floor = (twr_ipv4_floor_t *)tower_data;
1241
1242 tcp_floor->count_lhs = sizeof(tcp_floor->protid);
1243 tcp_floor->protid = tcp_protid;
1244 tcp_floor->count_rhs = sizeof(tcp_floor->port);
1245
1246 ipv4_floor->count_lhs = sizeof(ipv4_floor->protid);
1247 ipv4_floor->protid = EPM_PROTOCOL_IP;
1248 ipv4_floor->count_rhs = sizeof(ipv4_floor->ipv4addr);
1249
1250 hints.ai_flags = AI_NUMERICHOST;
1251 /* FIXME: only support IPv4 at the moment. how is IPv6 represented by the EPM? */
1252 hints.ai_family = PF_INET;
1253 hints.ai_socktype = SOCK_STREAM;
1254 hints.ai_protocol = IPPROTO_TCP;
1255 hints.ai_addrlen = 0;
1256 hints.ai_addr = NULL;
1257 hints.ai_canonname = NULL;
1258 hints.ai_next = NULL;
1259
1260#ifdef __REACTOS__
1261 static BOOL wsa_inited;
1262 if (!wsa_inited)
1263 {
1264 WSADATA wsadata;
1265 WSAStartup(MAKEWORD(2, 2), &wsadata);
1266 /* Note: WSAStartup can be called more than once so we don't bother with
1267 * making accesses to wsa_inited thread-safe */
1268 wsa_inited = TRUE;
1269 }
1270#endif
1271
1272 ret = getaddrinfo(networkaddr, endpoint, &hints, &ai);
1273 if (ret)
1274 {
1275 ret = getaddrinfo("0.0.0.0", endpoint, &hints, &ai);
1276 if (ret)
1277 {
1278 ERR("getaddrinfo failed: %s\n", gai_strerror(ret));
1279 return 0;
1280 }
1281 }
1282
1283 if (ai->ai_family == PF_INET)
1284 {
1285 const struct sockaddr_in *sin = (const struct sockaddr_in *)ai->ai_addr;
1286 tcp_floor->port = sin->sin_port;
1287 ipv4_floor->ipv4addr = sin->sin_addr.s_addr;
1288 }
1289 else
1290 {
1291 ERR("unexpected protocol family %d\n", ai->ai_family);
1292 freeaddrinfo(ai);
1293 return 0;
1294 }
1295
1296 freeaddrinfo(ai);
1297
1298 return size;
1299}
_STLP_DECLSPEC complex< float > _STLP_CALL sin(const complex< float > &)
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
#define IPPROTO_TCP
Definition: ip.h:196
#define SOCK_STREAM
Definition: tcpip.h:118
#define EPM_PROTOCOL_IP
Definition: epm_towers.h:31
namespace GUID const ADDRINFOEXW * hints
Definition: sock.c:80
struct sockaddr * ai_addr
Definition: ws2def.h:671
int ai_family
Definition: ws2def.h:666
u_int16 count_lhs
Definition: epm_towers.h:75
u_int16 count_rhs
Definition: epm_towers.h:77
u_int32 ipv4addr
Definition: epm_towers.h:78
u_int16 count_lhs
Definition: epm_towers.h:67
u_int16 port
Definition: epm_towers.h:70
u_int16 count_rhs
Definition: epm_towers.h:69
#define MAKEWORD(a, b)
Definition: typedefs.h:248
#define PF_INET
Definition: winsock.h:373
#define AI_NUMERICHOST
Definition: ws2def.h:295
#define getaddrinfo
Definition: wspiapi.h:44
#define freeaddrinfo
Definition: wspiapi.h:46

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

1306{
1307 const twr_tcp_floor_t *tcp_floor = (const twr_tcp_floor_t *)tower_data;
1308 const twr_ipv4_floor_t *ipv4_floor;
1309 struct in_addr in_addr;
1310
1311 TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint);
1312
1313 if (tower_size < sizeof(*tcp_floor))
1314 return EPT_S_NOT_REGISTERED;
1315
1316 tower_data += sizeof(*tcp_floor);
1317 tower_size -= sizeof(*tcp_floor);
1318
1319 if (tower_size < sizeof(*ipv4_floor))
1320 return EPT_S_NOT_REGISTERED;
1321
1322 ipv4_floor = (const twr_ipv4_floor_t *)tower_data;
1323
1324 if ((tcp_floor->count_lhs != sizeof(tcp_floor->protid)) ||
1325 (tcp_floor->protid != tcp_protid) ||
1326 (tcp_floor->count_rhs != sizeof(tcp_floor->port)) ||
1327 (ipv4_floor->count_lhs != sizeof(ipv4_floor->protid)) ||
1328 (ipv4_floor->protid != EPM_PROTOCOL_IP) ||
1329 (ipv4_floor->count_rhs != sizeof(ipv4_floor->ipv4addr)))
1330 return EPT_S_NOT_REGISTERED;
1331
1332 if (endpoint)
1333 {
1334 *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */);
1335 if (!*endpoint)
1337 sprintf(*endpoint, "%u", ntohs(tcp_floor->port));
1338 }
1339
1340 if (networkaddr)
1341 {
1342 *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN);
1343 if (!*networkaddr)
1344 {
1345 if (endpoint)
1346 {
1348 *endpoint = NULL;
1349 }
1351 }
1352 in_addr.s_addr = ipv4_floor->ipv4addr;
1353 if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN))
1354 {
1355 ERR("inet_ntop: %u\n", WSAGetLastError());
1356 I_RpcFree(*networkaddr);
1357 *networkaddr = NULL;
1358 if (endpoint)
1359 {
1361 *endpoint = NULL;
1362 }
1363 return EPT_S_NOT_REGISTERED;
1364 }
1365 }
1366
1367 return RPC_S_OK;
1368}
#define AF_INET
Definition: tcpip.h:117
#define ntohs(x)
Definition: module.h:210
#define sprintf(buf, format,...)
Definition: sprintf.c:55
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:724
Definition: tcpip.h:126
u32_t s_addr
Definition: inet.h:45
const char *WSAAPI inet_ntop(int af, const void *src, char *dst, size_t cnt)
Definition: unix_func.c:8
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1061
#define INET_ADDRSTRLEN
Definition: ws2ipdef.h:131

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

3761{
3762 const struct connection_ops *ops;
3763
3764 ops = rpcrt4_get_conn_protseq_ops(protseq);
3765 if (!ops)
3766 {
3767 FIXME("not supported for protseq %s\n", protseq);
3768 return RPC_S_INVALID_BINDING;
3769 }
3770
3771 return ops->is_server_listening(endpoint);
3772}
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1013

Referenced by RpcMgmtIsServerListening().

◆ rpcrt4_ncacn_http_alloc()

static RpcConnection * rpcrt4_ncacn_http_alloc ( void  )
static

Definition at line 2078 of file rpc_transport.c.

2079{
2080 RpcConnection_http *httpc;
2081 httpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*httpc));
2082 if (!httpc) return NULL;
2084 if (!httpc->async_data)
2085 {
2086 HeapFree(GetProcessHeap(), 0, httpc);
2087 return NULL;
2088 }
2089 TRACE("async data = %p\n", httpc->async_data);
2091 httpc->async_data->refs = 1;
2094 httpc->async_data->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcHttpAsyncData.cs");
2095 return &httpc->common;
2096}
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:887
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:894
CRITICAL_SECTION cs
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76
struct _INTERNET_BUFFERSW INTERNET_BUFFERSW

◆ rpcrt4_ncacn_http_cancel_call()

static void rpcrt4_ncacn_http_cancel_call ( RpcConnection Connection)
static

Definition at line 3423 of file rpc_transport.c.

3424{
3425 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3426
3427 SetEvent(httpc->cancel_event);
3428}

◆ rpcrt4_ncacn_http_close()

static int rpcrt4_ncacn_http_close ( RpcConnection Connection)
static

Definition at line 3390 of file rpc_transport.c.

3391{
3392 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3393
3394 TRACE("\n");
3395
3396 SetEvent(httpc->timer_cancelled);
3397 if (httpc->in_request)
3399 httpc->in_request = NULL;
3400 if (httpc->out_request)
3402 httpc->out_request = NULL;
3403 if (httpc->app_info)
3405 httpc->app_info = NULL;
3406 if (httpc->session)
3408 httpc->session = NULL;
3410 if (httpc->cancel_event)
3411 CloseHandle(httpc->cancel_event);
3412 HeapFree(GetProcessHeap(), 0, httpc->servername);
3413 httpc->servername = NULL;
3414
3415 return 0;
3416}
BOOL WINAPI InternetCloseHandle(HINTERNET hInternet)
Definition: internet.c:1414

Referenced by rpcrt4_ncacn_http_close_read().

◆ rpcrt4_ncacn_http_close_read()

static void rpcrt4_ncacn_http_close_read ( RpcConnection conn)
static

Definition at line 3418 of file rpc_transport.c.

3419{
3420 rpcrt4_ncacn_http_close(conn); /* FIXME */
3421}
static int rpcrt4_ncacn_http_close(RpcConnection *Connection)

◆ rpcrt4_ncacn_http_get_top_of_tower()

static size_t rpcrt4_ncacn_http_get_top_of_tower ( unsigned char tower_data,
const char networkaddr,
const char endpoint 
)
static

Definition at line 3449 of file rpc_transport.c.

3452{
3453 return rpcrt4_ip_tcp_get_top_of_tower(tower_data, networkaddr,
3455}
#define EPM_PROTOCOL_HTTP
Definition: epm_towers.h:49
static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, const char *networkaddr, unsigned char tcp_protid, const char *endpoint)

◆ rpcrt4_ncacn_http_handoff()

static RPC_STATUS rpcrt4_ncacn_http_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
static

Definition at line 3207 of file rpc_transport.c.

3208{
3209 assert(0);
3211}

◆ rpcrt4_ncacn_http_is_server_listening()

static RPC_STATUS rpcrt4_ncacn_http_is_server_listening ( const char endpoint)
static

Definition at line 3430 of file rpc_transport.c.

3431{
3432 FIXME("\n");
3433 return RPC_S_ACCESS_DENIED;
3434}

◆ rpcrt4_ncacn_http_open()

static RPC_STATUS rpcrt4_ncacn_http_open ( RpcConnection Connection)
static

Definition at line 3071 of file rpc_transport.c.

3072{
3073 RpcConnection_http *httpc = (RpcConnection_http *)Connection;
3074 static const WCHAR wszVerbIn[] = {'R','P','C','_','I','N','_','D','A','T','A',0};
3075 static const WCHAR wszVerbOut[] = {'R','P','C','_','O','U','T','_','D','A','T','A',0};
3076 static const WCHAR wszRpcProxyPrefix[] = {'/','r','p','c','/','r','p','c','p','r','o','x','y','.','d','l','l','?',0};
3077 static const WCHAR wszColon[] = {':',0};
3078 static const WCHAR wszAcceptType[] = {'a','p','p','l','i','c','a','t','i','o','n','/','r','p','c',0};
3079 LPCWSTR wszAcceptTypes[] = { wszAcceptType, NULL };
3080 DWORD flags;
3081 WCHAR *url;
3083 BOOL secure, credentials;
3084 HttpTimerThreadData *timer_data;
3085 HANDLE thread;
3086
3087 TRACE("(%s, %s)\n", Connection->NetworkAddr, Connection->Endpoint);
3088
3089 if (Connection->server)
3090 {
3091 ERR("ncacn_http servers not supported yet\n");
3093 }
3094
3095 if (httpc->in_request)
3096 return RPC_S_OK;
3097
3099
3100 UuidCreate(&httpc->connection_uuid);
3101 UuidCreate(&httpc->in_pipe_uuid);
3102 UuidCreate(&httpc->out_pipe_uuid);
3103
3105 if (status != RPC_S_OK)
3106 return status;
3107
3108 url = HeapAlloc(GetProcessHeap(), 0, sizeof(wszRpcProxyPrefix) + (strlen(Connection->NetworkAddr) + 1 + strlen(Connection->Endpoint))*sizeof(WCHAR));
3109 if (!url)
3110 return RPC_S_OUT_OF_MEMORY;
3111 memcpy(url, wszRpcProxyPrefix, sizeof(wszRpcProxyPrefix));
3112 MultiByteToWideChar(CP_ACP, 0, Connection->NetworkAddr, -1, url+ARRAY_SIZE(wszRpcProxyPrefix)-1,
3113 strlen(Connection->NetworkAddr)+1);
3114 lstrcatW(url, wszColon);
3115 MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+lstrlenW(url), strlen(Connection->Endpoint)+1);
3116
3117 secure = is_secure(httpc);
3118 credentials = has_credentials(httpc);
3119
3123 if (credentials) flags |= INTERNET_FLAG_NO_AUTH;
3124
3125 status = set_auth_cookie(httpc, Connection->CookieAuth);
3126 if (status != RPC_S_OK)
3127 {
3129 return status;
3130 }
3131 httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL, NULL, wszAcceptTypes,
3132 flags, (DWORD_PTR)httpc->async_data);
3133 if (!httpc->in_request)
3134 {
3135 ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
3138 }
3139
3140 if (credentials)
3141 {
3142 status = authorize_request(httpc, httpc->in_request);
3143 if (status != RPC_S_OK)
3144 {
3146 return status;
3147 }
3149 if (status != RPC_S_OK)
3150 {
3152 return status;
3153 }
3154 drain_content(httpc->in_request, httpc->async_data, httpc->cancel_event);
3155 }
3156
3157 httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL, NULL, wszAcceptTypes,
3158 flags, (DWORD_PTR)httpc->async_data);
3160 if (!httpc->out_request)
3161 {
3162 ERR("HttpOpenRequestW failed with error %d\n", GetLastError());
3164 }
3165
3166 if (credentials)
3167 {
3168 status = authorize_request(httpc, httpc->out_request);
3169 if (status != RPC_S_OK)
3170 return status;
3171 }
3172
3174 &httpc->connection_uuid, &httpc->in_pipe_uuid,
3175 &Connection->assoc->http_uuid, credentials);
3176 if (status != RPC_S_OK)
3177 return status;
3178
3180 &httpc->connection_uuid, &httpc->out_pipe_uuid,
3181 &httpc->flow_control_increment, credentials);
3182 if (status != RPC_S_OK)
3183 return status;
3184
3185 httpc->flow_control_mark = httpc->flow_control_increment / 2;
3186 httpc->last_sent_time = GetTickCount();
3188
3189 timer_data = HeapAlloc(GetProcessHeap(), 0, sizeof(*timer_data));
3190 if (!timer_data)
3191 return ERROR_OUTOFMEMORY;
3192 timer_data->timer_param = httpc->in_request;
3193 timer_data->last_sent_time = &httpc->last_sent_time;
3194 timer_data->timer_cancelled = httpc->timer_cancelled;
3195 /* FIXME: should use CreateTimerQueueTimer when implemented */
3196 thread = CreateThread(NULL, 0, rpcrt4_http_timer_thread, timer_data, 0, NULL);
3197 if (!thread)
3198 {
3199 HeapFree(GetProcessHeap(), 0, timer_data);
3200 return GetLastError();
3201 }
3203
3204 return RPC_S_OK;
3205}
static HANDLE thread
Definition: service.c:33
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer, LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext)
Definition: http.c:3469
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
static const WCHAR url[]
Definition: encode.c:1432
static int secure
Definition: server.c:138
static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc)
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 BOOL is_secure(RpcConnection_http *httpc)
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 authorize_request(RpcConnection_http *httpc, HINTERNET request)
static DWORD CALLBACK rpcrt4_http_timer_thread(PVOID param)
static BOOL has_credentials(RpcConnection_http *httpc)
static RPC_STATUS set_auth_cookie(RpcConnection_http *httpc, const WCHAR *value)
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:305
struct _RpcAssoc * assoc
Definition: rpc_binding.h:88
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define INTERNET_FLAG_PRAGMA_NOCACHE
Definition: wininet.h:85
#define INTERNET_FLAG_NO_AUTO_REDIRECT
Definition: wininet.h:73
#define INTERNET_FLAG_KEEP_CONNECTION
Definition: wininet.h:72
#define INTERNET_FLAG_NO_CACHE_WRITE
Definition: wininet.h:66
#define INTERNET_FLAG_SECURE
Definition: wininet.h:71
#define INTERNET_FLAG_NO_AUTH
Definition: wininet.h:76
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

◆ rpcrt4_ncacn_http_parse_top_of_tower()

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

Definition at line 3457 of file rpc_transport.c.

3461{
3462 return rpcrt4_ip_tcp_parse_top_of_tower(tower_data, tower_size,
3463 networkaddr, EPM_PROTOCOL_HTTP,
3464 endpoint);
3465}
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)

◆ rpcrt4_ncacn_http_read()

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

Definition at line 3213 of file rpc_transport.c.

3215{
3216 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3217 return rpcrt4_http_async_read(httpc->out_request, httpc->async_data, httpc->cancel_event, buffer, count);
3218}

Referenced by rpcrt4_ncacn_http_receive_fragment().

◆ rpcrt4_ncacn_http_receive_fragment()

static RPC_STATUS rpcrt4_ncacn_http_receive_fragment ( RpcConnection Connection,
RpcPktHdr **  Header,
void **  Payload 
)
static

Definition at line 3220 of file rpc_transport.c.

3221{
3222 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3224 DWORD hdr_length;
3225 LONG dwRead;
3226 RpcPktCommonHdr common_hdr;
3227
3228 *Header = NULL;
3229
3230 TRACE("(%p, %p, %p)\n", Connection, Header, Payload);
3231
3232again:
3233 /* read packet common header */
3234 dwRead = rpcrt4_ncacn_http_read(Connection, &common_hdr, sizeof(common_hdr));
3235 if (dwRead != sizeof(common_hdr)) {
3236 WARN("Short read of header, %d bytes\n", dwRead);
3238 goto fail;
3239 }
3240 if (!memcmp(&common_hdr, "HTTP/1.1", sizeof("HTTP/1.1")) ||
3241 !memcmp(&common_hdr, "HTTP/1.0", sizeof("HTTP/1.0")))
3242 {
3243 FIXME("server returned %s\n", debugstr_a((const char *)&common_hdr));
3245 goto fail;
3246 }
3247
3248 status = RPCRT4_ValidateCommonHeader(&common_hdr);
3249 if (status != RPC_S_OK) goto fail;
3250
3251 hdr_length = RPCRT4_GetHeaderSize((RpcPktHdr*)&common_hdr);
3252 if (hdr_length == 0) {
3253 WARN("header length == 0\n");
3255 goto fail;
3256 }
3257
3258 *Header = HeapAlloc(GetProcessHeap(), 0, hdr_length);
3259 if (!*Header)
3260 {
3262 goto fail;
3263 }
3264 memcpy(*Header, &common_hdr, sizeof(common_hdr));
3265
3266 /* read the rest of packet header */
3267 dwRead = rpcrt4_ncacn_http_read(Connection, &(*Header)->common + 1, hdr_length - sizeof(common_hdr));
3268 if (dwRead != hdr_length - sizeof(common_hdr)) {
3269 WARN("bad header length, %d bytes, hdr_length %d\n", dwRead, hdr_length);
3271 goto fail;
3272 }
3273
3274 if (common_hdr.frag_len - hdr_length)
3275 {
3276 *Payload = HeapAlloc(GetProcessHeap(), 0, common_hdr.frag_len - hdr_length);
3277 if (!*Payload)
3278 {
3280 goto fail;
3281 }
3282
3283 dwRead = rpcrt4_ncacn_http_read(Connection, *Payload, common_hdr.frag_len - hdr_length);
3284 if (dwRead != common_hdr.frag_len - hdr_length)
3285 {
3286 WARN("bad data length, %d/%d\n", dwRead, common_hdr.frag_len - hdr_length);
3288 goto fail;
3289 }
3290 }
3291 else
3292 *Payload = NULL;
3293
3294 if ((*Header)->common.ptype == PKT_HTTP)
3295 {
3296 if (!RPCRT4_IsValidHttpPacket(*Header, *Payload, common_hdr.frag_len - hdr_length))
3297 {
3298 ERR("invalid http packet of length %d bytes\n", (*Header)->common.frag_len);
3300 goto fail;
3301 }
3302 if ((*Header)->http.flags == 0x0001)
3303 {
3304 TRACE("http idle packet, waiting for real packet\n");
3305 if ((*Header)->http.num_data_items != 0)
3306 {
3307 ERR("HTTP idle packet should have no data items instead of %d\n", (*Header)->http.num_data_items);
3309 goto fail;
3310 }
3311 }
3312 else if ((*Header)->http.flags == 0x0002)
3313 {
3314 ULONG bytes_transmitted;
3315 ULONG flow_control_increment;
3316 UUID pipe_uuid;
3318 Connection->server,
3319 &bytes_transmitted,
3320 &flow_control_increment,
3321 &pipe_uuid);
3322 if (status != RPC_S_OK)
3323 goto fail;
3324 TRACE("received http flow control header (0x%x, 0x%x, %s)\n",
3325 bytes_transmitted, flow_control_increment, debugstr_guid(&pipe_uuid));
3326 /* FIXME: do something with parsed data */
3327 }
3328 else
3329 {
3330 FIXME("unrecognised http packet with flags 0x%04x\n", (*Header)->http.flags);
3332 goto fail;
3333 }
3335 *Header = NULL;
3336 HeapFree(GetProcessHeap(), 0, *Payload);
3337 *Payload = NULL;
3338 goto again;
3339 }
3340
3341 /* success */
3342 status = RPC_S_OK;
3343
3344 httpc->bytes_received += common_hdr.frag_len;
3345
3346 TRACE("httpc->bytes_received = 0x%x\n", httpc->bytes_received);
3347
3348 if (httpc->bytes_received > httpc->flow_control_mark)
3349 {
3351 httpc->bytes_received,
3353 &httpc->out_pipe_uuid);
3354 if (hdr)
3355 {
3356 DWORD bytes_written;
3357 BOOL ret2;
3358 TRACE("sending flow control packet at 0x%x\n", httpc->bytes_received);
3359 ret2 = InternetWriteFile(httpc->in_request, hdr, hdr->common.frag_len, &bytes_written);
3361 if (ret2)
3362 httpc->flow_control_mark = httpc->bytes_received + httpc->flow_control_increment / 2;
3363 }
3364 }
3365
3366fail:
3367 if (status != RPC_S_OK) {
3369 *Header = NULL;
3370 HeapFree(GetProcessHeap(), 0, *Payload);
3371 *Payload = NULL;
3372 }
3373 return status;
3374}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
Definition: Header.h:9
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr)
Definition: rpc_message.c:1255
RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header, unsigned char *data, BOOL server, ULONG *bytes_transmitted, ULONG *flow_control_increment, UUID *pipe_uuid)
Definition: rpc_message.c:637
DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header)
Definition: rpc_message.c:57
RpcPktHdr * RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG flow_control_increment, const UUID *pipe_uuid)
Definition: rpc_message.c:384
static int rpcrt4_ncacn_http_read(RpcConnection *Connection, void *buffer, unsigned int count)

◆ rpcrt4_ncacn_http_wait_for_incoming_data()

static int rpcrt4_ncacn_http_wait_for_incoming_data ( RpcConnection Connection)
static

Definition at line 3436 of file rpc_transport.c.

3437{
3438 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3439 BOOL ret;
3441
3446 return status == RPC_S_OK ? 0 : -1;
3447}
BOOL WINAPI InternetQueryDataAvailable(HINTERNET hFile, LPDWORD lpdwNumberOfBytesAvailable, DWORD dwFlags, DWORD_PTR dwContext)
Definition: internet.c:3959

◆ rpcrt4_ncacn_http_write()

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

Definition at line 3376 of file rpc_transport.c.

3378{
3379 RpcConnection_http *httpc = (RpcConnection_http *) Connection;
3380 DWORD bytes_written;
3381 BOOL ret;
3382
3383 httpc->last_sent_time = ~0U; /* disable idle packet sending */
3384 ret = InternetWriteFile(httpc->in_request, buffer, count, &bytes_written);
3385 httpc->last_sent_time = GetTickCount();
3386 TRACE("%p %p %u -> %s\n", httpc->in_request, buffer, count, ret ? "TRUE" : "FALSE");
3387 return ret ? bytes_written : -1;
3388}
#define U(x)
Definition: wordpad.c:45

◆ rpcrt4_ncacn_ip_tcp_get_top_of_tower()

static size_t rpcrt4_ncacn_ip_tcp_get_top_of_tower ( unsigned char tower_data,
const char networkaddr,
const char endpoint 
)
static

Definition at line 1819 of file rpc_transport.c.

1822{
1823 return rpcrt4_ip_tcp_get_top_of_tower(tower_data, networkaddr,
1825}
#define EPM_PROTOCOL_TCP
Definition: epm_towers.h:29

◆ rpcrt4_ncacn_ip_tcp_open()

static RPC_STATUS rpcrt4_ncacn_ip_tcp_open ( RpcConnection Connection)
static

Definition at line 1458 of file rpc_transport.c.

1459{
1460 RpcConnection_tcp *tcpc = (RpcConnection_tcp *) Connection;
1461 int sock;
1462 int ret;
1463 struct addrinfo *ai;
1464 struct addrinfo *ai_cur;
1465 struct addrinfo hints;
1466
1467 TRACE("(%s, %s)\n", Connection->NetworkAddr, Connection->Endpoint);
1468
1469 if (tcpc->sock != -1)
1470 return RPC_S_OK;
1471
1472 hints.ai_flags = 0;
1473 hints.ai_family = PF_UNSPEC;
1474 hints.ai_socktype = SOCK_STREAM;
1475 hints.ai_protocol = IPPROTO_TCP;
1476 hints.ai_addrlen = 0;
1477 hints.ai_addr = NULL;
1478 hints.ai_canonname = NULL;
1479 hints.ai_next = NULL;
1480
1481 ret = getaddrinfo(Connection->NetworkAddr, Connection->Endpoint, &hints, &ai);
1482 if (ret)
1483 {
1484 ERR("getaddrinfo for %s:%s failed: %s\n", Connection->NetworkAddr,
1485 Connection->Endpoint, gai_strerror(ret));
1487 }
1488
1489 for (ai_cur = ai; ai_cur; ai_cur = ai_cur->ai_next)
1490 {
1491 int val;
1492 u_long nonblocking;
1493
1494 if (ai_cur->ai_family != AF_INET && ai_cur->ai_family != AF_INET6)
1495 {
1496 TRACE("skipping non-IP/IPv6 address family\n");
1497 continue;
1498 }
1499
1500 if (TRACE_ON(rpc))
1501 {
1502 char host[256];
1503 char service[256];
1504 getnameinfo(ai_cur->ai_addr, ai_cur->ai_addrlen,
1505 host, sizeof(host), service, sizeof(service),
1507 TRACE("trying %s:%s\n", host, service);
1508 }
1509
1510 sock = socket(ai_cur->ai_family, ai_cur->ai_socktype, ai_cur->ai_protocol);
1511 if (sock == -1)
1512 {
1513 WARN("socket() failed: %u\n", WSAGetLastError());
1514 continue;
1515 }
1516
1517 if (0>connect(sock, ai_cur->ai_addr, ai_cur->ai_addrlen))
1518 {
1519 WARN("connect() failed: %u\n", WSAGetLastError());
1521 continue;
1522 }
1523
1524 /* RPC depends on having minimal latency so disable the Nagle algorithm */
1525 val = 1;
1526 setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&val, sizeof(val));
1527 nonblocking = 1;
1528 ioctlsocket(sock, FIONBIO, &nonblocking);
1529
1530 tcpc->sock = sock;
1531
1532 freeaddrinfo(ai);
1533 TRACE("connected\n");
1534 return RPC_S_OK;
1535 }
1536
1537 freeaddrinfo(ai);
1538 ERR("couldn't connect to %s:%s\n", Connection->NetworkAddr, Connection->Endpoint);
1540}
#define TRACE_ON(x)
Definition: compat.h:75
GLuint GLfloat * val
Definition: glext.h:7180
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
Definition: sockctrl.c:421
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
size_t ai_addrlen
Definition: ws2def.h:669
int ai_socktype
Definition: ws2def.h:667
int ai_protocol
Definition: ws2def.h:668
struct addrinfo * ai_next
Definition: ws2def.h:672
Definition: tcpcore.h:1455
#define TCP_NODELAY
Definition: tcpdef.h:117
char * host
Definition: whois.c:55
#define PF_UNSPEC
Definition: winsock.h:371
#define AF_INET6
Definition: winsock.h:369
#define NI_NUMERICSERV
Definition: ws2def.h:356

◆ rpcrt4_ncacn_ip_tcp_parse_top_of_tower()

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

Definition at line 1962 of file rpc_transport.c.

1966{
1967 return rpcrt4_ip_tcp_parse_top_of_tower(tower_data, tower_size,
1968 networkaddr, EPM_PROTOCOL_TCP,
1969 endpoint);
1970}

◆ rpcrt4_ncacn_np_get_top_of_tower()

static size_t rpcrt4_ncacn_np_get_top_of_tower ( unsigned char tower_data,
const char networkaddr,
const char endpoint 
)
static

Definition at line 793 of file rpc_transport.c.

796{
797 twr_empty_floor_t *smb_floor;
798 twr_empty_floor_t *nb_floor;
799 size_t size;
800 size_t networkaddr_size;
801 size_t endpoint_size;
802
803 TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint);
804
805 networkaddr_size = networkaddr ? strlen(networkaddr) + 1 : 1;
806 endpoint_size = endpoint ? strlen(endpoint) + 1 : 1;
807 size = sizeof(*smb_floor) + endpoint_size + sizeof(*nb_floor) + networkaddr_size;
808
809 if (!tower_data)
810 return size;
811
812 smb_floor = (twr_empty_floor_t *)tower_data;
813
814 tower_data += sizeof(*smb_floor);
815
816 smb_floor->count_lhs = sizeof(smb_floor->protid);
817 smb_floor->protid = EPM_PROTOCOL_SMB;
818 smb_floor->count_rhs = endpoint_size;
819
820 if (endpoint)
821 memcpy(tower_data, endpoint, endpoint_size);
822 else
823 tower_data[0] = 0;
824 tower_data += endpoint_size;
825
826 nb_floor = (twr_empty_floor_t *)tower_data;
827
828 tower_data += sizeof(*nb_floor);
829
830 nb_floor->count_lhs = sizeof(nb_floor->protid);
831 nb_floor->protid = EPM_PROTOCOL_NETBIOS;
832 nb_floor->count_rhs = networkaddr_size;
833
834 if (networkaddr)
835 memcpy(tower_data, networkaddr, networkaddr_size);
836 else
837 tower_data[0] = 0;
838
839 return size;
840}
#define EPM_PROTOCOL_NETBIOS
Definition: epm_towers.h:39
#define EPM_PROTOCOL_SMB
Definition: epm_towers.h:37
u_int16 count_lhs
Definition: epm_towers.h:83
u_int16 count_rhs
Definition: epm_towers.h:85

◆ rpcrt4_ncacn_np_handoff()

static RPC_STATUS rpcrt4_ncacn_np_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
static

Definition at line 617 of file rpc_transport.c.

618{
621
624
625 /* Store the local computer name as the NetworkAddr for ncacn_np as long as
626 * we don't support named pipes over the network. */
627 new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
628 if (!GetComputerNameA(new_conn->NetworkAddr, &len))
629 {
630 ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
632 }
633
634 return status;
635}
static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *conn)
static void rpcrt4_conn_np_handoff(RpcConnection_np *old_npc, RpcConnection_np *new_npc)

◆ rpcrt4_ncacn_np_is_server_listening()

static RPC_STATUS rpcrt4_ncacn_np_is_server_listening ( const char endpoint)
static

Definition at line 642 of file rpc_transport.c.

643{
644 char *pipe_name;
646
647#ifdef __REACTOS__
648 pipe_name = ncacn_pipe_name(NULL, endpoint);
649#else
650 pipe_name = ncacn_pipe_name(endpoint);
651#endif
652 status = is_pipe_listening(pipe_name);
653 I_RpcFree(pipe_name);
654 return status;
655}
static RPC_STATUS is_pipe_listening(const char *pipe_name)
static char * ncacn_pipe_name(const char *endpoint)

◆ rpcrt4_ncacn_np_open()

static RPC_STATUS rpcrt4_ncacn_np_open ( RpcConnection Connection)
static

Definition at line 550 of file rpc_transport.c.

551{
552 RpcConnection_np *npc = (RpcConnection_np *) Connection;
554 LPSTR pname;
555
556 /* already connected? */
557 if (npc->pipe)
558 return RPC_S_OK;
559
560#ifdef __REACTOS__
561 pname = ncacn_pipe_name(Connection->NetworkAddr, Connection->Endpoint);
562#else
563 pname = ncacn_pipe_name(Connection->Endpoint);
564#endif
565 r = rpcrt4_conn_open_pipe(Connection, pname, FALSE);
567
568 return r;
569}
static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname, BOOL wait)
char * LPSTR
Definition: xmlstorage.h:182

◆ rpcrt4_ncacn_np_parse_top_of_tower()

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

Definition at line 842 of file rpc_transport.c.

846{
847 const twr_empty_floor_t *smb_floor = (const twr_empty_floor_t *)tower_data;
848 const twr_empty_floor_t *nb_floor;
849
850 TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint);
851
852 if (tower_size < sizeof(*smb_floor))
854
855 tower_data += sizeof(*smb_floor);
856 tower_size -= sizeof(*smb_floor);
857
858 if ((smb_floor->count_lhs != sizeof(smb_floor->protid)) ||
859 (smb_floor->protid != EPM_PROTOCOL_SMB) ||
860 (smb_floor->count_rhs > tower_size) ||
861 (tower_data[smb_floor->count_rhs - 1] != '\0'))
863
864 if (endpoint)
865 {
866 *endpoint = I_RpcAllocate(smb_floor->count_rhs);
867 if (!*endpoint)
869 memcpy(*endpoint, tower_data, smb_floor->count_rhs);
870 }
871 tower_data += smb_floor->count_rhs;
872 tower_size -= smb_floor->count_rhs;
873
874 if (tower_size < sizeof(*nb_floor))
876
877 nb_floor = (const twr_empty_floor_t *)tower_data;
878
879 tower_data += sizeof(*nb_floor);
880 tower_size -= sizeof(*nb_floor);
881
882 if ((nb_floor->count_lhs != sizeof(nb_floor->protid)) ||
883 (nb_floor->protid != EPM_PROTOCOL_NETBIOS) ||
884 (nb_floor->count_rhs > tower_size) ||
885 (tower_data[nb_floor->count_rhs - 1] != '\0'))
887
888 if (networkaddr)
889 {
890 *networkaddr = I_RpcAllocate(nb_floor->count_rhs);
891 if (!*networkaddr)
892 {
893 if (endpoint)
894 {
896 *endpoint = NULL;
897 }
899 }
900 memcpy(*networkaddr, tower_data, nb_floor->count_rhs);
901 }
902
903 return RPC_S_OK;
904}

◆ rpcrt4_ncalrpc_authorize()

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

Definition at line 1164 of file rpc_transport.c.

1169{
1170 /* since this protocol is local to the machine there is no need to
1171 * authenticate the caller */
1172 *out_size = 0;
1173 return RPC_S_OK;
1174}
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100

◆ rpcrt4_ncalrpc_get_top_of_tower()

static size_t rpcrt4_ncalrpc_get_top_of_tower ( unsigned char tower_data,
const char networkaddr,
const char endpoint 
)
static

Definition at line 1095 of file rpc_transport.c.

1098{
1099 twr_empty_floor_t *pipe_floor;
1100 size_t size;
1101 size_t endpoint_size;
1102
1103 TRACE("(%p, %s, %s)\n", tower_data, networkaddr, endpoint);
1104
1105 endpoint_size = strlen(endpoint) + 1;
1106 size = sizeof(*pipe_floor) + endpoint_size;
1107
1108 if (!tower_data)
1109 return size;
1110
1111 pipe_floor = (twr_empty_floor_t *)tower_data;
1112
1113 tower_data += sizeof(*pipe_floor);
1114
1115 pipe_floor->count_lhs = sizeof(pipe_floor->protid);
1116 pipe_floor->protid = EPM_PROTOCOL_PIPE;
1117 pipe_floor->count_rhs = endpoint_size;
1118
1119 memcpy(tower_data, endpoint, endpoint_size);
1120
1121 return size;
1122}
#define EPM_PROTOCOL_PIPE
Definition: epm_towers.h:38

◆ rpcrt4_ncalrpc_handoff()

static RPC_STATUS rpcrt4_ncalrpc_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
static

Definition at line 668 of file rpc_transport.c.

669{
672
673 TRACE("%s\n", old_conn->Endpoint);
674
677
678 /* Store the local computer name as the NetworkAddr for ncalrpc. */
679 new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
680 if (!GetComputerNameA(new_conn->NetworkAddr, &len))
681 {
682 ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
684 }
685
686 return status;
687}

◆ rpcrt4_ncalrpc_inquire_auth_client()

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

Definition at line 1188 of file rpc_transport.c.

1191{
1192 TRACE("(%p, %p, %p, %p, %p, %p, 0x%x)\n", conn, privs,
1193 server_princ_name, authn_level, authn_svc, authz_svc, flags);
1194
1195 if (privs)
1196 {
1197 FIXME("privs not implemented\n");
1198 *privs = NULL;
1199 }
1200 if (server_princ_name)
1201 {
1202 FIXME("server_princ_name not implemented\n");
1203 *server_princ_name = NULL;
1204 }
1205 if (authn_level) *authn_level = RPC_C_AUTHN_LEVEL_PKT_PRIVACY;
1206 if (authn_svc) *authn_svc = RPC_C_AUTHN_WINNT;
1207 if (authz_svc)
1208 {
1209 FIXME("authorization service not implemented\n");
1210 *authz_svc = RPC_C_AUTHZ_NONE;
1211 }
1212 if (flags)
1213 FIXME("flags 0x%x not implemented\n", flags);
1214
1215 return RPC_S_OK;
1216}
#define RPC_C_AUTHZ_NONE
Definition: rpcdce.h:167
#define RPC_C_AUTHN_LEVEL_PKT_PRIVACY
Definition: rpcdce.h:151
#define RPC_C_AUTHN_WINNT
Definition: rpcdce.h:158

◆ rpcrt4_ncalrpc_is_authorized()

static BOOL rpcrt4_ncalrpc_is_authorized ( RpcConnection conn)
static

Definition at line 1159 of file rpc_transport.c.

1160{
1161 return FALSE;
1162}

◆ rpcrt4_ncalrpc_np_is_server_listening()

static RPC_STATUS rpcrt4_ncalrpc_np_is_server_listening ( const char endpoint)
static

Definition at line 657 of file rpc_transport.c.

658{
659 char *pipe_name;
661
662 pipe_name = ncalrpc_pipe_name(endpoint);
663 status = is_pipe_listening(pipe_name);
664 I_RpcFree(pipe_name);
665 return status;
666}
static char * ncalrpc_pipe_name(const char *endpoint)

◆ rpcrt4_ncalrpc_open()

static RPC_STATUS rpcrt4_ncalrpc_open ( RpcConnection Connection)
static

Definition at line 451 of file rpc_transport.c.

452{
453 RpcConnection_np *npc = (RpcConnection_np *) Connection;
455 LPSTR pname;
456
457 /* already connected? */
458 if (npc->pipe)
459 return RPC_S_OK;
460
461 pname = ncalrpc_pipe_name(Connection->Endpoint);
462 r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
464
465 return r;
466}

◆ rpcrt4_ncalrpc_parse_top_of_tower()

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

Definition at line 1124 of file rpc_transport.c.

1128{
1129 const twr_empty_floor_t *pipe_floor = (const twr_empty_floor_t *)tower_data;
1130
1131 TRACE("(%p, %d, %p, %p)\n", tower_data, (int)tower_size, networkaddr, endpoint);
1132
1133 if (tower_size < sizeof(*pipe_floor))
1134 return EPT_S_NOT_REGISTERED;
1135
1136 tower_data += sizeof(*pipe_floor);
1137 tower_size -= sizeof(*pipe_floor);
1138
1139 if ((pipe_floor->count_lhs != sizeof(pipe_floor->protid)) ||
1140 (pipe_floor->protid != EPM_PROTOCOL_PIPE) ||
1141 (pipe_floor->count_rhs > tower_size) ||
1142 (tower_data[pipe_floor->count_rhs - 1] != '\0'))
1143 return EPT_S_NOT_REGISTERED;
1144
1145 if (networkaddr)
1146 *networkaddr = NULL;
1147
1148 if (endpoint)
1149 {
1150 *endpoint = I_RpcAllocate(pipe_floor->count_rhs);
1151 if (!*endpoint)
1153 memcpy(*endpoint, tower_data, pipe_floor->count_rhs);
1154 }
1155
1156 return RPC_S_OK;
1157}

◆ rpcrt4_ncalrpc_secure_packet()

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

Definition at line 1176 of file rpc_transport.c.

1182{
1183 /* since this protocol is local to the machine there is no need to secure
1184 * the packet */
1185 return RPC_S_OK;
1186}

◆ RPCRT4_OpenClientConnection()

RPC_STATUS RPCRT4_OpenClientConnection ( RpcConnection Connection)

Definition at line 3610 of file rpc_transport.c.

3611{
3612 TRACE("(Connection == ^%p)\n", Connection);
3613
3614 assert(!Connection->server);
3615 return Connection->ops->open_connection_client(Connection);
3616}

Referenced by RpcAssoc_GetClientConnection().

◆ rpcrt4_protseq_ncacn_ip_tcp_open_endpoint()

static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint ( RpcServerProtseq protseq,
const char endpoint 
)
static

Definition at line 1542 of file rpc_transport.c.

1543{
1545 int sock;
1546 int ret;
1547 struct addrinfo *ai;
1548 struct addrinfo *ai_cur;
1549 struct addrinfo hints;
1550
1551 TRACE("(%p, %s)\n", protseq, endpoint);
1552
1553 hints.ai_flags = AI_PASSIVE /* for non-localhost addresses */;
1554 hints.ai_family = PF_UNSPEC;
1555 hints.ai_socktype = SOCK_STREAM;
1556 hints.ai_protocol = IPPROTO_TCP;
1557 hints.ai_addrlen = 0;
1558 hints.ai_addr = NULL;
1559 hints.ai_canonname = NULL;
1560 hints.ai_next = NULL;
1561
1562 ret = getaddrinfo(NULL, endpoint ? endpoint : "0", &hints, &ai);
1563 if (ret)
1564 {
1565 ERR("getaddrinfo for port %s failed: %s\n", endpoint,
1566 gai_strerror(ret));
1567 if ((ret == EAI_SERVICE) || (ret == EAI_NONAME))
1570 }
1571
1572 for (ai_cur = ai; ai_cur; ai_cur = ai_cur->ai_next)
1573 {
1574 RpcConnection_tcp *tcpc;
1575 RPC_STATUS create_status;
1576 struct sockaddr_storage sa;
1577 socklen_t sa_len;
1578 char service[NI_MAXSERV];
1579 u_long nonblocking;
1580
1581 if (ai_cur->ai_family != AF_INET && ai_cur->ai_family != AF_INET6)
1582 {
1583 TRACE("skipping non-IP/IPv6 address family\n");
1584 continue;
1585 }
1586
1587 if (TRACE_ON(rpc))
1588 {
1589 char host[256];
1590 getnameinfo(ai_cur->ai_addr, ai_cur->ai_addrlen,
1591 host, sizeof(host), service, sizeof(service),
1593 TRACE("trying %s:%s\n", host, service);
1594 }
1595
1596 sock = socket(ai_cur->ai_family, ai_cur->ai_socktype, ai_cur->ai_protocol);
1597 if (sock == -1)
1598 {
1599 WARN("socket() failed: %u\n", WSAGetLastError());
1601 continue;
1602 }
1603
1604 ret = bind(sock, ai_cur->ai_addr, ai_cur->ai_addrlen);
1605 if (ret < 0)
1606 {
1607 WARN("bind failed: %u\n", WSAGetLastError());
1611 else
1613 continue;
1614 }
1615
1616 sa_len = sizeof(sa);
1617 if (getsockname(sock, (struct sockaddr *)&sa, &sa_len))
1618 {
1619 WARN("getsockname() failed: %u\n", WSAGetLastError());
1622 continue;
1623 }
1624
1625 ret = getnameinfo((struct sockaddr *)&sa, sa_len,
1626 NULL, 0, service, sizeof(service),
1628 if (ret)
1629 {
1630 WARN("getnameinfo failed: %s\n", gai_strerror(ret));
1633 continue;
1634 }
1635
1636 create_status = RPCRT4_CreateConnection((RpcConnection **)&tcpc, TRUE,
1637 protseq->Protseq, NULL,
1638 service, NULL, NULL, NULL, NULL);
1639 if (create_status != RPC_S_OK)
1640 {
1642 status = create_status;
1643 continue;
1644 }
1645
1646 tcpc->sock = sock;
1647 ret = listen(sock, protseq->MaxCalls);
1648 if (ret < 0)
1649 {
1650 WARN("listen failed: %u\n", WSAGetLastError());
1653 continue;
1654 }
1655 /* need a non-blocking socket, otherwise accept() has a potential
1656 * race-condition (poll() says it is readable, connection drops,
1657 * and accept() blocks until the next connection comes...)
1658 */
1659 nonblocking = 1;
1660 ret = ioctlsocket(sock, FIONBIO, &nonblocking);
1661 if (ret < 0)
1662 {
1663 WARN("couldn't make socket non-blocking, error %d\n", ret);
1666 continue;
1667 }
1668
1669 EnterCriticalSection(&protseq->cs);
1670 list_add_tail(&protseq->listeners, &tcpc->common.protseq_entry);
1671 tcpc->common.protseq = protseq;
1672 LeaveCriticalSection(&protseq->cs);
1673
1674 freeaddrinfo(ai);
1675
1676 /* since IPv4 and IPv6 share the same port space, we only need one
1677 * successful bind to listen for both */
1678 TRACE("listening on %s\n", endpoint);
1679 return RPC_S_OK;
1680 }
1681
1682 freeaddrinfo(ai);
1683 ERR("couldn't listen on port %s\n", endpoint);
1684 return status;
1685}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth)
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
Definition: sockctrl.c:213
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
Definition: sockctrl.c:123
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
struct _RpcServerProtseq * protseq
Definition: rpc_binding.h:95
struct list listeners
Definition: rpc_server.h:36
CRITICAL_SECTION cs
Definition: rpc_server.h:38
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define RPC_S_INVALID_ENDPOINT_FORMAT
Definition: winerror.h:1017
#define WSAEADDRINUSE
Definition: winerror.h:1961
#define AI_PASSIVE
Definition: ws2def.h:293
#define NI_MAXSERV
Definition: ws2def.h:360
#define EAI_NONAME
Definition: ws2tcpip.h:38
#define EAI_SERVICE
Definition: ws2tcpip.h:39

◆ rpcrt4_protseq_ncacn_np_open_endpoint()

static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint ( RpcServerProtseq protseq,
const char endpoint 
)
static

Definition at line 571 of file rpc_transport.c.

572{
574 RpcConnection *Connection;
575 char generated_endpoint[26];
576
577 if (!endpoint)
578 {
579 static LONG np_nameless_id;
580 DWORD process_id = GetCurrentProcessId();
581 ULONG id = InterlockedExchangeAdd(&np_nameless_id, 1 );
582 snprintf(generated_endpoint, sizeof(generated_endpoint),
583 "\\\\pipe\\\\%08x.%03x", process_id, id);
584 endpoint = generated_endpoint;
585 }
586
587 r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL,
589 if (r != RPC_S_OK)
590 return r;
591
592#ifdef __REACTOS__
593 ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(NULL, Connection->Endpoint);
594#else
595 ((RpcConnection_np*)Connection)->listen_pipe = ncacn_pipe_name(Connection->Endpoint);
596#endif
597 r = rpcrt4_conn_create_pipe(Connection);
598
599 EnterCriticalSection(&protseq->cs);
600 list_add_head(&protseq->listeners, &Connection->protseq_entry);
601 Connection->protseq = protseq;
602 LeaveCriticalSection(&protseq->cs);
603
604 return r;
605}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define InterlockedExchangeAdd
Definition: interlocked.h:181
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define snprintf
Definition: wintirpc.h:48

◆ rpcrt4_protseq_ncalrpc_open_endpoint()

static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint ( RpcServerProtseq protseq,
const char endpoint 
)
static

Definition at line 468 of file rpc_transport.c.

469{
471 RpcConnection *Connection;
472 char generated_endpoint[22];
473
474 if (!endpoint)
475 {
476 static LONG lrpc_nameless_id;
477 DWORD process_id = GetCurrentProcessId();
478 ULONG id = InterlockedIncrement(&lrpc_nameless_id);
479 snprintf(generated_endpoint, sizeof(generated_endpoint),
480 "LRPC%08x.%08x", process_id, id);
481 endpoint = generated_endpoint;
482 }
483
484 r = RPCRT4_CreateConnection(&Connection, TRUE, protseq->Protseq, NULL,
486 if (r != RPC_S_OK)
487 return r;
488
489 ((RpcConnection_np*)Connection)->listen_pipe = ncalrpc_pipe_name(Connection->Endpoint);
490 r = rpcrt4_conn_create_pipe(Connection);
491
492 EnterCriticalSection(&protseq->cs);
493 list_add_head(&protseq->listeners, &Connection->protseq_entry);
494 Connection->protseq = protseq;
495 LeaveCriticalSection(&protseq->cs);
496
497 return r;
498}

◆ rpcrt4_protseq_np_alloc()

static RpcServerProtseq * rpcrt4_protseq_np_alloc ( void  )
static

Definition at line 954 of file rpc_transport.c.

955{
957 if (ps)
959 return &ps->common;
960}
RpcServerProtseq common

◆ rpcrt4_protseq_np_free_wait_array()

static void rpcrt4_protseq_np_free_wait_array ( RpcServerProtseq protseq,
void array 
)
static

Definition at line 1034 of file rpc_transport.c.

1035{
1037}

◆ rpcrt4_protseq_np_get_wait_array()

static void * rpcrt4_protseq_np_get_wait_array ( RpcServerProtseq protseq,
void prev_array,
unsigned int count 
)
static

Definition at line 968 of file rpc_transport.c.

969{
970 HANDLE *objs = prev_array;
971 RpcConnection_np *conn;
973
974 EnterCriticalSection(&protseq->cs);
975
976 /* open and count connections */
977 *count = 1;
978 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry)
979 {
980 if (!conn->pipe && rpcrt4_conn_create_pipe(&conn->common) != RPC_S_OK)
981 continue;
982 if (!conn->listen_event)
983 {
986
987 event = get_np_event(conn);
988 if (!event)
989 continue;
990
992 switch (status)
993 {
994 case STATUS_SUCCESS:
996 conn->io_status.u.Status = status;
998 break;
999 case STATUS_PENDING:
1000 break;
1001 default:
1002 ERR("pipe listen error %x\n", status);
1003 continue;
1004 }
1005
1006 conn->listen_event = event;
1007 }
1008 (*count)++;
1009 }
1010
1011 /* make array of connections */
1012 if (objs)
1013 objs = HeapReAlloc(GetProcessHeap(), 0, objs, *count*sizeof(HANDLE));
1014 else
1015 objs = HeapAlloc(GetProcessHeap(), 0, *count*sizeof(HANDLE));
1016 if (!objs)
1017 {
1018 ERR("couldn't allocate objs\n");
1019 LeaveCriticalSection(&protseq->cs);
1020 return NULL;
1021 }
1022
1023 objs[0] = npps->mgr_event;
1024 *count = 1;
1025 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry)
1026 {
1027 if (conn->listen_event)
1028 objs[(*count)++] = conn->listen_event;
1029 }
1030 LeaveCriticalSection(&protseq->cs);
1031 return objs;
1032}
#define HeapReAlloc
Definition: compat.h:734
#define FSCTL_PIPE_LISTEN
Definition: pipe.c:63
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define STATUS_PIPE_CONNECTED
Definition: ntstatus.h:414
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define STATUS_SUCCESS
Definition: shellext.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

◆ rpcrt4_protseq_np_signal_state_changed()

static void rpcrt4_protseq_np_signal_state_changed ( RpcServerProtseq protseq)
static

Definition at line 962 of file rpc_transport.c.

963{
965 SetEvent(npps->mgr_event);
966}

◆ rpcrt4_protseq_np_wait_for_new_connection()

static int rpcrt4_protseq_np_wait_for_new_connection ( RpcServerProtseq protseq,
unsigned int  count,
void wait_array 
)
static

Definition at line 1039 of file rpc_transport.c.

1040{
1041 HANDLE b_handle;
1042 HANDLE *objs = wait_array;
1043 DWORD res;
1044 RpcConnection *cconn = NULL;
1045 RpcConnection_np *conn;
1046
1047 if (!objs)
1048 return -1;
1049
1050 do
1051 {
1052 /* an alertable wait isn't strictly necessary, but due to our
1053 * overlapped I/O implementation in Wine we need to free some memory
1054 * by the file user APC being called, even if no completion routine was
1055 * specified at the time of starting the async operation */
1057 } while (res == WAIT_IO_COMPLETION);
1058
1059 if (res == WAIT_OBJECT_0)
1060 return 0;
1061 else if (res == WAIT_FAILED)
1062 {
1063 ERR("wait failed with error %d\n", GetLastError());
1064 return -1;
1065 }
1066 else
1067 {
1068 b_handle = objs[res - WAIT_OBJECT_0];
1069 /* find which connection got a RPC */
1070 EnterCriticalSection(&protseq->cs);
1071 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_np, common.protseq_entry)
1072 {
1073 if (b_handle == conn->listen_event)
1074 {
1075 release_np_event(conn, conn->listen_event);
1076 conn->listen_event = NULL;
1078 cconn = rpcrt4_spawn_connection(&conn->common);
1079 else
1080 ERR("listen failed %x\n", conn->io_status.u.Status);
1081 break;
1082 }
1083 }
1084 LeaveCriticalSection(&protseq->cs);
1085 if (!cconn)
1086 {
1087 ERR("failed to locate connection for handle %p\n", b_handle);
1088 return -1;
1089 }
1090 RPCRT4_new_client(cconn);
1091 return 1;
1092 }
1093}
GLuint res
Definition: glext.h:9613
void RPCRT4_new_client(RpcConnection *conn)
Definition: rpc_server.c:625
static RpcConnection * rpcrt4_spawn_connection(RpcConnection *old_connection)
DWORD WINAPI WaitForMultipleObjectsEx(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:169
#define WAIT_IO_COMPLETION
Definition: winbase.h:411
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define WAIT_FAILED
Definition: winbase.h:413

◆ rpcrt4_protseq_sock_alloc()

static RpcServerProtseq * rpcrt4_protseq_sock_alloc ( void  )
static

Definition at line 1833 of file rpc_transport.c.

1834{
1836 if (ps)
1837 {
1838 static BOOL wsa_inited;
1839 if (!wsa_inited)
1840 {
1841 WSADATA wsadata;
1842 WSAStartup(MAKEWORD(2, 2), &wsadata);
1843 /* Note: WSAStartup can be called more than once so we don't bother with
1844 * making accesses to wsa_inited thread-safe */
1845 wsa_inited = TRUE;
1846 }
1848 }
1849 return &ps->common;
1850}
RpcServerProtseq common

◆ rpcrt4_protseq_sock_free_wait_array()

static void rpcrt4_protseq_sock_free_wait_array ( RpcServerProtseq protseq,
void array 
)
static

Definition at line 1906 of file rpc_transport.c.

1907{
1909}

◆ rpcrt4_protseq_sock_get_wait_array()

static void * rpcrt4_protseq_sock_get_wait_array ( RpcServerProtseq protseq,
void prev_array,
unsigned int count 
)
static

Definition at line 1858 of file rpc_transport.c.

1859{
1860 HANDLE *objs = prev_array;
1861 RpcConnection_tcp *conn;
1863
1864 EnterCriticalSection(&protseq->cs);
1865
1866 /* open and count connections */
1867 *count = 1;
1868 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry)
1869 {
1870 if (conn->sock != -1)
1871 (*count)++;
1872 }
1873
1874 /* make array of connections */
1875 if (objs)
1876 objs = HeapReAlloc(GetProcessHeap(), 0, objs, *count*sizeof(HANDLE));
1877 else
1878 objs = HeapAlloc(GetProcessHeap(), 0, *count*sizeof(HANDLE));
1879 if (!objs)
1880 {
1881 ERR("couldn't allocate objs\n");
1882 LeaveCriticalSection(&protseq->cs);
1883 return NULL;
1884 }
1885
1886 objs[0] = sockps->mgr_event;
1887 *count = 1;
1888 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry)
1889 {
1890 if (conn->sock != -1)
1891 {
1892 int res = WSAEventSelect(conn->sock, conn->sock_event, FD_ACCEPT);
1893 if (res == SOCKET_ERROR)
1894 ERR("WSAEventSelect() failed with error %d\n", WSAGetLastError());
1895 else
1896 {
1897 objs[*count] = conn->sock_event;
1898 (*count)++;
1899 }
1900 }
1901 }
1902 LeaveCriticalSection(&protseq->cs);
1903 return objs;
1904}
INT WSAAPI WSAEventSelect(IN SOCKET s, IN WSAEVENT hEventObject, IN LONG lNetworkEvents)
Definition: select.c:182
#define SOCKET_ERROR
Definition: winsock.h:333
#define FD_ACCEPT
Definition: winsock.h:408

◆ rpcrt4_protseq_sock_signal_state_changed()

static void rpcrt4_protseq_sock_signal_state_changed ( RpcServerProtseq protseq)
static

Definition at line 1852 of file rpc_transport.c.

1853{
1855 SetEvent(sockps->mgr_event);
1856}

◆ rpcrt4_protseq_sock_wait_for_new_connection()

static int rpcrt4_protseq_sock_wait_for_new_connection ( RpcServerProtseq protseq,
unsigned int  count,
void wait_array 
)
static

Definition at line 1911 of file rpc_transport.c.

1912{
1913 HANDLE b_handle;
1914 HANDLE *objs = wait_array;
1915 DWORD res;
1916 RpcConnection *cconn = NULL;
1917 RpcConnection_tcp *conn;
1918
1919 if (!objs)
1920 return -1;
1921
1922 do
1923 {
1924 /* an alertable wait isn't strictly necessary, but due to our
1925 * overlapped I/O implementation in Wine we need to free some memory
1926 * by the file user APC being called, even if no completion routine was
1927 * specified at the time of starting the async operation */
1929 } while (res == WAIT_IO_COMPLETION);
1930
1931 if (res == WAIT_OBJECT_0)
1932 return 0;
1933 if (res == WAIT_FAILED)
1934 {
1935 ERR("wait failed with error %d\n", GetLastError());
1936 return -1;
1937 }
1938
1939 b_handle = objs[res - WAIT_OBJECT_0];
1940
1941 /* find which connection got a RPC */
1942 EnterCriticalSection(&protseq->cs);
1943 LIST_FOR_EACH_ENTRY(conn, &protseq->listeners, RpcConnection_tcp, common.protseq_entry)
1944 {
1945 if (b_handle == conn->sock_event)
1946 {
1947 cconn = rpcrt4_spawn_connection(&conn->common);
1948 break;
1949 }
1950 }
1951 LeaveCriticalSection(&protseq->cs);
1952 if (!cconn)
1953 {
1954 ERR("failed to locate connection for handle %p\n", b_handle);
1955 return -1;
1956 }
1957
1958 RPCRT4_new_client(cconn);
1959 return 1;
1960}

◆ RPCRT4_ReleaseConnection()

void RPCRT4_ReleaseConnection ( RpcConnection connection)

Definition at line 3717 of file rpc_transport.c.

3718{
3719 LONG ref;
3720
3721 /* protseq stores a list of active connections, but does not own references to them.
3722 * It may need to grab a connection from the list, which could lead to a race if
3723 * connection is being released, but not yet removed from the list. We handle that
3724 * by synchronizing on CS here. */
3725 if (connection->protseq)
3726 {
3727 EnterCriticalSection(&connection->protseq->cs);
3728 ref = InterlockedDecrement(&connection->ref);
3729 if (!ref)
3730 list_remove(&connection->protseq_entry);
3731 LeaveCriticalSection(&connection->protseq->cs);
3732 }
3733 else
3734 {
3735 ref = InterlockedDecrement(&connection->ref);
3736 }
3737
3738 TRACE("%p ref=%u\n", connection, ref);
3739
3740 if (!ref)
3741 {
3742 RPCRT4_CloseConnection(connection);
3743 RPCRT4_strfree(connection->Endpoint);
3744 RPCRT4_strfree(connection->NetworkAddr);
3745 HeapFree(GetProcessHeap(), 0, connection->NetworkOptions);
3746 HeapFree(GetProcessHeap(), 0, connection->CookieAuth);
3747 if (connection->AuthInfo) RpcAuthInfo_Release(connection->AuthInfo);
3748 if (connection->QOS) RpcQualityOfService_Release(connection->QOS);
3749
3750 /* server-only */
3751 if (connection->server_binding) RPCRT4_ReleaseBinding(connection->server_binding);
3752 else if (connection->assoc) RpcAssoc_ConnectionReleased(connection->assoc);
3753
3754 if (connection->wait_release) SetEvent(connection->wait_release);
3755
3756 HeapFree(GetProcessHeap(), 0, connection);
3757 }
3758}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
Definition: rpc_assoc.c:447
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1188
void RPCRT4_strfree(LPSTR src)
Definition: rpc_binding.c:104
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:254
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1365
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection)
struct _RpcBinding * server_binding
Definition: rpc_binding.h:96

Referenced by I_RpcReceive(), I_RpcSend(), RpcAssoc_GetClientConnection(), RpcAssoc_Release(), RPCRT4_CloseBinding(), rpcrt4_conn_release_and_wait(), RPCRT4_io_thread(), RPCRT4_new_client(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), and RPCRT4_worker_thread().

◆ rpcrt4_sock_wait_for_recv()

static BOOL rpcrt4_sock_wait_for_recv ( RpcConnection_tcp tcpc)
static

Definition at line 1400 of file rpc_transport.c.

1401{
1402 HANDLE wait_handles[2];
1403 DWORD res;
1405 {
1406 ERR("WSAEventSelect() failed with error %d\n", WSAGetLastError());
1407 return FALSE;
1408 }
1409 wait_handles[0] = tcpc->sock_event;
1410 wait_handles[1] = tcpc->cancel_event;
1411 res = WaitForMultipleObjects(2, wait_handles, FALSE, INFINITE);
1412 switch (res)
1413 {
1414 case WAIT_OBJECT_0:
1415 return TRUE;
1416 case WAIT_OBJECT_0 + 1:
1417 return FALSE;
1418 default:
1419 ERR("WaitForMultipleObjects() failed with error %d\n", GetLastError());
1420 return FALSE;
1421 }
1422}
DWORD WINAPI WaitForMultipleObjects(IN DWORD nCount, IN CONST HANDLE *lpHandles, IN BOOL bWaitAll, IN DWORD dwMilliseconds)
Definition: synch.c:151
#define FD_READ
Definition: winsock.h:405
#define FD_CLOSE
Definition: winsock.h:410

Referenced by rpcrt4_conn_tcp_read(), and rpcrt4_conn_tcp_wait_for_incoming_data().

◆ rpcrt4_sock_wait_for_send()

static BOOL rpcrt4_sock_wait_for_send ( RpcConnection_tcp tcpc)
static

Definition at line 1424 of file rpc_transport.c.

1425{
1426 DWORD res;
1428 {
1429 ERR("WSAEventSelect() failed with error %d\n", WSAGetLastError());
1430 return FALSE;
1431 }
1433 switch (res)
1434 {
1435 case WAIT_OBJECT_0:
1436 return TRUE;
1437 default:
1438 ERR("WaitForMultipleObjects() failed with error %d\n", GetLastError());
1439 return FALSE;
1440 }
1441}
#define FD_WRITE
Definition: winsock.h:406

Referenced by rpcrt4_conn_tcp_write().

◆ rpcrt4_sock_wait_init()

static BOOL rpcrt4_sock_wait_init ( RpcConnection_tcp tcpc)
static

Definition at line 1378 of file rpc_transport.c.

1379{
1380 static BOOL wsa_inited;
1381 if (!wsa_inited)
1382 {
1383 WSADATA wsadata;
1384 WSAStartup(MAKEWORD(2, 2), &wsadata);
1385 /* Note: WSAStartup can be called more than once so we don't bother with
1386 * making accesses to wsa_inited thread-safe */
1387 wsa_inited = TRUE;
1388 }
1391 if (!tcpc->sock_event || !tcpc->cancel_event)
1392 {
1393 ERR("event creation failed\n");
1394 if (tcpc->sock_event) CloseHandle(tcpc->sock_event);
1395 return FALSE;
1396 }
1397 return TRUE;
1398}

Referenced by rpcrt4_conn_tcp_alloc().

◆ rpcrt4_spawn_connection()

static RpcConnection * rpcrt4_spawn_connection ( RpcConnection old_connection)
static

Definition at line 3672 of file rpc_transport.c.

3673{
3674 RpcConnection *connection;
3676
3677 err = RPCRT4_CreateConnection(&connection, old_connection->server, rpcrt4_conn_get_name(old_connection),
3678 old_connection->NetworkAddr, old_connection->Endpoint, NULL,
3679 old_connection->AuthInfo, old_connection->QOS, old_connection->CookieAuth);
3680 if (err != RPC_S_OK)
3681 return NULL;
3682
3683 rpcrt4_conn_handoff(old_connection, connection);
3684 if (old_connection->protseq)
3685 {
3686 EnterCriticalSection(&old_connection->protseq->cs);
3687 connection->protseq = old_connection->protseq;
3688 list_add_tail(&old_connection->protseq->connections, &connection->protseq_entry);
3689 LeaveCriticalSection(&old_connection->protseq->cs);
3690 }
3691 return connection;
3692}
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
static RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
Definition: rpc_binding.h:215

Referenced by rpcrt4_protseq_np_wait_for_new_connection(), and rpcrt4_protseq_sock_wait_for_new_connection().

◆ RpcTransport_GetTopOfTower()

RPC_STATUS RpcTransport_GetTopOfTower ( unsigned char tower_data,
size_t tower_size,
const char protseq,
const char networkaddr,
const char endpoint 
)

Definition at line 3774 of file rpc_transport.c.

3779{
3780 twr_empty_floor_t *protocol_floor;
3782
3783 *tower_size = 0;
3784
3785 if (!protseq_ops)
3787
3788 if (!tower_data)
3789 {
3790 *tower_size = sizeof(*protocol_floor);
3791 *tower_size += protseq_ops->get_top_of_tower(NULL, networkaddr, endpoint);
3792 return RPC_S_OK;
3793 }
3794
3795 protocol_floor = (twr_empty_floor_t *)tower_data;
3796 protocol_floor->count_lhs = sizeof(protocol_floor->protid);
3797 protocol_floor->protid = protseq_ops->epm_protocols[0];
3798 protocol_floor->count_rhs = 0;
3799
3800 tower_data += sizeof(*protocol_floor);
3801
3802 *tower_size = protseq_ops->get_top_of_tower(tower_data, networkaddr, endpoint);
3803 if (!*tower_size)
3804 return EPT_S_NOT_REGISTERED;
3805
3806 *tower_size += sizeof(*protocol_floor);
3807
3808 return RPC_S_OK;
3809}

Referenced by TowerConstruct().

◆ RpcTransport_ParseTopOfTower()

RPC_STATUS RpcTransport_ParseTopOfTower ( const unsigned char tower_data,
size_t  tower_size,
char **  protseq,
char **  networkaddr,
char **  endpoint 
)

Definition at line 3811 of file rpc_transport.c.

3816{
3817 const twr_empty_floor_t *protocol_floor;
3818 const twr_empty_floor_t *floor4;
3819 const struct connection_ops *protseq_ops = NULL;
3821 unsigned int i;
3822
3823 if (tower_size < sizeof(*protocol_floor))
3824 return EPT_S_NOT_REGISTERED;
3825
3826 protocol_floor = (const twr_empty_floor_t *)tower_data;
3827 tower_data += sizeof(*protocol_floor);
3828 tower_size -= sizeof(*protocol_floor);
3829 if ((protocol_floor->count_lhs != sizeof(protocol_floor->protid)) ||
3830 (protocol_floor->count_rhs > tower_size))
3831 return EPT_S_NOT_REGISTERED;
3832 tower_data += protocol_floor->count_rhs;
3833 tower_size -= protocol_floor->count_rhs;
3834
3835 floor4 = (const twr_empty_floor_t *)tower_data;
3836 if ((tower_size < sizeof(*floor4)) ||
3837 (floor4->count_lhs != sizeof(floor4->protid)))
3838 return EPT_S_NOT_REGISTERED;
3839
3840 for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3841 if ((protocol_floor->protid == conn_protseq_list[i].epm_protocols[0]) &&
3842 (floor4->protid == conn_protseq_list[i].epm_protocols[1]))
3843 {
3845 break;
3846 }
3847
3848 if (!protseq_ops)
3849 return EPT_S_NOT_REGISTERED;
3850
3851 status = protseq_ops->parse_top_of_tower(tower_data, tower_size, networkaddr, endpoint);
3852
3853 if ((status == RPC_S_OK) && protseq)
3854 {
3855 *protseq = I_RpcAllocate(strlen(protseq_ops->name) + 1);
3856 strcpy(*protseq, protseq_ops->name);
3857 }
3858
3859 return status;
3860}
const char * name
Definition: rpc_server.h:50

Referenced by TowerExplode().

◆ send_echo_request()

static RPC_STATUS send_echo_request ( HINTERNET  req,
RpcHttpAsyncData async_data,
HANDLE  cancel_event 
)
static

Definition at line 2375 of file rpc_transport.c.

2376{
2377 BYTE buf[20];
2378 BOOL ret;
2380
2381 TRACE("sending echo request to server\n");
2382
2383 prepare_async_request(async_data);
2384 ret = HttpSendRequestW(req, NULL, 0, NULL, 0);
2385 status = wait_async_request(async_data, ret, cancel_event);
2386 if (status != RPC_S_OK) return status;
2387
2389 if (status != RPC_S_OK) return status;
2390
2391 rpcrt4_http_async_read(req, async_data, cancel_event, buf, sizeof(buf));
2392 /* FIXME: do something with retrieved data */
2393
2394 return RPC_S_OK;
2395}

Referenced by rpcrt4_http_prepare_in_pipe(), and rpcrt4_http_prepare_out_pipe().

◆ set_auth_cookie()

static RPC_STATUS set_auth_cookie ( RpcConnection_http httpc,
const WCHAR value 
)
static

Definition at line 3026 of file rpc_transport.c.

3027{
3028 static WCHAR httpW[] = {'h','t','t','p',0};
3029 static WCHAR httpsW[] = {'h','t','t','p','s',0};
3030 URL_COMPONENTSW uc;
3031 DWORD len;
3032 WCHAR *url;
3033 BOOL ret;
3034
3035 if (!value) return RPC_S_OK;
3036
3037 uc.dwStructSize = sizeof(uc);
3038 uc.lpszScheme = is_secure(httpc) ? httpsW : httpW;
3039 uc.dwSchemeLength = 0;
3040 uc.lpszHostName = httpc->servername;
3041 uc.dwHostNameLength = 0;
3042 uc.nPort = 0;
3043 uc.lpszUserName = NULL;
3044 uc.dwUserNameLength = 0;
3045 uc.lpszPassword = NULL;
3046 uc.dwPasswordLength = 0;
3047 uc.lpszUrlPath = NULL;
3048 uc.dwUrlPathLength = 0;
3049 uc.lpszExtraInfo = NULL;
3050 uc.dwExtraInfoLength = 0;
3051
3054
3055 if (!(url = HeapAlloc(GetProcessHeap(), 0, len))) return RPC_S_OUT_OF_MEMORY;
3056
3057 len = len / sizeof(WCHAR) - 1;
3058 if (!InternetCreateUrlW(&uc, 0, url, &len))
3059 {
3062 }
3063
3066 if (!ret) return RPC_S_SERVER_UNAVAILABLE;
3067
3068 return RPC_S_OK;
3069}
BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, LPWSTR lpszUrl, LPDWORD lpdwUrlLength)
Definition: internet.c:4425
static const WCHAR httpW[]
Definition: assoc.c:94
DWORD dwStructSize
Definition: wininet.h:211
DWORD dwUrlPathLength
Definition: wininet.h:223
DWORD dwExtraInfoLength
Definition: wininet.h:225
LPWSTR lpszPassword
Definition: wininet.h:220
LPWSTR lpszHostName
Definition: wininet.h:215
DWORD dwUserNameLength
Definition: wininet.h:219
DWORD dwHostNameLength
Definition: wininet.h:216
LPWSTR lpszScheme
Definition: wininet.h:212
LPWSTR lpszUserName
Definition: wininet.h:218
LPWSTR lpszUrlPath
Definition: wininet.h:222
LPWSTR lpszExtraInfo
Definition: wininet.h:224
DWORD dwPasswordLength
Definition: wininet.h:221
INTERNET_PORT nPort
Definition: wininet.h:217
DWORD dwSchemeLength
Definition: wininet.h:213
Definition: pdh_main.c:94
BOOL WINAPI InternetSetCookieW(const WCHAR *url, const WCHAR *name, const WCHAR *data)
Definition: cookie.c:1122

Referenced by rpcrt4_ncacn_http_open().

◆ wait_async_request()

static RPC_STATUS wait_async_request ( RpcHttpAsyncData async_data,
BOOL  call_ret,
HANDLE  cancel_event 
)
static

Definition at line 2015 of file rpc_transport.c.

2016{
2017 HANDLE handles[2] = { async_data->completion_event, cancel_event };
2018 DWORD res;
2019
2020 if(call_ret) {
2021 RpcHttpAsyncData_Release(async_data);
2022 return RPC_S_OK;
2023 }
2024
2026 RpcHttpAsyncData_Release(async_data);
2027 ERR("Request failed with error %d\n", GetLastError());
2029 }
2030
2032 if(res != WAIT_OBJECT_0) {
2033 TRACE("Cancelled\n");
2034 return RPC_S_CALL_CANCELLED;
2035 }
2036
2037 if(async_data->async_result) {
2038 ERR("Async request failed with error %d\n", async_data->async_result);
2040 }
2041
2042 return RPC_S_OK;
2043}
#define ERROR_IO_PENDING
Definition: dderror.h:15
#define DEFAULT_NCACN_HTTP_TIMEOUT
Definition: rpc_transport.c:57
static EFI_HANDLE * handles
Definition: uefidisk.c:62

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().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( rpc  )

Variable Documentation

◆ 

const struct { ... } auth_schemes[]
Initial value:

Referenced by auth_scheme_from_header().

◆ basicW

◆ conn_protseq_list

const struct connection_ops conn_protseq_list[]
static

Definition at line 3467 of file rpc_transport.c.

Referenced by rpcrt4_get_conn_protseq_ops(), and RpcTransport_ParseTopOfTower().

◆ digestW

const WCHAR digestW[] = {'D','i','g','e','s','t',0}
static

Definition at line 2719 of file rpc_transport.c.

◆ len

◆ negotiateW

const WCHAR negotiateW[] = {'N','e','g','o','t','i','a','t','e',0}
static

◆ ntlmW

◆ passportW

const WCHAR passportW[] = {'P','a','s','s','p','o','r','t',0}
static

Definition at line 2718 of file rpc_transport.c.

Referenced by test_passport_auth().

◆ protseq_list

const struct protseq_ops protseq_list[]
static
Initial value:
=
{
{
"ncacn_np",
},
{
"ncalrpc",
},
{
"ncacn_ip_tcp",
},
}
static void * rpcrt4_protseq_sock_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_sock_wait_for_new_connection(RpcServerProtseq *protseq, unsigned int count, void *wait_array)
static RpcServerProtseq * rpcrt4_protseq_np_alloc(void)
static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq *protseq, const char *endpoint)
static void * rpcrt4_protseq_np_get_wait_array(RpcServerProtseq *protseq, void *prev_array, unsigned int *count)
static void rpcrt4_protseq_sock_free_wait_array(RpcServerProtseq *protseq, void *array)
static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *protseq, const char *endpoint)
static int rpcrt4_protseq_np_wait_for_new_connection(RpcServerProtseq *protseq, unsigned int count, void *wait_array)
static RpcServerProtseq * rpcrt4_protseq_sock_alloc(void)
static void rpcrt4_protseq_sock_signal_state_changed(RpcServerProtseq *protseq)
static void rpcrt4_protseq_np_signal_state_changed(RpcServerProtseq *protseq)
static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protseq, const char *endpoint)

Definition at line 3559 of file rpc_transport.c.

Referenced by RpcNetworkInqProtseqsA(), RpcNetworkInqProtseqsW(), and rpcrt4_get_protseq_ops().

◆ scheme

DWORD scheme

Definition at line 2726 of file rpc_transport.c.

Referenced by ActivateThemeFile(), ApplyScheme(), BackgroundCopyJob_RemoveCredentials(), cache_authorization(), calc_url_length(), compose_request_url(), CRYPT_GetRetrieveFunction(), do_authorization(), DrawThemePreview(), encode_auth_data(), FileProtocol_StartEx(), FtpProtocol_StartEx(), generate_security_id(), get_authvalue(), get_protocol_handler(), get_scheme(), get_scheme_code(), get_scheme_string(), get_url_length(), get_zone_from_domains(), HttpProtocol_StartEx(), index_from_scheme(), InitColorButtons(), insert_authorization_header(), INTERNET_GetSchemeString(), InternetCrackUrlA(), InternetCrackUrlW_test(), InternetCreateUrlW(), is_urlmon_protocol(), LoadCurrentScheme(), LoadSchemeFromReg(), LoadSchemeFromTheme(), map_security_uri_to_zone(), MIDIMAP_LoadSettingsScheme(), MkProtocol_StartEx(), MyDrawCaptionButtons(), MyDrawCaptionTemp(), MyDrawEdge(), MyDrawFrameButton(), MyDrawFrameCaption(), MyDrawFrameControl(), MyDrawFrameScroll(), MyDrawMenuBarTemp(), MyDrawScrollbar(), MyIntDrawRectEdge(), NotConfigured(), nsProtocolHandler_AllowPort(), nsURI_GetScheme(), nsURI_SchemeIs(), nsURI_SetScheme(), OnCreate(), OnPaint(), ParseURLA(), retrieve_cached_authorization(), SchemeGetFont(), SchemeGetMetric(), SchemeSetMetric(), set_request_credentials(), CUIFObject::SetScheme(), super_navigate(), test_colors(), TIFFFindCODEC(), TIFFInitDumpMode(), TIFFIsCODECConfigured(), TIFFRegisterCODEC(), TIFFSetCompressionScheme(), UpdatePreviewTheme(), UrlGetPartW(), uses_default_port(), WinHttpCrackUrl(), WinHttpCrackUrl_test(), WinHttpCreateUrl(), WMCheckURLScheme(), and xmlBufSetAllocationScheme().

◆ str

const WCHAR* str

Definition at line 2724 of file rpc_transport.c.

Referenced by __adjust_float_buffer(), __convert_float_buffer(), __do_widen(), __insert_grouping(), __STRINGTOLD(), __wcserror(), __wcserror_s(), _atoldbl(), _bstr_(), _BSTR_CY(), _BSTR_DATE(), _BSTR_DEC(), _CDataObject_CreateInstance(), _check_ws_ignored(), _check_ws_preserved(), _cputs(), _doc_get_elems_by_name(), _dump_DIDEVCAPS(), _dwarfnametounit(), _elem_fire_event(), _enumeratorRememberedW(), _get_disp_id(), _get_elem_attr_node(), _get_elem_id(), _i64toa_s(), _i64tow_s(), _insert_adjacent_elem(), _ismbslead(), _ismbstrail(), _ItemizeInternal(), _itoa_s(), _itow_s(), _link_put_href(), _link_put_rel(), _link_put_rev(), _link_put_type(), _ltoa_s(), _ltow_s(), _mbsbtype(), _mbschr(), _mbscpy(), _mbsdec(), _mbslen(), _mbsnbcnt(), _mbsnccnt(), _mbsnextc(), _mbsninc(), _mbstrlen(), _mbtowc_l(), _parse_script_a(), _reader_name(), _reader_namespace(), _reader_prefix(), _reader_qname(), _reader_value(), _Return_type_success_(), _set_body_scroll(), _set_button_name(), _set_dispex_value(), _set_elem_language(), _set_object_name(), _set_style_filter(), _set_stylesheet_csstext(), _set_text_data(), _set_text_decoration(), _set_window_name(), _set_window_status(), _strdup(), _strerror(), _Strftime(), _strinc(), _strncnt(), _strnextc(), _strninc(), _strupr_s(), _strxspn(), _tcslen(), _tcsnlen(), _test_anchor_get_target(), _test_anchor_hash(), _test_anchor_hostname(), _test_anchor_href(), _test_anchor_name(), _test_anchor_put_href(), _test_anchor_put_name(), _test_anchor_put_rel(), _test_anchor_put_search(), _test_anchor_put_target(), _test_anchor_rel(), _test_anchor_search(), _test_attr_node_name(), _test_body_scroll(), _test_bstr_var(), _test_button_name(), _test_compatmode(), _test_current_style_filter(), _test_elem_set_innertext(), _test_event_qualifier(), _test_event_type(), _test_framebase_name(), _test_framebase_put_name(), _test_framebase_src(), _test_input_defaultValue(), _test_input_put_defaultValue(), _test_link_media(), _test_object_name(), _test_range_paste_html(), _test_range_set_end_point(), _test_script_text(), _test_style_filter(), _test_style_put_media(), _test_style_put_type(), _test_style_remove_attribute(), _test_stylesheet_csstext(), _test_text_data(), _test_text_decoration(), _text_append_data(), _tmain(), _ttoi(), _tzset(), _ui64toa_s(), _ui64tow_s(), _variantbstr_(), _vsnprintf(), _vsnwprintf_s_wrapper(), _vsnwprintf_wrapper(), _vsprintf_p_wrapper(), _vswprintf_c_l_wrapper(), _vswprintf_c_wrapper(), _vswprintf_l_wrapper(), _vswprintf_p_l_wrapper(), _vswprintf_wrapper(), _wcsdup(), _wcslwr_s(), _wcsnset(), _wcsrev(), _wcsset(), _wcsupr_s(), _wgetenv(), _wtof(), _wtoi64(), _wtoi64_l(), _wtol(), a2bstr(), a2co(), a2w(), AccPropServices_SetHmenuPropStr(), AccPropServices_SetHwndPropStr(), ActionDlg_OnBrowse(), add_bstr_property(), add_cert_to_list(), add_cert_to_view(), add_comserver_record(), add_dynamic_var(), add_ifaceps_record(), add_local_oid_text_to_control(), add_progid_record(), add_ruler_units(), add_store_certs(), add_string(), add_string_resource_to_control(), add_string_resource_with_paraformat_to_control(), add_undo_insert_run(), ATL::CPathT< StringType >::AddBackslash(), AddEntryToList(), ATL::CPathT< StringType >::AddExtension(), AddrToAddrStr(), afm_parser_read_vals(), afm_stream_read_one(), afm_stream_read_string(), alloc_bstr_arg(), alloc_str_from_narrow(), AllocStringA(), AllocStringW(), ATL::CPathT< StringType >::Append(), append_simple_quote(), append_str(), append_string(), append_string_len(), areBlanks(), areinclass(), argvtosT(), Array_unshift(), ask_confirm(), ask_overwrite_value(), asprintf(), assembly_dup_str(), AssocQueryStringA(), AssocQueryStringByKeyA(), AssocQueryStringByKeyW(), AssocQueryStringW(), ata_mode_to_str(), ata_str_to_mode(), atoiW(), atol(), atolW(), atowstr(), attr_to_eid(), auth_scheme_from_header(), AVICompressorPropertyBag_Load(), AVIFILE_LoadFile(), AVIFILE_SaveFile(), basic_tests(), CEnumMergedFolder::Begin(), bstr_from_str(), bstr_to_nsacstr(), build_ascii_request(), build_clr_surrogate_section(), build_dllredirect_section(), build_tlib_section(), build_wndclass_section(), ATL::CPathT< StringType >::BuildRoot(), Builtin_Invoke(), Pane::calc_tabbed_width(), Pane::calc_width(), ATL::CPathT< StringType >::Canonicalize(), cb(), ATL::CComVariant::CComVariant(), cert_mgr_show_cert_usages(), CertStrToNameW(), CFn_WMCommand(), CharLowerA(), CharLowerBuffA(), CharLowerBuffW(), CharUpperA(), CharUpperBuffA(), CharUpperBuffW(), check_bstr_length(), check_display_name_(), check_dropdown_(), NumPutGetTest::check_get_float(), check_jscript(), check_lnk_(), check_vertical_font(), checkeql(), chk_chr(), chop_blank(), ClassTest(), cleanup(), ClearCommandLine(), clnt_spcreateerror(), clnt_sperror(), CLRRuntimeHost_ExecuteInDefaultAppDomain(), cmdid_from_string(), co_strdupAtoW(), co_strdupW(), co_strdupWtoA(), ATL::CPathT< StringType >::Combine(), COMBOEX_FindStringExact(), COMBOEX_GetListboxText(), ATL::CPathT< StringType >::CompactPath(), ATL::CPathT< StringType >::CompactPathEx(), compare_cert_by_name_str(), compare_menu_data(), compare_query_(), compiler_alloc_bstr(), compiler_alloc_bstr_len(), compiler_alloc_string(), compiler_alloc_string_len(), CompleteFilename(), construct_function(), context_dump_fbo_attachment(), convert_bios_date(), convert_from_unicode(), convert_hex_csv_to_hex(), convert_hex_to_dword(), convert_str(), convert_str_to_blob(), convert_to_unicode(), convertHexCSVToHex(), convertHexToDWord(), convertHexToDWORDStr(), convertHexToHexCSV(), cookie_set_to_string(), create_command(), create_doc(), create_doc_with_string(), create_key(), create_lnk_(), create_match_array(), create_menu_from_data(), create_menuitem_from_data(), create_nsfile(), create_regexp(), create_registrar(), create_string(), create_system_dirid(), CRYPT_ANSIToUnicode(), CRYPT_AsnDecodeBMPString(), CRYPT_AsnDecodeIA5String(), CRYPT_AsnDecodeNameValueInternal(), CRYPT_AsnDecodeOidIgnoreTag(), CRYPT_AsnDecodeUnicodeNameValueInternal(), CRYPT_AsnDecodeUnicodeString(), CRYPT_AsnEncodeBMPString(), CRYPT_AsnEncodeIA5String(), CRYPT_AsnEncodeNumericString(), CRYPT_AsnEncodePrintableString(), CRYPT_AsnEncodeStringCoerce(), CRYPT_AsnEncodeUnicodeStringCoerce(), CRYPT_AsnEncodeUniversalString(), CRYPT_AsnEncodeUTF8String(), crypt_format_extension(), CRYPT_FormatAltNameEntry(), CRYPT_FormatAltNameInfo(), CRYPT_FormatAuthorityInfoAccess(), CRYPT_FormatAuthorityKeyId2(), CRYPT_FormatBasicConstraints2(), CRYPT_FormatBits(), CRYPT_FormatCertIssuer(), CRYPT_FormatCertSerialNumber(), CRYPT_FormatCPS(), CRYPT_FormatCRLDistPoints(), CRYPT_FormatEnhancedKeyUsage(), CRYPT_FormatHexString(), CRYPT_FormatHexStringWithPrefix(), CRYPT_FormatKeyId(), CRYPT_FormatKeyUsage(), CRYPT_FormatNetscapeCertType(), CRYPT_FormatReason(), CRYPT_FormatSpcFinancialCriteria(), CRYPT_FormatUnicodeString(), CRYPT_FormatUserNotice(), CRYPT_GetNextKeyW(), CRYPT_GetNextValueW(), CRYPT_guid2wstr(), CRYPT_QueryMessageObject(), CRYPT_UnicodeToANSI(), CryptEnumProvidersA(), CryptEnumProviderTypesA(), CryptGetDefaultProviderA(), CryptSetProviderExA(), dbgstr_w(), dde_msg_client_wndproc(), dde_server_wndproc(), debug_append(), debug_output_string(), debug_target_return_string(), debugstr_jsstr(), DECLARE_INTERFACE_(), decode_base85_guid(), decode_surrogate_pair(), decode_utf8_char(), decodeA(), decodeAndCompareBase64_A(), decodeBase64WithFmt(), decodeBase64WithLen(), decodeBase64WithLenBroken(), decodeBase64WithLenFmt(), decodeW(), XMLStorage::DecodeXMLString(), default_dbgstr_an(), default_dbgstr_wn(), DefaultBookmarkName(), ATL::CStringT< BaseType, StringTraits >::DefaultTrimChars(), deflateBound(), deflateSetDictionary(), deformat_component(), deformat_environment(), deformat_file(), deformat_index(), deformat_literal(), deformat_property(), deformat_string_internal(), delete_command(), ATL::CComBSTR::Detach(), detach_xhr_event_listener(), device_io(), DIALOG_DlgDirSelect(), BtrfsChangeDriveLetter::DlgProc(), dns_strdup_aw(), dns_strdup_uw(), dns_strdup_wa(), dns_strdup_wu(), do_attribute_tag_format(), do_attributeless_tag_format(), _Messages::do_get(), do_query(), do_reg_operation(), do_regexp_match_next(), CAutoComplete::DoBackWord(), doc_load_string(), docstr(), DoGetZipName(), double_to_string(), draw_text_2(), DrawCaptionTempA(), DrawCaptionTempW(), DrawTest(), DrawTextA(), DrawTextExA(), DrawTextExW(), DrawTextExWorker(), DrawTextW(), DrawTree(), DropPrefix(), dump_alt_name_entry(), dump_child_(), dup_formstr(), DuplicateStringA(), DuplicateStringAEx(), DuplicateStringW(), DuplicateStringWEx(), dwarfdumpsym(), EDIT_WM_Char(), EditActionDlgProc(), EditDlg_OnCommand(), EditTypeDlg_OnChangeIcon(), EditTypeDlg_OnCommand(), elf_search_auxv(), ElfrIntReportEventW(), EMFDC_ExtTextOut(), EMFDRV_ExtTextOut(), emfpathdrv_ExtTextOut(), CDeviceView::EnableSelectedDevice(), encode_base85_guid(), encodeA(), encodeAndCompareBase64_A(), encodeW(), XMLStorage::EncodeXMLString(), EndLog(), enum_compartments(), EnumPropsA(), EnumPropsExA(), EnumPropsExW(), EnumPropsW(), EnumResourceNamesA(), EnumResourceNamesW(), EnumResourceTypesA(), EnumResourceTypesW(), StringTest::erase(), err_string_prop(), Error_toString(), Escape(), escape_string(), exec_query(), Execute(), expand_environment(), expand_variables(), expand_variables_buffer(), export_string_data(), export_value_name(), CShellLink::Extract(), Extract(), FD31_DupToW(), FD31_Validate(), FD31_WMDrawItem(), FD31_WMInitDialog(), FGets(), field_format_detailed_cert_name(), field_format_detailed_extension(), field_format_extension_hex_with_ascii(), file_name(), file_nameA(), filecoll_enumvariant_Next(), filedlg_collect_places_pidls(), FileMonikerImpl_DecomposePath(), FilenameA2W(), FilenameU2A_FitOrFail(), fill_sid(), fill_window(), find_cert_by_name_str_a(), find_cert_by_name_str_w(), FindTest::find_char(), find_control(), find_entry_by_name(), find_prop(), find_top_window(), ATL::CPathT< StringType >::FindExtension(), ATL::CPathT< StringType >::FindFileName(), FindPrefixAndSuffix(), FindSubStrI(), NumPutGetTest::fix_float_long(), FmtIdToPropStgName(), foldercoll_enumvariant_Next(), FONT_GetCharsByRangeA(), FONT_mbtowc(), for(), format_insert(), format_lex(), format_message(), format_replace(), format_str_is_number(), format_string(), ATL::CStringT< BaseType, StringTraits >::FormatMessage(), FormatString(), FormatStringV(), FormatVerisignExtension(), free_stack(), free_str(), ft_mem_strdup(), Function_get_value(), Function_toString(), function_value(), get_antecedent(), get_antecedent_table(), get_attribute_value(), get_base_dir(), get_cert_mgr_usages(), get_cert_usages(), get_char_script(), get_clean_line(), get_config_key_string(), get_csidl_dir(), get_dispid(), get_doc_string(), get_document_charset(), get_elem_by_id(), get_escaped_string(), get_extrac_args(), get_file_handle(), get_file_name(), get_formstr_data(), get_item_names_string(), get_key_value(), get_ldnumber(), get_mmioFromProfile(), get_module_filename(), get_next_line(), get_nsstyle_attr_var(), get_nt_pathW(), get_olemisc_value(), get_operation(), get_predefined_entity(), get_prop(), get_properties(), get_registered_task(), get_res_nameA(), get_res_nameW(), get_settingid(), get_str_hash(), get_string_subst(), get_stringvalue(), get_text_node_data(), get_user_notice_from_qualifier(), get_windows_version_str(), get_word(), ATL::CRegObject::get_word(), GetAdvertisedArg(), CShellLink::GetAdvertiseInfo(), GetAltMonthNames(), getbyte(), GetCharABCWidthsA(), GetCharABCWidthsFloatA(), GetCharWidth32A(), GetCharWidthA(), GetCharWidthFloatA(), GetChmString(), GetDisplayName(), GetDlgItemInt(), GetDocumentTitle(), getenv(), GetFullName(), GetGeoInfoW(), GetImageName(), getline(), GetName(), GetResponse(), CQueryAssociations::GetString(), getstring_test(), Global_Asc(), Global_CStr(), Global_InvokeEx(), Global_LCase(), Global_Left(), Global_Len(), Global_LTrim(), Global_Mid(), Global_Right(), Global_RTrim(), Global_Space(), Global_Trim(), Global_UCase(), guiAsk(), guiDelta(), GUIDFromStringW(), guiDir(), guiError(), guiOut(), guiStatus(), guiStep(), guiWarning(), gzgets(), HaliMPFamily(), hash_Ly(), hash_Ly_W(), HashAddString(), heap_strdup(), heap_strdupA(), heap_strdupAtoW(), HEAP_strdupAtoW(), heap_strdupUtoW(), heap_strdupW(), heap_strdupWtoA(), heap_strdupWtoU(), heap_strdupWtoUTF8(), heap_strndupAtoW(), heap_strndupW(), heap_strndupWtoU(), hex_clr(), hexify(), History_del_current_entry(), hlink_co_strdupW(), hlink_strdupW(), HLPFILE_AddHotSpotLinks(), HLPFILE_AllocLink(), HLPFILE_RtfAddControl(), HLPFILE_RtfAddRawString(), HLPFILE_RtfAddText(), HLPFILE_SystemCommands(), HTMLDocument5_createComment(), HTMLElement2_get_readyState(), HTMLElement3_get_contentEditable(), HTMLElement3_put_contentEditable(), HTMLElement_populate_props(), HTMLFormElement_get_dispid(), HTMLFormElement_get_target(), HTMLFormElement_put_target(), HTMLFrameBase_get_marginHeight(), HTMLFrameBase_get_marginWidth(), HTMLImgElement_get_align(), HTMLImgElement_put_align(), HTMLLinkElement_get_media(), HTMLLinkElement_put_media(), HTMLSelectElement_put_name(), HTMLTable3_get_summary(), HTMLTable3_put_summary(), HTMLTable_get_frame(), HTMLTable_put_frame(), HTMLTableCell_get_align(), HTMLTableCell_put_align(), HTMLWindow2_item(), HTTP_build_req(), HTTP_ParseTime(), ICONTITLE_SetTitlePos(), id2string(), iframe_onreadystatechange(), IMLangFontLink_Test(), InfpGetSubstitutionString(), init_debug(), init_error_constr(), FstreamTest::input(), SstreamTest::input(), StringTest::insert(), InstallerImpl_ProductInfo(), interp_forin(), interp_in(), interp_str(), interp_throw_type(), SstreamTest::io(), StringTest::io(), ipaddr_ntoa(), IRecordInfoImpl_RecordCopy(), is_correct_dir(), is_drive_path(), is_drive_spec(), is_elem_name(), is_empty_string(), is_implicit_file_path(), is_interpreted_func(), is_null_bstr(), is_str_env_drive_dir(), is_string_in_list(), is_unc_path(), is_valid_name(), is_valid_ncname(), is_valid_pubid(), IsDots(), IShellBrowserImpl_ICommDlgBrowser_IncludeObject(), IsProductCode(), ITERATE_WriteRegistryValues(), ITextRange_fnGetText(), ITextRange_fnSetText(), ITextSelection_fnSetText(), ITS_IMonikerImpl_GetDisplayName(), ITSS_IEnumSTATSTG_Next(), join_find_row(), JSGlobal_decodeURI(), JSGlobal_decodeURIComponent(), JSGlobal_encodeURI(), JSGlobal_encodeURIComponent(), JSGlobal_escape(), JSGlobal_parseFloat(), JSGlobal_parseInt(), JSGlobal_unescape(), JSON_parse(), jsstr_addref(), jsstr_alloc(), jsstr_as_heap(), jsstr_as_inline(), jsstr_as_rope(), jsstr_cmp(), jsstr_cmp_str(), jsstr_extract(), jsstr_flatten(), jsstr_flush(), jsstr_free(), jsstr_init(), jsstr_is_heap(), jsstr_is_inline(), jsstr_is_rope(), jsstr_length(), jsstr_release(), jsstr_rope_extract(), jsstr_rope_flatten(), jsstr_substr(), jsstr_tag(), jsstr_try_flat(), jsval_string(), jsval_to_variant(), keyed_event_thread(), length_as_utf8(), lhash_val_of_name_sys(), LHashValOfNameSys(), LHashValOfNameSysA(), LIBXML_ATTR_FORMAT(), ListTest::list3(), LISTBOX_FindFileStrPos(), LISTBOX_FindString(), LISTBOX_FindStringPos(), LISTBOX_HandleChar(), LISTBOX_InsertItem(), LISTBOX_InsertString(), literal_as_string(), load_doc(), load_manifest(), load_persistent_cookie(), load_res(), load_string(), LogDriverInfoStream(), LogfAllocAndBuildNewRecord(), LPK_ApplyMirroring(), LPK_DrawUnderscore(), BoundTest::lwrbnd2(), MACRO_AddAccelerator(), MACRO_CheckItem(), MACRO_Compare(), MACRO_DeleteItem(), MACRO_DeleteMark(), MACRO_DestroyButton(), MACRO_DisableItem(), MACRO_EnableItem(), MACRO_ExecProgram(), MACRO_ExtAbleItem(), MACRO_FileExist(), MACRO_Generate(), MACRO_GotoMark(), MACRO_IsMark(), MACRO_IsNotMark(), MACRO_MPrintID(), MACRO_PopupContext(), MACRO_PopupHash(), MACRO_PositionWindow(), MACRO_SaveMark(), MACRO_SetContents(), MACRO_SetHelpOnFile(), MACRO_ShortCut(), MACRO_TestALink(), MACRO_TestKLink(), MACRO_UncheckItem(), main(), MAIN_MessageBoxIDS_s(), MainWndProc(), make_import_file_filter(), make_print(), make_wstr(), MakeGuidString(), ATL::CPathT< StringType >::MakePretty(), MakeStrRetFromString(), marshall_unicode_as_utf8(), Tokenizer::match(), matches_domain_pattern(), maybe_to_primitive(), mblen(), mbrlen(), mbtowc(), MCI_DumpCommandTable(), MCI_GetCommandTable(), MCI_GetString(), MCI_IsCommandTableValid(), MCI_ParseOptArgs(), MCI_SetCommandTable(), MCI_strdupAtoW(), MCIAVI_drvOpen(), MCIAVI_mciInfo(), MCIAVI_mciSet(), MCICDA_Info(), MCIQTZ_drvOpen(), MCIWndProc(), ME_CallWordBreakProc(), ME_CharFromPointContext(), ME_FindNextURLCandidate(), ME_GetTextW(), ME_HandleMessage(), ME_InsertRunAtCursor(), ME_InsertTextFromCursor(), ME_InternalInsertTextFromCursor(), ME_MakeStringConst(), ME_PointFromCharContext(), ME_ReplaceSel(), MENU_mnu2mnuii(), MENU_ParseResource(), METADC_ExtTextOut(), metadc_text(), MFDRV_ExtTextOut(), MFDRV_MetaExtTextOut(), MIDI_mciInfo(), MMDevEnum_GetDevice(), MMDevice_GetId(), move_next_char(), move_prev_char(), msi_add_string(), msi_atou(), msi_build_directory_name(), msi_create_assembly_enum(), msi_dup_property(), msi_dup_record_field(), msi_get_deformatted_field(), msi_get_property_int(), msi_load_suminfo_properties(), msi_record_to_row(), MSI_RecordCopyField(), msi_select_update(), msi_set_prop(), msi_split_string(), msi_strcpy_to_awstring(), msi_string2id(), msi_strncpyW(), msi_strncpyWtoA(), MsiDecomposeDescriptorA(), MsiSummaryInfoGetPropertyA(), MsiSummaryInfoGetPropertyW(), MsiSummaryInfoSetPropertyA(), MsiSummaryInfoSetPropertyW(), msvcrt_int_to_base32(), msvcrt_int_to_base32_w(), msvcrt_wstrdupa(), mswBufferAppendStrA(), mswBufferAppendStrW(), multi_sz_lenA(), multi_sz_lenW(), MyDrawCaptionTemp(), myStrdupFunc(), mystrrchr(), name_from_pidl(), name_value_to_str(), NativeFunction_toString(), NdisReadConfiguration(), NdisReadNetworkAddress(), NdrNonConformantStringBufferSize(), NdrNonConformantStringMarshall(), tinyxml2::XMLDocument::NewComment(), tinyxml2::XMLDocument::NewDeclaration(), tinyxml2::XMLDocument::NewText(), tinyxml2::XMLDocument::NewUnknown(), CACLCustomMRU::Next(), next_part(), NLS_GetLocaleString(), NotifyArea::Notify(), nsACString_Finish(), nsACString_GetData(), nsACString_Init(), nsACString_InitDepend(), nsACString_SetData(), nsAString_Finish(), nsAString_GetData(), nsAString_Init(), nsAString_InitDepend(), nsChannelBSC_on_response(), nsnode_to_nsstring(), nsnode_to_nsstring_rec(), nsstr_to_truncated_bstr(), nt_mailslot_test(), NtUserDrawCaptionTemp(), NumPutGetTest::num_get_float(), NumPutGetTest::num_put_float(), number_to_exponential(), number_to_fixed(), Number_toExponential(), Number_toFixed(), Number_toPrecision(), Number_toString(), Object_toString(), OleUIAddVerbMenuW(), CEditCompatModes::OnInitDialog(), OnMainCreate(), OnMenuSelect(), opatmatch(), StringTest::oper_tmp(), ATL::CStringT< BaseType, StringTraits >::operator+=(), superstring::operator/(), output_formatstring(), output_line(), OutputWorker::output_number(), OutputWorker::output_tabbed_text(), OutputWorker::output_text(), output_writeconsole(), pap_mailbox822(), pap_qstring(), para_num_get_str(), XMLStorage::XMLReaderBase::parse(), parse_add_interface_class(), parse_assembly(), parse_attr(), parse_com_class_misc(), parse_display_name(), parse_files(), parse_filetime(), parse_hhc(), parse_hhindex(), parse_identifier(), parse_json_value(), parse_key(), parse_languages(), parse_nummethods(), parse_options(), parse_path(), parse_platform(), parse_port(), parse_print(), parse_procedure(), parse_procedure_a(), parse_prop(), parse_regexp_flags(), parse_script(), parse_script_ae(), parse_script_expr(), parse_supportedos_elem(), parse_transform_desc(), parse_typelib_flags(), parse_typelib_version(), parse_uint(), parse_value(), parse_version(), partstrlwr(), PATH_ExtTextOut(), path_from_pidlA(), path_from_pidlW(), path_GetText(), patmatch(), pCDevSettings_AllocAndCopyString(), pCDevSettings_GetMonitorDevice(), pCDevSettings_GetMonitorName(), PCM_drvOpen(), pdb_load_stream_name_table(), perror(), PersistFile_Save(), PersistStreamInit_Save(), pev_get_val(), PIDGenSimpA(), PIDGenSimpW(), pool_strdup(), pp_xstrdup(), pphash(), PRINT_RECORD(), print_withspace(), PrintMessageAnsi(), PropertStorage_WriteWStringToStream(), PropStgNameToFmtId(), PropSysAllocString(), PropSysFreeString(), PROPVAR_GUIDToWSTR(), PROPVAR_WCHARToGUID(), PSM_FindLastPrefix(), PSM_PrepareToDraw(), push_instr_bstr(), push_instr_bstr_uint(), push_instr_str(), push_instr_str_uint(), push_instr_uint_str(), put_inner_html(), put_resource_id(), BtrfsContextMenu::QueryContextMenu(), queueoutstr(), ATL::CPathT< StringType >::QuoteSpaces(), range_to_string(), read_dependencies(), read_hlink_string(), read_line(), read_platform_entry(), read_properties_from_data(), read_urls(), read_version_entry(), ReadCommand(), ReadConversion(), reader_cmp(), reader_init_cstrvalue(), readerinput_strdupW(), readline(), TNetwork::ReadString(), reg_add(), reg_copy(), reg_delete(), reg_export(), reg_import(), reg_query(), regexp_execute(), RegExp_get_source(), regexp_match(), regexp_match_next(), regexp_new(), regexp_string_match(), register_resource(), REGPROC_escape_string(), REGPROC_export_string(), REGPROC_unescape_string(), REGPROC_write_line(), RegQueryCStringW(), ATL::CPathT< StringType >::RelativePathTo(), remainder_is_none_or_newline(), remove_header(), remove_quotes(), ATL::CPathT< StringType >::RemoveArgs(), ATL::CPathT< StringType >::RemoveBackslash(), ATL::CPathT< StringType >::RemoveBlanks(), ATL::CPathT< StringType >::RemoveExtension(), ATL::CPathT< StringType >::RemoveFileSpec(), RemoveQuotes(), ATL::CPathT< StringType >::RenameExtension(), rep_call(), StringTest::replace(), ReportProductInfoEvent(), res_free_str(), res_strdupW(), return_bstr(), return_nscstr(), return_nsstr(), return_string(), return_strval(), return_wstr_nsacstr(), RpcBindingSetOption(), RpcBindingToStringBindingW(), RSHELL_CStartMenu_CreateInstance(), RtlCharToInteger(), RtlGUIDFromString(), RtlIntegerToChar(), RtlUnicodeStringToInteger(), run_bom_tests(), run_domtest(), run_from_res(), run_is_entirely_ws(), run_is_splittable(), run_test(), runtimestyle_test(), s_get_a_bstr(), safestrlwr(), safestrupr(), save_cert_mgr_usages(), save_prop(), SdbMakeIndexKeyFromString(), SdbpAddStringToTable(), SdbpCreate(), section_get_dword(), SECUR32_AllocMultiByteFromWide(), SECUR32_AllocWideFromMultiByte(), SECUR32_strdupW(), seed_dirs(), SstreamTest::seek_gp(), send_file(), CHttpClient::SendFile(), serialize_string(), SERV_dup(), server_ddeml_callback(), server_end_to_end_callback(), ServiceNameToPortNumber(), TConfig::set_bool(), set_cert_string_property(), set_doc_string(), set_file_name(), set_general_cert_properties(), set_help_file_name(), set_help_string_dll(), set_prop(), set_st_entry(), set_status_text(), set_string_index(), set_stringT(), CShellLink::SetAdvertiseInfo(), TestController::SetCurrentContainer(), TestController::SetCurrentTestCategory(), TestController::SetCurrentTestName(), SetDlgItemInt(), CShellLink::SetIconLocation(), tinyxml2::StrPair::SetInternedStr(), tinyxml2::XMLElement::SetName(), CShellLink::SetPath(), tinyxml2::StrPair::SetStr(), setStringValue(), CDeviceNode::SetupNode(), SetupSetDirectoryIdA(), SetupSetDirectoryIdW(), tinyxml2::XMLNode::SetValue(), shader_arb_append_imm_vec4(), shader_arb_get_dst_param(), shader_glsl_append_imm_vec4(), shader_glsl_swizzle_to_str(), shader_glsl_write_mask_to_str(), SHELL32_GUIDToStringA(), SHELL32_GUIDToStringW(), SHGetFileInfoW(), show_store_certs(), SHSetIniStringW(), size_hlink_string(), ATL::CPathT< StringType >::SkipRoot(), SlistTest::slist1(), SLTG_DoVars(), SLTG_ReadStringA(), snprintfW(), split_multi_string_values(), sprintfW(), SQLInstall_narrow(), SQLInstall_strdup(), SQLInstall_strdup_multi(), sscanf(), stabbuf_append(), stack_find(), stack_push(), stack_push_string(), start_binding(), START_TEST(), StgSetTimes(), stop_binding(), storages_find_row(), store_user_dirid(), str_dup_upper(), str_is_number(), str_to_buffer(), str_to_color(), str_to_eid(), str_to_number(), strAtoW(), strbuf_append(), strbuf_append_jsstr(), strbuf_write(), ATL::CRegObject::strbuf_write(), strcat_param(), strchrW(), strcspnW(), StrDup(), strdup_AtoW(), strdupA(), strdupAtoW(), strdupAW(), strdupnAtoW(), strdupW(), strdupWtoA(), stream_chunk_get_wstr(), stream_init(), Stream_LoadString(), STREAM_ReadString(), Stream_WriteString(), STREAM_WriteString(), streams_find_row(), strendswith(), strfmt(), strfreeA(), strfreeU(), strfreeW(), strftime(), strftime_date(), strftime_int(), strftime_str(), strftime_time(), string2id(), string2intW(), string_alloc(), String_charAt(), String_charCodeAt(), String_concat(), STRING_evaluate(), String_indexOf(), String_lastIndexOf(), String_match(), String_replace(), String_search(), String_slice(), String_split(), String_substr(), String_substring(), string_to_nscmptype(), string_to_unit(), String_toLowerCase(), String_toUpperCase(), String_trim(), StringConstr_value(), StringFromGUID2(), StringHash(), stringify(), dbgrpt_char_traits< char >::StringLength(), dbgrpt_char_traits< wchar_t >::StringLength(), StringListAppend(), StringToColor(), StringToGuid(), strip_spaces(), ATL::CPathT< StringType >::StripPath(), ATL::CPathT< StringType >::StripToRoot(), strlen_aw(), strlenW(), strlwrW(), strpbrk(), strpbrkW(), StrRChrIW(), strrchrW(), StrRChrW(), strrstr(), strspnW(), strstr_wa(), strstrW(), strtok(), strtok_s(), struprW(), strUtoW(), strWtoA(), strWtoU(), substr(), substr_skip(), substrz(), summaryinfo_invoke(), swscanf(), SysAllocString(), SysAllocStringByteLen(), SysAllocStringLen(), SysFreeString(), SysReAllocString(), SysReAllocStringLen(), SysStringByteLen(), SysStringLen(), table_validate_new(), TableFindPtr(), taskdialog_add_static_label(), TaskManager_OnMenuSelect(), test___strncnt(), test__Gettnames(), test__mbstok(), test__strupr(), test__wcsset_s(), test_Add(), test_assembly_name_props_line(), test_atoi(), test_atoi64(), test_atol(), test_automagic(), test_BcryptHash(), test_body_style(), test_bstr_cache(), test_BstrCopy(), test_callbacks(), test_case_sensitive(), test_CertGetNameStringA(), test_CertRDNValueToStrA(), test_CertRDNValueToStrW(), test_change_types(), test_contenteditable(), test_cookies(), test_cp855(), test_cp932(), test_create(), test_create_attribute(), test_create_elems(), test_CreateAssemblyNameObject(), test_createNode(), test_CreateTextFile(), test_CreateWellKnownSid(), test_CredMarshalCredentialA(), test_crtGetStringTypeW(), test_CryptBinaryToString(), test_current_style(), test_dbcs_wm_char(), test_ddeml_client(), test_default_client_accessible_object(), test_default_selection(), test_defaults(), test_detached_font_getters(), test_directory(), test_disp(), test_dom_implementation(), test_domdoc(), test_domnode(), test_DriveCollection(), test_edit_control_3(), test_edit_control_5(), test_edit_control_6(), test_elem_dispex(), test_elems(), test_EM_GETLINE(), test_EM_GETMODIFY_esCallback(), test_EM_STREAMIN_esCallback(), test_EM_STREAMIN_esCallback2(), test_encodeUnicodeNameValue(), test_esCallback_written_1(), test_eval(), test_event(), test_ExtTextOutScale(), test_fcvt(), test_file_sharing(), test_FileCollection(), test_filename(), test_FolderCollection(), test_form_target(), test_format_object(), test_FormattingXML(), test_framebase(), test_func(), test_get_attributes(), test_get_childNodes(), test_get_firstChild(), test_get_lastChild(), test_get_nodeTypeString(), test_get_prefix(), test_get_set(), test_get_tagName(), test_get_text(), test_GetAltMonthNames(), test_getAttributeNode(), test_GetCharABCWidths(), test_getElementsByTagName(), test_GetFile(), test_GetFolder(), test_GetIconLocation(), test_getstring(), test_handles_process(), test_handles_process_open(), test_hash(), test_host(), test_hostname(), test_href(), test_iframe_connections(), test_iframe_elem(), test_imgload(), test_import_resolution(), test_InitPropVariantFromGUIDAsString(), test_invokeex(), test_isexpression(), test_ITextFont(), test_keyed_events(), test_label_elem(), test_LoadStringA(), test_location(), test_longstrings(), test_marshal_BSTR(), test_marshal_VARIANT(), test_md5(), test_menu_resource_layout(), test_merging_text(), test_mouse_keyboard(), test_msirecord(), test_mutant(), test_mxwriter_characters(), test_mxwriter_properties(), test_name_collisions(), test_name_limits(), test_namedmap_newenum(), test_namespace_pipe(), test_namespaces_as_attributes(), test_namespaces_basic(), test_namespaces_change(), test_notify(), test_NtCreateKey(), test_NtOpenKey(), test_NtQueryKey(), test_null_device(), test_object_elem(), test_OleRegGetUserType(), test_onreadystatechange(), test_parse_context(), test_ParseDisplayName(), test_ParseName(), test_paste(), test_PathAddBackslash(), test_PathCombineA(), test_pathname(), test_persiststreaminit(), Test_popen(), test_port(), test_PropVariantToStringAlloc(), test_protocol(), test_put_hash(), test_put_href(), test_put_nodeTypedValue(), test_query_object(), test_Read(), test_read_attribute(), test_read_cdata(), test_read_comment(), test_read_element(), test_read_pi(), test_read_public_dtd(), test_read_system_dtd(), test_read_text(), test_ReadAll(), test_redirection(), test_reference(), test_removeNamedItem(), test_retval(), test_RtlCharToInteger(), test_RtlCopyString(), test_RtlGUIDFromString(), test_RtlHashUnicodeString(), test_RtlInitString(), test_RtlIsNameLegalDOS8Dot3(), test_RtlStringFromGUID(), test_RtlUnicodeStringToInteger(), test_saxreader(), test_saxreader_properties(), test_saxstr(), test_schema_refs(), test_script_dispatch(), test_ScriptGetFontProperties(), test_search(), test_setAttributeNode(), test_SetText(), test_sha1(), test_sha256(), test_sha384(), test_sha512(), test_sid(), test_SQLValidDSN(), test_SQLValidDSNW(), test_start(), test_StdHlink(), test_strdup(), test_StringFromGUID2(), test_strnlen(), test_style2(), test_style3(), test_style6(), test_symboliclink(), test_SysAllocString(), test_SysAllocStringByteLen(), test_SysAllocStringLen(), test_SysReAllocString(), test_SysReAllocStringLen(), test_SysStringByteLen(), test_SysStringLen(), test_SystemFunction007(), test_td_elem(), test_textfont_global_defaults(), test_token_label(), test_undefined_byte_char(), test_user_agent(), test_VarFormatNumber(), test_Verbs(), test_vsnwprintf(), test_window(), test_WM_SETTEXT_esCallback(), test_WriteConsoleOutputCharacterA(), test_WriteConsoleOutputCharacterW(), test_wshshell(), test_wtoi(), test_wtoi64(), test_wtol(), test_xcvt(), test_xmlelem(), test_xmlelem_collection(), test_XMLHTTP(), test_xmlns_attribute(), test_xmlTypes(), test_XPath(), test_XSLPattern(), test_xsltemplate(), testJustification(), testStringToBinaryA(), TEXT_DrawUnderscore(), TEXT_Ellipsify(), TEXT_NextLineW(), TEXT_PathEllipsify(), TEXT_Reprefix(), TEXT_WordBreak(), textAsk(), textDelta(), textDir(), textOut(), textrange_set_font(), textStatus(), textStep(), CDownloadManager::ThreadFunc(), throw_error(), throw_generic_error(), throw_range_error(), throw_reference_error(), throw_regexp_error(), throw_syntax_error(), throw_type_error(), throw_uri_error(), TLB_append_str(), TLB_get_bstr(), TLB_GUIDFromString(), TLB_SanitizeBSTR(), TLB_str_memcmp(), to_array(), to_flat_string(), to_safearray(), to_string(), tinyxml2::XMLUtil::ToBool(), tinyxml2::XMLUtil::ToDouble(), tinyxml2::XMLUtil::ToFloat(), tohex(), tinyxml2::XMLUtil::ToInt(), token_to_str(), tokenize(), TOOLBAR_GetStringA(), TOOLBAR_GetStringW(), TOOLBAR_InternalInsertButtonsT(), TOOLTIPS_IsCallbackString(), tinyxml2::XMLUtil::ToUnsigned(), translate_data_def(), translate_list(), translate_macro(), translate_record(), trim(), ATL::CStringT< BaseType, StringTraits >::Trim(), ATL::CStringT< BaseType, StringTraits >::TrimLeft(), ATL::CStringT< BaseType, StringTraits >::TrimRight(), txt_clr(), txt_fputs(), unescape(), unescape_string(), UnescapeChar(), UnescapeHex(), UnescapeOther(), UnicodeString::UnicodeString(), CDeviceView::UninstallSelectedDevice(), Unquote(), unquote_string(), ATL::CPathT< StringType >::UnquoteSpaces(), update_margin_edits(), update_parent_display(), update_src_text(), BoundTest::uprbnd2(), UrlUnescapeAndMakeFileNameValid(), UuidConversionAndComparison(), anonymous_namespace{mstscax.cpp}::UUIDToString(), valisttosT(), value_get_str_field(), var2str(), variant_change_type(), variant_to_jsval(), vasprintf(), verify_str_imp2(), CFileDefExt::VersionPageProc(), VfdCheckDriverFile(), VfdFreeUnicode(), vsnprintfW(), vsprintfW(), vswprintf_wrapper(), w2a(), WAVE_mciInfo(), WAVEMAP_drvOpen(), wbem_services_ExecMethod(), wcscspn(), wcsftime(), wcspbrk(), wcsspn(), wcstod(), wcstok(), wcstok_s(), WebBrowserPriv2IE8_NavigateWithBindCtx2(), WebBrowserPriv2IE9_NavigateWithBindCtx2(), wine_compose(), wine_dbgstr_an(), wine_dbgstr_icerr(), wine_dbgstr_wn(), wine_debugstr_an(), wine_get_dos_file_name(), wined3d_adapter_init_gl_caps(), WINHELP_MessageBoxIDS_s(), WinMain(), WLDAP32_ber_printf(), WLDAP32_ber_scanf(), WMSFT_compile_names(), WMSFT_compile_strings(), word_break(), wpp_add_cmdline_define(), wrapAllowPermLayer(), write_array_tfs(), write_complex_struct_pointer_layout(), write_complex_struct_pointer_ref(), write_complex_struct_tfs(), write_file(), write_formatdesc(), write_hlink_string(), write_ip_tfs(), write_pointer_tfs(), write_progid_record(), write_simple_struct_tfs(), write_string(), write_struct_members(), write_struct_tfs(), write_type_tfs(), writer_strdupW(), writer_strndupW(), TNetwork::WriteString(), Database::WriteString(), wstrbuf_append_len(), wstrbuf_append_nodetxt(), xkeymap_from_locale(), xml_attr_cmp(), xml_elem_cmp(), xmlBufAdd(), xmlBufCat(), xmlBufCCat(), xmlDictOwns(), xmlMemoryStrdup(), xmlMemStrdupLoc(), xmlParse3986Authority(), xmlParse3986DecOctet(), xmlParse3986Fragment(), xmlParse3986HierPart(), xmlParse3986Host(), xmlParse3986PathAbEmpty(), xmlParse3986PathAbsolute(), xmlParse3986PathNoScheme(), xmlParse3986PathRootless(), xmlParse3986Port(), xmlParse3986Query(), xmlParse3986RelativeRef(), xmlParse3986Scheme(), xmlParse3986Segment(), xmlParse3986URI(), xmlParse3986URIReference(), xmlParse3986Userinfo(), xmlParseStringCharRef(), xmlParseStringEntityRef(), xmlParseStringName(), xmlParseStringPEReference(), xmlParseURI(), xmlParseURIRaw(), xmlParseURIReference(), xmlReportError(), xmlSAX2TextNode(), xmlstr_cmp(), xmlstr_cmp_end(), xmlstr_cmpi(), xmlStrcasestr(), xmlStrchr(), xmlstrdupW(), xmlStringDecodeEntities(), xmlStringLenDecodeEntities(), xmlStrlen(), xmlStrQEqual(), xmlStrstr(), xmlStrsub(), xmlURIEscape(), xmlURIEscapeStr(), xmlURIUnescapeString(), xmlValidNormalizeString(), xmlwriter_WriteCData(), xsltAttrTemplateValueProcess(), xsltAttrTemplateValueProcessNode(), xsltCompileAttr(), xsltComputeSortResultInternal(), xsltEvalAVT(), xsltGenerateIdFunction(), xsltInitCtxtKey(), xsltIsBlank(), xsltTransformError(), xsltUnparsedEntityURIFunction(), xsltXPathCompile(), xsltXPathCompileFlags(), xstrdup(), XStringToKeysym(), xstrsave(), xstrsaveA(), and xwin_process_events().