Commit c5580b03 authored by Filip Navara's avatar Filip Navara Committed by Alexandre Julliard

Make RPCRT4 use Windows compatible protocol (DCE v5.0) for

communication.
parent d701e6de
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2001 Ove Kven, TransGaming Technologies * Copyright 2001 Ove Kven, TransGaming Technologies
* Copyright 2003 Mike Hearn * Copyright 2003 Mike Hearn
* Copyright 2004 Filip Navara
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -36,10 +37,12 @@ ...@@ -36,10 +37,12 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "rpc.h" #include "rpc.h"
#include "rpcndr.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "rpc_binding.h" #include "rpc_binding.h"
#include "rpc_message.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
...@@ -117,6 +120,7 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPST ...@@ -117,6 +120,7 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPST
NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr); NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
NewConnection->Endpoint = RPCRT4_strdupA(Endpoint); NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
NewConnection->Used = Binding; NewConnection->Used = Binding;
NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
EnterCriticalSection(&conn_cache_cs); EnterCriticalSection(&conn_cache_cs);
NewConnection->Next = conn_cache; NewConnection->Next = conn_cache;
...@@ -206,8 +210,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -206,8 +210,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint); strcat(strcpy(pname, prefix), Connection->Endpoint);
TRACE("listening on %s\n", pname); TRACE("listening on %s\n", pname);
Connection->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, Connection->conn = CreateNamedPipeA(pname, PROFILE_SERVER | PIPE_ACCESS_DUPLEX,
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL); PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
HeapFree(GetProcessHeap(), 0, pname); HeapFree(GetProcessHeap(), 0, pname);
memset(&Connection->ovl, 0, sizeof(Connection->ovl)); memset(&Connection->ovl, 0, sizeof(Connection->ovl));
Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
...@@ -216,6 +221,8 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -216,6 +221,8 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
if (GetLastError() == ERROR_PIPE_CONNECTED) { if (GetLastError() == ERROR_PIPE_CONNECTED) {
SetEvent(Connection->ovl.hEvent); SetEvent(Connection->ovl.hEvent);
return RPC_S_OK; return RPC_S_OK;
} else if (GetLastError() == ERROR_IO_PENDING) {
return RPC_S_OK;
} }
return RPC_S_SERVER_UNAVAILABLE; return RPC_S_SERVER_UNAVAILABLE;
} }
...@@ -227,8 +234,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -227,8 +234,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint); strcat(strcpy(pname, prefix), Connection->Endpoint);
TRACE("listening on %s\n", pname); TRACE("listening on %s\n", pname);
Connection->conn = CreateNamedPipeA(pname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, Connection->conn = CreateNamedPipeA(pname, PROFILE_SERVER | PIPE_ACCESS_DUPLEX,
0, PIPE_UNLIMITED_INSTANCES, 0, 0, 5000, NULL); PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE, 5000, NULL);
HeapFree(GetProcessHeap(), 0, pname); HeapFree(GetProcessHeap(), 0, pname);
memset(&Connection->ovl, 0, sizeof(Connection->ovl)); memset(&Connection->ovl, 0, sizeof(Connection->ovl));
Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
...@@ -254,6 +262,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -254,6 +262,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
LPSTR pname; LPSTR pname;
HANDLE conn; HANDLE conn;
DWORD err; DWORD err;
DWORD dwMode;
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint); strcat(strcpy(pname, prefix), Connection->Endpoint);
...@@ -261,7 +270,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -261,7 +270,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
while (TRUE) { while (TRUE) {
if (WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { if (WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL, conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); OPEN_EXISTING, 0, 0);
if (conn != INVALID_HANDLE_VALUE) break; if (conn != INVALID_HANDLE_VALUE) break;
err = GetLastError(); err = GetLastError();
if (err == ERROR_PIPE_BUSY) continue; if (err == ERROR_PIPE_BUSY) continue;
...@@ -279,6 +288,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -279,6 +288,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
/* success */ /* success */
HeapFree(GetProcessHeap(), 0, pname); HeapFree(GetProcessHeap(), 0, pname);
memset(&Connection->ovl, 0, sizeof(Connection->ovl)); memset(&Connection->ovl, 0, sizeof(Connection->ovl));
/* pipe is connected; change to message-read mode. */
dwMode = PIPE_READMODE_MESSAGE;
SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
Connection->conn = conn; Connection->conn = conn;
} }
...@@ -288,12 +300,13 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -288,12 +300,13 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
LPSTR pname; LPSTR pname;
HANDLE conn; HANDLE conn;
DWORD err; DWORD err;
DWORD dwMode;
pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint); strcat(strcpy(pname, prefix), Connection->Endpoint);
TRACE("connecting to %s\n", pname); TRACE("connecting to %s\n", pname);
conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL, conn = CreateFileA(pname, GENERIC_READ|GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); OPEN_EXISTING, 0, 0);
if (conn == INVALID_HANDLE_VALUE) { if (conn == INVALID_HANDLE_VALUE) {
err = GetLastError(); err = GetLastError();
/* we don't need to handle ERROR_PIPE_BUSY here, /* we don't need to handle ERROR_PIPE_BUSY here,
...@@ -309,6 +322,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) ...@@ -309,6 +322,9 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection)
/* success */ /* success */
HeapFree(GetProcessHeap(), 0, pname); HeapFree(GetProcessHeap(), 0, pname);
memset(&Connection->ovl, 0, sizeof(Connection->ovl)); memset(&Connection->ovl, 0, sizeof(Connection->ovl));
/* pipe is connected; change to message-read mode. */
dwMode = PIPE_READMODE_MESSAGE;
SetNamedPipeHandleState(conn, &dwMode, NULL, NULL);
Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL); Connection->ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
Connection->conn = conn; Connection->conn = conn;
} else { } else {
...@@ -484,18 +500,100 @@ RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding) ...@@ -484,18 +500,100 @@ RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding)
return RPC_S_OK; return RPC_S_OK;
} }
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection) RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
PRPC_SYNTAX_IDENTIFIER TransferSyntax,
PRPC_SYNTAX_IDENTIFIER InterfaceId)
{ {
RpcConnection* NewConnection; RpcConnection* NewConnection;
RPC_STATUS status;
TRACE("(Binding == ^%p)\n", Binding); TRACE("(Binding == ^%p)\n", Binding);
if (Binding->FromConn) {
*Connection = Binding->FromConn;
return RPC_S_OK;
}
/* if we try to bind a new interface and the connection is already opened,
* close the current connection and create a new with the new binding. */
if (!Binding->server && Binding->FromConn &&
memcmp(&Binding->FromConn->ActiveInterface, InterfaceId,
sizeof(RPC_SYNTAX_IDENTIFIER))) {
RPCRT4_ReleaseConnection(Binding->FromConn);
Binding->FromConn = NULL;
} else {
/* we already have an connection with acceptable binding, so use it */
if (Binding->FromConn) {
*Connection = Binding->FromConn;
return RPC_S_OK;
}
}
/* create a new connection */
RPCRT4_GetConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, Binding->Endpoint, NULL, Binding); RPCRT4_GetConnection(&NewConnection, Binding->server, Binding->Protseq, Binding->NetworkAddr, Binding->Endpoint, NULL, Binding);
*Connection = NewConnection; *Connection = NewConnection;
return RPCRT4_OpenConnection(NewConnection); status = RPCRT4_OpenConnection(NewConnection);
if (status != RPC_S_OK) {
return status;
}
/* we need to send a binding packet if we are client. */
if (!(*Connection)->server) {
RpcPktHdr *hdr;
DWORD count;
BYTE *response;
RpcPktHdr *response_hdr;
TRACE("sending bind request to server\n");
hdr = RPCRT4_BuildBindHeader(NDR_LOCAL_DATA_REPRESENTATION,
RPC_MAX_PACKET_SIZE, RPC_MAX_PACKET_SIZE,
InterfaceId, TransferSyntax);
status = RPCRT4_Send(*Connection, hdr, NULL, 0);
if (status != RPC_S_OK) {
RPCRT4_ReleaseConnection(*Connection);
return status;
}
response = HeapAlloc(GetProcessHeap(), 0, RPC_MAX_PACKET_SIZE);
if (response == NULL) {
WARN("Can't allocate memory for binding response\n");
RPCRT4_ReleaseConnection(*Connection);
return E_OUTOFMEMORY;
}
/* get a reply */
if (!ReadFile(NewConnection->conn, response, RPC_MAX_PACKET_SIZE, &count, NULL)) {
WARN("ReadFile failed with error %ld\n", GetLastError());
RPCRT4_ReleaseConnection(*Connection);
return RPC_S_PROTOCOL_ERROR;
}
if (count < sizeof(response_hdr->common)) {
WARN("received invalid header\n");
RPCRT4_ReleaseConnection(*Connection);
return RPC_S_PROTOCOL_ERROR;
}
response_hdr = (RpcPktHdr*)response;
if (response_hdr->common.rpc_ver != RPC_VER_MAJOR ||
response_hdr->common.rpc_ver_minor != RPC_VER_MINOR ||
response_hdr->common.ptype != PKT_BIND_ACK) {
WARN("invalid protocol version or rejection packet\n");
RPCRT4_ReleaseConnection(Binding->FromConn);
return RPC_S_PROTOCOL_ERROR;
}
if (response_hdr->bind_ack.max_tsize < RPC_MIN_PACKET_SIZE) {
WARN("server doesn't allow large enough packets\n");
RPCRT4_ReleaseConnection(Binding->FromConn);
return RPC_S_PROTOCOL_ERROR;
}
/* FIXME: do more checks? */
(*Connection)->MaxTransmissionSize = response_hdr->bind_ack.max_tsize;
(*Connection)->ActiveInterface = *InterfaceId;
}
return RPC_S_OK;
} }
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection) RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection)
......
...@@ -33,6 +33,9 @@ typedef struct _RpcConnection ...@@ -33,6 +33,9 @@ typedef struct _RpcConnection
LPSTR Endpoint; LPSTR Endpoint;
HANDLE conn, thread; HANDLE conn, thread;
OVERLAPPED ovl; OVERLAPPED ovl;
USHORT MaxTransmissionSize;
/* The active interface bound to server. */
RPC_SYNTAX_IDENTIFIER ActiveInterface;
} RpcConnection; } RpcConnection;
/* don't know what MS's structure looks like */ /* don't know what MS's structure looks like */
...@@ -42,7 +45,6 @@ typedef struct _RpcBinding ...@@ -42,7 +45,6 @@ typedef struct _RpcBinding
struct _RpcBinding* Next; struct _RpcBinding* Next;
BOOL server; BOOL server;
UUID ObjectUuid; UUID ObjectUuid;
UUID ActiveUuid;
LPSTR Protseq; LPSTR Protseq;
LPSTR NetworkAddr; LPSTR NetworkAddr;
LPSTR Endpoint; LPSTR Endpoint;
...@@ -75,7 +77,7 @@ RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid); ...@@ -75,7 +77,7 @@ RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid);
RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection); RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding); RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding);
RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding); RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding);
RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection); RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, PRPC_SYNTAX_IDENTIFIER TransferSyntax, PRPC_SYNTAX_IDENTIFIER InterfaceId);
RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection); RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply); BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply);
HANDLE RPCRT4_GetMasterMutex(void); HANDLE RPCRT4_GetMasterMutex(void);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* RPC definitions * RPC definitions
* *
* Copyright 2001-2002 Ove Kven, TransGaming Technologies * Copyright 2001-2002 Ove Kven, TransGaming Technologies
* Copyright 2004 Filip Navara
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -25,27 +26,124 @@ ...@@ -25,27 +26,124 @@
typedef struct typedef struct
{ {
unsigned char rpc_ver; unsigned char rpc_ver; /* RPC major version (5) */
unsigned char ptype; unsigned char rpc_ver_minor; /* RPC minor version (0) */
unsigned char flags1; unsigned char ptype; /* Packet type (PKT_*) */
unsigned char flags2; unsigned char flags;
unsigned char drep[3]; unsigned char drep[4]; /* Data representation */
unsigned char serial_hi; unsigned short frag_len; /* Data size in bytes including header and tail. */
GUID object; unsigned short auth_len; /* Authentication length */
GUID if_id; unsigned long call_id; /* Call identifier. */
GUID act_id; } RpcPktCommonHdr;
unsigned long server_boot;
unsigned long if_vers; typedef struct
unsigned long seqnum; {
RpcPktCommonHdr common;
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned short opnum; unsigned short opnum;
unsigned short ihint; } RpcPktRequestHdr;
unsigned short ahint;
unsigned short len; typedef struct
unsigned short fragnum; {
unsigned char auth_proto; RpcPktCommonHdr common;
unsigned char serial_lo; unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned char cancel_count;
unsigned char reserved;
} RpcPktResponseHdr;
typedef struct
{
RpcPktCommonHdr common;
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned char alert_count; /* Pending alert count */
unsigned char padding[3]; /* Force alignment! */
unsigned long status; /* Runtime fault code (RPC_STATUS) */
unsigned long reserved;
} RpcPktFaultHdr;
typedef struct
{
RpcPktCommonHdr common;
unsigned short max_tsize; /* Maximum transmission fragment size */
unsigned short max_rsize; /* Maximum receive fragment size */
unsigned long assoc_gid; /* Associated group id */
unsigned char num_elements; /* Number of elements */
unsigned char padding[3]; /* Force alignment! */
unsigned short context_id; /* Presentation context identifier */
unsigned char num_syntaxes; /* Number of syntaxes */
RPC_SYNTAX_IDENTIFIER abstract;
RPC_SYNTAX_IDENTIFIER transfer;
} RpcPktBindHdr;
#include "pshpack1.h"
typedef struct
{
unsigned short length; /* Length of the string including null terminator */
char string[1]; /* String data in single byte, null terminated form */
} RpcAddressString;
#include "poppack.h"
typedef struct
{
unsigned char padding1[2]; /* Force alignment! */
unsigned char num_results; /* Number of results */
unsigned char padding2[3]; /* Force alignment! */
struct {
unsigned short result;
unsigned short reason;
} results[1];
} RpcResults;
typedef struct
{
RpcPktCommonHdr common;
unsigned short max_tsize; /* Maximum transmission fragment size */
unsigned short max_rsize; /* Maximum receive fragment size */
unsigned long assoc_gid; /* Associated group id */
/*
* Following this header are these fields:
* RpcAddressString server_address;
* RpcResults results;
* RPC_SYNTAX_IDENTIFIER transfer;
*/
} RpcPktBindAckHdr;
typedef struct
{
RpcPktCommonHdr common;
unsigned short reject_reason;
unsigned char protocols_count;
struct {
unsigned char rpc_ver;
unsigned char rpc_ver_minor;
} protocols[1];
} RpcPktBindNAckHdr;
/* Union representing all possible packet headers */
typedef union
{
RpcPktCommonHdr common;
RpcPktRequestHdr request;
RpcPktResponseHdr response;
RpcPktFaultHdr fault;
RpcPktBindHdr bind;
RpcPktBindAckHdr bind_ack;
RpcPktBindNAckHdr bind_nack;
} RpcPktHdr; } RpcPktHdr;
#define RPC_VER_MAJOR 5
#define RPC_VER_MINOR 0
#define RPC_FLG_FIRST 1
#define RPC_FLG_LAST 2
#define RPC_FLG_OBJECT_UUID 0x80
#define RPC_MIN_PACKET_SIZE 0x1000
#define RPC_MAX_PACKET_SIZE 0x16D0
#define PKT_REQUEST 0 #define PKT_REQUEST 0
#define PKT_PING 1 #define PKT_PING 1
#define PKT_RESPONSE 2 #define PKT_RESPONSE 2
...@@ -59,13 +157,17 @@ typedef struct ...@@ -59,13 +157,17 @@ typedef struct
#define PKT_CANCEL_ACK 10 #define PKT_CANCEL_ACK 10
#define PKT_BIND 11 #define PKT_BIND 11
#define PKT_BIND_ACK 12 #define PKT_BIND_ACK 12
#define PKT_BIND_NAK 13 #define PKT_BIND_NACK 13
#define PKT_ALTER_CONTEXT 14 #define PKT_ALTER_CONTEXT 14
#define PKT_ALTER_CONTEXT_RESP 15 #define PKT_ALTER_CONTEXT_RESP 15
#define PKT_SHUTDOWN 17 #define PKT_SHUTDOWN 17
#define PKT_CO_CANCEL 18 #define PKT_CO_CANCEL 18
#define PKT_ORPHANED 19 #define PKT_ORPHANED 19
#define RESULT_ACCEPT 0
#define NO_REASON 0
#define NCADG_IP_UDP 0x08 #define NCADG_IP_UDP 0x08
#define NCACN_IP_TCP 0x07 #define NCACN_IP_TCP 0x07
#define NCADG_IPX 0x0E #define NCADG_IPX 0x0E
......
/*
* RPC message API
*
* Copyright 2004 Filip Navara
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_RPC_MESSAGE_H
#define __WINE_RPC_MESSAGE_H
#include "wine/rpcss_shared.h"
#include "rpc_defs.h"
VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType, unsigned long DataRepresentation);
RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation, unsigned long BufferLength, unsigned short ProcNum, UUID *ObjectUuid);
RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength);
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, RPC_SYNTAX_IDENTIFIER *AbstractId, RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, LPSTR ServerAddress, unsigned long Result, unsigned long Reason, RPC_SYNTAX_IDENTIFIER *TransferId);
VOID RPCRT4_FreeHeader(RpcPktHdr *Header);
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength);
RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment