rpcrt4: Fix -Oi interpreter for base types.
Don't call memory sizing rountines to compute the size of a type, since memory sizing routines have side effects like checking there is enough space in the buffer for the type and incrementing the buffer pointer. Instead, create a function which returns the necessary size of the limited set of types we can encounter and remove call_memory_sizer which is no longer needed.
This commit is contained in:
parent
a5599028ea
commit
259ccc573c
|
@ -91,29 +91,6 @@ static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemor
|
||||||
if (m) m(pStubMsg, pMemory, pFormat);
|
if (m) m(pStubMsg, pMemory, pFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned long call_memory_sizer(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat)
|
|
||||||
{
|
|
||||||
NDR_MEMORYSIZE m = NdrMemorySizer[pFormat[0] & NDR_TABLE_MASK];
|
|
||||||
if (m)
|
|
||||||
{
|
|
||||||
unsigned char *saved_buffer = pStubMsg->Buffer;
|
|
||||||
unsigned long ret;
|
|
||||||
int saved_ignore_embedded_pointers = pStubMsg->IgnoreEmbeddedPointers;
|
|
||||||
pStubMsg->MemorySize = 0;
|
|
||||||
pStubMsg->IgnoreEmbeddedPointers = 1;
|
|
||||||
ret = m(pStubMsg, pFormat);
|
|
||||||
pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded_pointers;
|
|
||||||
pStubMsg->Buffer = saved_buffer;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FIXME("format type 0x%x not implemented\n", pFormat[0]);
|
|
||||||
RpcRaiseException(RPC_X_BAD_STUB_DATA);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define STUBLESS_UNMARSHAL 1
|
#define STUBLESS_UNMARSHAL 1
|
||||||
#define STUBLESS_INITOUT 2
|
#define STUBLESS_INITOUT 2
|
||||||
#define STUBLESS_CALLSERVER 3
|
#define STUBLESS_CALLSERVER 3
|
||||||
|
@ -426,6 +403,40 @@ static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int type_stack_size(unsigned char fc)
|
||||||
|
{
|
||||||
|
switch (fc)
|
||||||
|
{
|
||||||
|
case RPC_FC_BYTE:
|
||||||
|
case RPC_FC_CHAR:
|
||||||
|
case RPC_FC_SMALL:
|
||||||
|
case RPC_FC_USMALL:
|
||||||
|
return sizeof(char);
|
||||||
|
case RPC_FC_WCHAR:
|
||||||
|
case RPC_FC_SHORT:
|
||||||
|
case RPC_FC_USHORT:
|
||||||
|
return sizeof(short);
|
||||||
|
case RPC_FC_LONG:
|
||||||
|
case RPC_FC_ULONG:
|
||||||
|
case RPC_FC_ENUM16:
|
||||||
|
case RPC_FC_ENUM32:
|
||||||
|
return sizeof(int);
|
||||||
|
case RPC_FC_FLOAT:
|
||||||
|
return sizeof(float);
|
||||||
|
case RPC_FC_DOUBLE:
|
||||||
|
return sizeof(double);
|
||||||
|
case RPC_FC_HYPER:
|
||||||
|
return sizeof(ULONGLONG);
|
||||||
|
case RPC_FC_ERROR_STATUS_T:
|
||||||
|
return sizeof(error_status_t);
|
||||||
|
case RPC_FC_IGNORE:
|
||||||
|
return sizeof(void *);
|
||||||
|
default:
|
||||||
|
ERR("invalid base type 0x%x\n", fc);
|
||||||
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
|
static void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
PFORMAT_STRING pFormat, int phase, unsigned short stack_size,
|
PFORMAT_STRING pFormat, int phase, unsigned short stack_size,
|
||||||
unsigned char *pRetVal, BOOL object_proc)
|
unsigned char *pRetVal, BOOL object_proc)
|
||||||
|
@ -491,7 +502,7 @@ static void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg,
|
||||||
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_stack_offset += call_memory_sizer(pStubMsg, pTypeFormat);
|
current_stack_offset += type_stack_size(*pTypeFormat);
|
||||||
current_offset += sizeof(NDR_PARAM_OI_BASETYPE);
|
current_offset += sizeof(NDR_PARAM_OI_BASETYPE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1160,7 +1171,7 @@ static LONG_PTR *stub_do_old_args(MIDL_STUB_MESSAGE *pStubMsg,
|
||||||
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
RpcRaiseException(RPC_S_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_stack_offset += call_memory_sizer(pStubMsg, pTypeFormat);
|
current_stack_offset += type_stack_size(*pTypeFormat);
|
||||||
current_offset += sizeof(NDR_PARAM_OI_BASETYPE);
|
current_offset += sizeof(NDR_PARAM_OI_BASETYPE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue