Commit 8de02428 authored by Alexandre Julliard's avatar Alexandre Julliard

rpcrt4: Replace long and unsigned long by more appropriate types.

parent c001ffae
......@@ -85,7 +85,7 @@ typedef struct _NDR_PROC_HEADER_RPC
* RPCF_Asynchronous = 0x4000 - [async] MIDL attribute
* Reserved = 0x8000
*/
unsigned long rpc_flags;
unsigned int rpc_flags;
unsigned short proc_num;
unsigned short stack_size;
......
......@@ -125,7 +125,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr,
LPCSTR Endpoint, LPCWSTR NetworkOptions,
unsigned long assoc_gid,
ULONG assoc_gid,
RpcAssoc **assoc_out)
{
RpcAssoc *assoc;
......@@ -223,7 +223,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *
RPC_MESSAGE msg;
RPC_STATUS status;
unsigned char *auth_data = NULL;
unsigned long auth_length;
ULONG auth_length;
TRACE("sending bind request to server\n");
......
......@@ -50,7 +50,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endp
RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, RpcConnection **Connection);
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection);
ULONG RpcAssoc_Release(RpcAssoc *assoc);
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, unsigned long assoc_gid, RpcAssoc **assoc_out);
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out);
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext);
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext);
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine);
......
......@@ -796,7 +796,7 @@ RPC_STATUS WINAPI RpcBindingFree( RPC_BINDING_HANDLE* Binding )
RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector )
{
RPC_STATUS status;
unsigned long c;
ULONG c;
TRACE("(%p)\n", BindingVector);
for (c=0; c<(*BindingVector)->Count; c++) {
......
......@@ -31,13 +31,13 @@ typedef struct
unsigned char drep[4]; /* Data representation */
unsigned short frag_len; /* Data size in bytes including header and tail. */
unsigned short auth_len; /* Authentication length */
unsigned long call_id; /* Call identifier. */
unsigned int call_id; /* Call identifier. */
} RpcPktCommonHdr;
typedef struct
{
RpcPktCommonHdr common;
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned short opnum;
} RpcPktRequestHdr;
......@@ -45,7 +45,7 @@ typedef struct
typedef struct
{
RpcPktCommonHdr common;
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned char cancel_count;
unsigned char reserved;
......@@ -54,12 +54,12 @@ typedef struct
typedef struct
{
RpcPktCommonHdr common;
unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */
unsigned short context_id; /* Presentation context identifier */
unsigned char cancel_count; /* Received cancel count */
unsigned char reserved; /* Force alignment! */
unsigned long status; /* Runtime fault code (RPC_STATUS) */
unsigned long reserved2;
unsigned int status; /* Runtime fault code (RPC_STATUS) */
unsigned int reserved2;
} RpcPktFaultHdr;
typedef struct
......@@ -67,7 +67,7 @@ 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 int 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 */
......@@ -99,7 +99,7 @@ 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 int assoc_gid; /* Associated group id */
/*
* Following this header are these fields:
* RpcAddressString server_address;
......@@ -147,7 +147,7 @@ typedef struct
unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */
unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */
unsigned char auth_reserved; /* reserved, must be zero */
unsigned long auth_context_id; /* unique value for the authenticated connection */
unsigned int auth_context_id; /* unique value for the authenticated connection */
} RpcAuthVerifier;
#define RPC_AUTH_VERIFIER_LEN(common_hdr) \
......
......@@ -188,7 +188,7 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
UUID_VECTOR *UuidVector, RPC_CSTR Annotation )
{
PRPC_SERVER_INTERFACE If = IfSpec;
unsigned long i;
ULONG i;
RPC_STATUS status = RPC_S_OK;
error_status_t status2;
ept_entry_t *entries;
......@@ -198,12 +198,12 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (i=0; i<BindingVector->Count; i++) {
RpcBinding* bind = BindingVector->BindingH[i];
TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
}
if (UuidVector) {
for (i=0; i<UuidVector->Count; i++)
TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
}
if (!BindingVector->Count) return RPC_S_OK;
......@@ -302,7 +302,7 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
UUID_VECTOR *UuidVector )
{
PRPC_SERVER_INTERFACE If = IfSpec;
unsigned long i;
ULONG i;
RPC_STATUS status = RPC_S_OK;
error_status_t status2;
ept_entry_t *entries;
......@@ -312,12 +312,12 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin
TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID));
for (i=0; i<BindingVector->Count; i++) {
RpcBinding* bind = BindingVector->BindingH[i];
TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint));
TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq));
TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint));
}
if (UuidVector) {
for (i=0; i<UuidVector->Count; i++)
TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i]));
}
entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1));
......
......@@ -96,7 +96,7 @@ static int packet_has_auth_verifier(const RpcPktHdr *Header)
}
static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType,
unsigned long DataRepresentation)
ULONG DataRepresentation)
{
Header->common.rpc_ver = RPC_VER_MAJOR;
Header->common.rpc_ver_minor = RPC_VER_MINOR;
......@@ -111,8 +111,8 @@ static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType
/* Flags and fragment length are computed in RPCRT4_Send. */
}
static RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation,
unsigned long BufferLength,
static RpcPktHdr *RPCRT4_BuildRequestHeader(ULONG DataRepresentation,
ULONG BufferLength,
unsigned short ProcNum,
UUID *ObjectUuid)
{
......@@ -141,8 +141,7 @@ static RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation,
return header;
}
RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation,
unsigned long BufferLength)
RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength)
{
RpcPktHdr *header;
......@@ -158,8 +157,7 @@ RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation,
return header;
}
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation,
RPC_STATUS Status)
RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status)
{
RpcPktHdr *header;
......@@ -175,10 +173,10 @@ RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation,
return header;
}
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation,
RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation,
unsigned short MaxTransmissionSize,
unsigned short MaxReceiveSize,
unsigned long AssocGroupId,
ULONG AssocGroupId,
const RPC_SYNTAX_IDENTIFIER *AbstractId,
const RPC_SYNTAX_IDENTIFIER *TransferId)
{
......@@ -202,7 +200,7 @@ RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation,
return header;
}
static RpcPktHdr *RPCRT4_BuildAuthHeader(unsigned long DataRepresentation)
static RpcPktHdr *RPCRT4_BuildAuthHeader(ULONG DataRepresentation)
{
RpcPktHdr *header;
......@@ -218,7 +216,7 @@ static RpcPktHdr *RPCRT4_BuildAuthHeader(unsigned long DataRepresentation)
return header;
}
RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation,
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation,
unsigned char RpcVersion,
unsigned char RpcVersionMinor)
{
......@@ -239,17 +237,17 @@ RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation,
return header;
}
RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation,
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation,
unsigned short MaxTransmissionSize,
unsigned short MaxReceiveSize,
unsigned long AssocGroupId,
ULONG AssocGroupId,
LPCSTR ServerAddress,
unsigned long Result,
unsigned long Reason,
unsigned short Result,
unsigned short Reason,
const RPC_SYNTAX_IDENTIFIER *TransferId)
{
RpcPktHdr *header;
unsigned long header_size;
ULONG header_size;
RpcAddressString *server_address;
RpcResults *results;
RPC_SYNTAX_IDENTIFIER *transfer_id;
......@@ -283,7 +281,7 @@ RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation,
return header;
}
RpcPktHdr *RPCRT4_BuildHttpHeader(unsigned long DataRepresentation,
RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation,
unsigned short flags,
unsigned short num_data_items,
unsigned int payload_size)
......@@ -815,13 +813,14 @@ static RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Head
if (Connection->AuthInfo && packet_has_auth_verifier(Header))
{
RpcAuthVerifier *auth_hdr = (RpcAuthVerifier *)&pkt[Header->common.frag_len - alen];
static LONG next_id;
auth_hdr->auth_type = Connection->AuthInfo->AuthnSvc;
auth_hdr->auth_level = Connection->AuthInfo->AuthnLevel;
auth_hdr->auth_pad_length = auth_pad_len;
auth_hdr->auth_reserved = 0;
/* a unique number... */
auth_hdr->auth_context_id = (unsigned long)Connection;
auth_hdr->auth_context_id = InterlockedIncrement(&next_id);
if (AuthLength)
memcpy(auth_hdr + 1, Auth, AuthLength);
......@@ -1123,14 +1122,14 @@ static RPC_STATUS RPCRT4_receive_fragment(RpcConnection *Connection, RpcPktHdr *
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
PRPC_MESSAGE pMsg,
unsigned char **auth_data_out,
unsigned long *auth_length_out)
ULONG *auth_length_out)
{
RPC_STATUS status;
DWORD hdr_length;
unsigned short first_flag;
unsigned long data_length;
unsigned long buffer_length;
unsigned long auth_length = 0;
ULONG data_length;
ULONG buffer_length;
ULONG auth_length = 0;
unsigned char *auth_data = NULL;
RpcPktHdr *CurrentHeader = NULL;
void *payload = NULL;
......@@ -1194,7 +1193,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
}
if (CurrentHeader->common.auth_len != auth_length) {
WARN("auth_len header field changed from %ld to %d\n",
WARN("auth_len header field changed from %d to %d\n",
auth_length, CurrentHeader->common.auth_len);
status = RPC_S_PROTOCOL_ERROR;
goto fail;
......@@ -1208,7 +1207,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header,
data_length = CurrentHeader->common.frag_len - hdr_length - header_auth_len;
if (data_length + buffer_length > pMsg->BufferLength) {
TRACE("allocation hint exceeded, new buffer length = %ld\n",
TRACE("allocation hint exceeded, new buffer length = %d\n",
data_length + buffer_length);
pMsg->BufferLength = data_length + buffer_length;
status = I_RpcReAllocateBuffer(pMsg);
......@@ -1607,7 +1606,7 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg)
case PKT_RESPONSE:
break;
case PKT_FAULT:
ERR ("we got fault packet with status 0x%lx\n", hdr->fault.status);
ERR ("we got fault packet with status 0x%x\n", hdr->fault.status);
status = NCA2RPC_STATUS(hdr->fault.status);
if (is_hard_error(status))
goto fail;
......
......@@ -25,18 +25,18 @@
typedef unsigned int NCA_STATUS;
RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status);
RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength);
RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const 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, unsigned long AssocGroupId, LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, const RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildHttpHeader(unsigned long DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size);
RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status);
RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength);
RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor);
RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR ServerAddress, unsigned short Result, unsigned short Reason, const RPC_SYNTAX_IDENTIFIER *TransferId);
RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size);
RpcPktHdr *RPCRT4_BuildHttpConnectHeader(unsigned short flags, int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid);
RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG flow_control_increment, const UUID *pipe_uuid);
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);
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, unsigned long *auth_length_out);
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out);
DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header);
RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr);
......
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