Commit 02236f06 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Fix and unify parsing of calling conventions.

Hack handling of 'struct { } *NDR_SCONTEXT;' so we don't cause a parse error as this is a valid C construct. Generate type tests for rpcrt4. Remove PRPC_BINDING_VECTOR and PUUID_VECTOR, they don't exist on Windows. Fix the MIDL_STUB_MESSAGE, MIDL_SERVER_INFO and MIDL_STUBLESS_PROXY_INFO structs. Add NDR_ALLOC_ALL_NODES_CONTEXT, NDR_POINTER_QUEUE_STATE and CS_STUB_INFO.
parent 4d73e10c
......@@ -178,7 +178,7 @@ void WINAPI NdrClientInitializeNew( PRPC_MESSAGE pRpcMessage, PMIDL_STUB_MESSAGE
memset(pRpcMessage, 0, sizeof(RPC_MESSAGE));
/* not everyone allocates stack space for w2kReserved */
memset(pStubMsg, 0, sizeof(*pStubMsg) - sizeof(pStubMsg->w2kReserved));
memset(pStubMsg, 0, FIELD_OFFSET(MIDL_STUB_MESSAGE,pCSInfo));
pStubMsg->ReuseBuffer = FALSE;
pStubMsg->IsClient = TRUE;
......@@ -202,7 +202,7 @@ unsigned char* WINAPI NdrServerInitializeNew( PRPC_MESSAGE pRpcMsg, PMIDL_STUB_M
assert( pRpcMsg && pStubMsg && pStubDesc );
/* not everyone allocates stack space for w2kReserved */
memset(pStubMsg, 0, sizeof(*pStubMsg) - sizeof(pStubMsg->w2kReserved));
memset(pStubMsg, 0, FIELD_OFFSET(MIDL_STUB_MESSAGE,pCSInfo));
pStubMsg->ReuseBuffer = TRUE;
pStubMsg->IsClient = FALSE;
......
Makefile
generated.ok
rpc.ok
testlist.c
......@@ -6,6 +6,7 @@ TESTDLL = rpcrt4.dll
IMPORTS = rpcrt4
CTESTS = \
generated.c \
rpc.c
@MAKE_TEST_RULES@
......
/* File generated automatically from tools/winapi/test.dat; do not edit! */
/* This file can be copied, modified and distributed without restriction. */
/*
* Unit tests for data structure packing
*/
#define WINVER 0x0501
#define _WIN32_IE 0x0501
#define _WIN32_WINNT 0x0501
#define WINE_NOWINSOCK
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "rpc.h"
#include "rpcndr.h"
#include "rpcproxy.h"
#include "wine/test.h"
/***********************************************************************
* Compability macros
*/
#define DWORD_PTR UINT_PTR
#define LONG_PTR INT_PTR
#define ULONG_PTR UINT_PTR
/***********************************************************************
* Windows API extension
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
# define FIELD_ALIGNMENT(type, field) __alignof(((type*)0)->field)
#elif defined(__GNUC__)
# define FIELD_ALIGNMENT(type, field) __alignof__(((type*)0)->field)
#else
/* FIXME: Not sure if is possible to do without compiler extension */
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
# define _TYPE_ALIGNMENT(type) __alignof(type)
#elif defined(__GNUC__)
# define _TYPE_ALIGNMENT(type) __alignof__(type)
#else
/*
* FIXME: Not sure if is possible to do without compiler extension
* (if type is not just a name that is, if so the normal)
* TYPE_ALIGNMENT can be used)
*/
#endif
#if defined(TYPE_ALIGNMENT) && defined(_MSC_VER) && _MSC_VER >= 800 && !defined(__cplusplus)
#pragma warning(disable:4116)
#endif
#if !defined(TYPE_ALIGNMENT) && defined(_TYPE_ALIGNMENT)
# define TYPE_ALIGNMENT _TYPE_ALIGNMENT
#endif
/***********************************************************************
* Test helper macros
*/
#ifdef FIELD_ALIGNMENT
# define TEST_FIELD_ALIGNMENT(type, field, align) \
ok(FIELD_ALIGNMENT(type, field) == align, \
"FIELD_ALIGNMENT(" #type ", " #field ") == %d (expected " #align ")\n", \
FIELD_ALIGNMENT(type, field))
#else
# define TEST_FIELD_ALIGNMENT(type, field, align) do { } while (0)
#endif
#define TEST_FIELD_OFFSET(type, field, offset) \
ok(FIELD_OFFSET(type, field) == offset, \
"FIELD_OFFSET(" #type ", " #field ") == %ld (expected " #offset ")\n", \
FIELD_OFFSET(type, field))
#ifdef _TYPE_ALIGNMENT
#define TEST__TYPE_ALIGNMENT(type, align) \
ok(_TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", _TYPE_ALIGNMENT(type))
#else
# define TEST__TYPE_ALIGNMENT(type, align) do { } while (0)
#endif
#ifdef TYPE_ALIGNMENT
#define TEST_TYPE_ALIGNMENT(type, align) \
ok(TYPE_ALIGNMENT(type) == align, "TYPE_ALIGNMENT(" #type ") == %d (expected " #align ")\n", TYPE_ALIGNMENT(type))
#else
# define TEST_TYPE_ALIGNMENT(type, align) do { } while (0)
#endif
#define TEST_TYPE_SIZE(type, size) \
ok(sizeof(type) == size, "sizeof(" #type ") == %d (expected " #size ")\n", sizeof(type))
/***********************************************************************
* Test macros
*/
#define TEST_FIELD(type, field_type, field_name, field_offset, field_size, field_align) \
TEST_TYPE_SIZE(field_type, field_size); \
TEST_FIELD_ALIGNMENT(type, field_name, field_align); \
TEST_FIELD_OFFSET(type, field_name, field_offset); \
#define TEST_TYPE(type, size, align) \
TEST_TYPE_ALIGNMENT(type, align); \
TEST_TYPE_SIZE(type, size)
#define TEST_TYPE_POINTER(type, size, align) \
TEST__TYPE_ALIGNMENT(*(type)0, align); \
TEST_TYPE_SIZE(*(type)0, size)
#define TEST_TYPE_SIGNED(type) \
ok((type) -1 < 0, "(" #type ") -1 < 0\n");
#define TEST_TYPE_UNSIGNED(type) \
ok((type) -1 > 0, "(" #type ") -1 > 0\n");
static void test_pack_I_RPC_HANDLE(void)
{
/* I_RPC_HANDLE */
TEST_TYPE(I_RPC_HANDLE, 4, 4);
}
static void test_pack_RPC_STATUS(void)
{
/* RPC_STATUS */
TEST_TYPE(RPC_STATUS, 4, 4);
TEST_TYPE_SIGNED(RPC_STATUS);
}
static void test_pack_PRPC_POLICY(void)
{
/* PRPC_POLICY */
TEST_TYPE(PRPC_POLICY, 4, 4);
TEST_TYPE_POINTER(PRPC_POLICY, 12, 4);
}
static void test_pack_RPC_AUTH_IDENTITY_HANDLE(void)
{
/* RPC_AUTH_IDENTITY_HANDLE */
TEST_TYPE(RPC_AUTH_IDENTITY_HANDLE, 4, 4);
}
static void test_pack_RPC_AUTH_KEY_RETRIEVAL_FN(void)
{
/* RPC_AUTH_KEY_RETRIEVAL_FN */
}
static void test_pack_RPC_AUTHZ_HANDLE(void)
{
/* RPC_AUTHZ_HANDLE */
TEST_TYPE(RPC_AUTHZ_HANDLE, 4, 4);
}
static void test_pack_RPC_BINDING_HANDLE(void)
{
/* RPC_BINDING_HANDLE */
TEST_TYPE(RPC_BINDING_HANDLE, 4, 4);
}
static void test_pack_RPC_BINDING_VECTOR(void)
{
/* RPC_BINDING_VECTOR (pack 4) */
TEST_TYPE(RPC_BINDING_VECTOR, 8, 4);
TEST_FIELD(RPC_BINDING_VECTOR, unsigned long, Count, 0, 4, 4);
TEST_FIELD(RPC_BINDING_VECTOR, RPC_BINDING_HANDLE[1], BindingH, 4, 4, 4);
}
static void test_pack_RPC_IF_HANDLE(void)
{
/* RPC_IF_HANDLE */
TEST_TYPE(RPC_IF_HANDLE, 4, 4);
}
static void test_pack_RPC_IF_ID(void)
{
/* RPC_IF_ID (pack 4) */
}
static void test_pack_RPC_POLICY(void)
{
/* RPC_POLICY (pack 4) */
TEST_TYPE(RPC_POLICY, 12, 4);
TEST_FIELD(RPC_POLICY, unsigned int, Length, 0, 4, 4);
TEST_FIELD(RPC_POLICY, unsigned long, EndpointFlags, 4, 4, 4);
TEST_FIELD(RPC_POLICY, unsigned long, NICFlags, 8, 4, 4);
}
static void test_pack_UUID_VECTOR(void)
{
/* UUID_VECTOR (pack 4) */
TEST_TYPE(UUID_VECTOR, 8, 4);
TEST_FIELD(UUID_VECTOR, unsigned long, Count, 0, 4, 4);
TEST_FIELD(UUID_VECTOR, UUID *[1], Uuid, 4, 4, 4);
}
static void test_pack_PRPC_CLIENT_INTERFACE(void)
{
/* PRPC_CLIENT_INTERFACE */
TEST_TYPE(PRPC_CLIENT_INTERFACE, 4, 4);
}
static void test_pack_PRPC_DISPATCH_TABLE(void)
{
/* PRPC_DISPATCH_TABLE */
TEST_TYPE(PRPC_DISPATCH_TABLE, 4, 4);
TEST_TYPE_POINTER(PRPC_DISPATCH_TABLE, 12, 4);
}
static void test_pack_PRPC_MESSAGE(void)
{
/* PRPC_MESSAGE */
TEST_TYPE(PRPC_MESSAGE, 4, 4);
TEST_TYPE_POINTER(PRPC_MESSAGE, 44, 4);
}
static void test_pack_PRPC_PROTSEQ_ENDPOINT(void)
{
/* PRPC_PROTSEQ_ENDPOINT */
TEST_TYPE(PRPC_PROTSEQ_ENDPOINT, 4, 4);
TEST_TYPE_POINTER(PRPC_PROTSEQ_ENDPOINT, 8, 4);
}
static void test_pack_PRPC_SERVER_INTERFACE(void)
{
/* PRPC_SERVER_INTERFACE */
TEST_TYPE(PRPC_SERVER_INTERFACE, 4, 4);
}
static void test_pack_PRPC_SYNTAX_IDENTIFIER(void)
{
/* PRPC_SYNTAX_IDENTIFIER */
TEST_TYPE(PRPC_SYNTAX_IDENTIFIER, 4, 4);
TEST_TYPE_POINTER(PRPC_SYNTAX_IDENTIFIER, 20, 4);
}
static void test_pack_RPC_CLIENT_INTERFACE(void)
{
/* RPC_CLIENT_INTERFACE (pack 4) */
TEST_FIELD(RPC_CLIENT_INTERFACE, unsigned int, Length, 0, 4, 4);
}
static void test_pack_RPC_DISPATCH_FUNCTION(void)
{
/* RPC_DISPATCH_FUNCTION */
}
static void test_pack_RPC_DISPATCH_TABLE(void)
{
/* RPC_DISPATCH_TABLE (pack 4) */
TEST_TYPE(RPC_DISPATCH_TABLE, 12, 4);
TEST_FIELD(RPC_DISPATCH_TABLE, unsigned int, DispatchTableCount, 0, 4, 4);
TEST_FIELD(RPC_DISPATCH_TABLE, RPC_DISPATCH_FUNCTION*, DispatchTable, 4, 4, 4);
TEST_FIELD(RPC_DISPATCH_TABLE, LONG_PTR, Reserved, 8, 4, 4);
}
static void test_pack_RPC_MESSAGE(void)
{
/* RPC_MESSAGE (pack 4) */
TEST_TYPE(RPC_MESSAGE, 44, 4);
TEST_FIELD(RPC_MESSAGE, RPC_BINDING_HANDLE, Handle, 0, 4, 4);
TEST_FIELD(RPC_MESSAGE, unsigned long, DataRepresentation, 4, 4, 4);
TEST_FIELD(RPC_MESSAGE, void*, Buffer, 8, 4, 4);
TEST_FIELD(RPC_MESSAGE, unsigned int, BufferLength, 12, 4, 4);
TEST_FIELD(RPC_MESSAGE, unsigned int, ProcNum, 16, 4, 4);
TEST_FIELD(RPC_MESSAGE, PRPC_SYNTAX_IDENTIFIER, TransferSyntax, 20, 4, 4);
TEST_FIELD(RPC_MESSAGE, void*, RpcInterfaceInformation, 24, 4, 4);
TEST_FIELD(RPC_MESSAGE, void*, ReservedForRuntime, 28, 4, 4);
TEST_FIELD(RPC_MESSAGE, RPC_MGR_EPV*, ManagerEpv, 32, 4, 4);
TEST_FIELD(RPC_MESSAGE, void*, ImportContext, 36, 4, 4);
TEST_FIELD(RPC_MESSAGE, unsigned long, RpcFlags, 40, 4, 4);
}
static void test_pack_RPC_PROTSEQ_ENDPOINT(void)
{
/* RPC_PROTSEQ_ENDPOINT (pack 4) */
TEST_TYPE(RPC_PROTSEQ_ENDPOINT, 8, 4);
TEST_FIELD(RPC_PROTSEQ_ENDPOINT, unsigned char*, RpcProtocolSequence, 0, 4, 4);
TEST_FIELD(RPC_PROTSEQ_ENDPOINT, unsigned char*, Endpoint, 4, 4, 4);
}
static void test_pack_RPC_SERVER_INTERFACE(void)
{
/* RPC_SERVER_INTERFACE (pack 4) */
TEST_FIELD(RPC_SERVER_INTERFACE, unsigned int, Length, 0, 4, 4);
}
static void test_pack_RPC_SYNTAX_IDENTIFIER(void)
{
/* RPC_SYNTAX_IDENTIFIER (pack 4) */
TEST_TYPE(RPC_SYNTAX_IDENTIFIER, 20, 4);
TEST_FIELD(RPC_SYNTAX_IDENTIFIER, GUID, SyntaxGUID, 0, 16, 4);
TEST_FIELD(RPC_SYNTAX_IDENTIFIER, RPC_VERSION, SyntaxVersion, 16, 4, 2);
}
static void test_pack_RPC_VERSION(void)
{
/* RPC_VERSION (pack 4) */
TEST_TYPE(RPC_VERSION, 4, 2);
TEST_FIELD(RPC_VERSION, unsigned short, MajorVersion, 0, 2, 2);
TEST_FIELD(RPC_VERSION, unsigned short, MinorVersion, 2, 2, 2);
}
static void test_pack_ARRAY_INFO(void)
{
/* ARRAY_INFO (pack 4) */
TEST_TYPE(ARRAY_INFO, 24, 4);
TEST_FIELD(ARRAY_INFO, long, Dimension, 0, 4, 4);
TEST_FIELD(ARRAY_INFO, unsigned long *, BufferConformanceMark, 4, 4, 4);
TEST_FIELD(ARRAY_INFO, unsigned long *, BufferVarianceMark, 8, 4, 4);
TEST_FIELD(ARRAY_INFO, unsigned long *, MaxCountArray, 12, 4, 4);
TEST_FIELD(ARRAY_INFO, unsigned long *, OffsetArray, 16, 4, 4);
TEST_FIELD(ARRAY_INFO, unsigned long *, ActualCountArray, 20, 4, 4);
}
static void test_pack_COMM_FAULT_OFFSETS(void)
{
/* COMM_FAULT_OFFSETS (pack 4) */
TEST_TYPE(COMM_FAULT_OFFSETS, 4, 2);
TEST_FIELD(COMM_FAULT_OFFSETS, short, CommOffset, 0, 2, 2);
TEST_FIELD(COMM_FAULT_OFFSETS, short, FaultOffset, 2, 2, 2);
}
static void test_pack_CS_STUB_INFO(void)
{
/* CS_STUB_INFO (pack 4) */
TEST_TYPE(CS_STUB_INFO, 12, 4);
TEST_FIELD(CS_STUB_INFO, unsigned long, WireCodeset, 0, 4, 4);
TEST_FIELD(CS_STUB_INFO, unsigned long, DesiredReceivingCodeset, 4, 4, 4);
TEST_FIELD(CS_STUB_INFO, void *, CSArrayInfo, 8, 4, 4);
}
static void test_pack_EXPR_EVAL(void)
{
/* EXPR_EVAL */
}
static void test_pack_FULL_PTR_TO_REFID_ELEMENT(void)
{
/* FULL_PTR_TO_REFID_ELEMENT (pack 4) */
TEST_TYPE(FULL_PTR_TO_REFID_ELEMENT, 16, 4);
TEST_FIELD(FULL_PTR_TO_REFID_ELEMENT, struct _FULL_PTR_TO_REFID_ELEMENT *, Next, 0, 4, 4);
TEST_FIELD(FULL_PTR_TO_REFID_ELEMENT, void *, Pointer, 4, 4, 4);
TEST_FIELD(FULL_PTR_TO_REFID_ELEMENT, unsigned long, RefId, 8, 4, 4);
TEST_FIELD(FULL_PTR_TO_REFID_ELEMENT, unsigned char, State, 12, 1, 1);
}
static void test_pack_FULL_PTR_XLAT_TABLES(void)
{
/* FULL_PTR_XLAT_TABLES (pack 4) */
}
static void test_pack_GENERIC_BINDING_INFO(void)
{
/* GENERIC_BINDING_INFO */
}
static void test_pack_GENERIC_BINDING_ROUTINE_PAIR(void)
{
/* GENERIC_BINDING_ROUTINE_PAIR */
}
static void test_pack_MALLOC_FREE_STRUCT(void)
{
/* MALLOC_FREE_STRUCT (pack 4) */
}
static void test_pack_MIDL_FORMAT_STRING(void)
{
/* MIDL_FORMAT_STRING (pack 4) */
TEST_FIELD(MIDL_FORMAT_STRING, short, Pad, 0, 2, 2);
}
static void test_pack_MIDL_SERVER_INFO(void)
{
/* MIDL_SERVER_INFO (pack 4) */
TEST_TYPE(MIDL_SERVER_INFO, 32, 4);
TEST_FIELD(MIDL_SERVER_INFO, PMIDL_STUB_DESC, pStubDesc, 0, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, SERVER_ROUTINE *, DispatchTable, 4, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, PFORMAT_STRING, ProcString, 8, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, unsigned short *, FmtStringOffset, 12, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, STUB_THUNK *, ThunkTable, 16, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, PRPC_SYNTAX_IDENTIFIER, pTransferSyntax, 20, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, ULONG_PTR, nCount, 24, 4, 4);
TEST_FIELD(MIDL_SERVER_INFO, PMIDL_SYNTAX_INFO, pSyntaxInfo, 28, 4, 4);
}
static void test_pack_MIDL_STUB_DESC(void)
{
/* MIDL_STUB_DESC (pack 4) */
TEST_FIELD(MIDL_STUB_DESC, void *, RpcInterfaceInformation, 0, 4, 4);
}
static void test_pack_MIDL_STUB_MESSAGE(void)
{
/* MIDL_STUB_MESSAGE (pack 4) */
TEST_FIELD(MIDL_STUB_MESSAGE, PRPC_MESSAGE, RpcMsg, 0, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, Buffer, 4, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, BufferStart, 8, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, BufferEnd, 12, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, BufferMark, 16, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned long, BufferLength, 20, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned long, MemorySize, 24, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, Memory, 28, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, int, IsClient, 32, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, int, ReuseBuffer, 36, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, struct NDR_ALLOC_ALL_NODES_CONTEXT *, pAllocAllNodesContext, 40, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, struct NDR_POINTER_QUEUE_STATE *, pPointerQueueState, 44, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, int, IgnoreEmbeddedPointers, 48, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char *, PointerBufferMark, 52, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char, fBufferValid, 56, 1, 1);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned char, uFlags, 57, 1, 1);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned short, UniquePtrCount, 58, 2, 2);
TEST_FIELD(MIDL_STUB_MESSAGE, ULONG_PTR, MaxCount, 60, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned long, Offset, 64, 4, 4);
TEST_FIELD(MIDL_STUB_MESSAGE, unsigned long, ActualCount, 68, 4, 4);
}
static void test_pack_MIDL_STUBLESS_PROXY_INFO(void)
{
/* MIDL_STUBLESS_PROXY_INFO (pack 4) */
TEST_TYPE(MIDL_STUBLESS_PROXY_INFO, 24, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, PMIDL_STUB_DESC, pStubDesc, 0, 4, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, PFORMAT_STRING, ProcFormatString, 4, 4, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, unsigned short *, FormatStringOffset, 8, 4, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, PRPC_SYNTAX_IDENTIFIER, pTransferSyntax, 12, 4, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, ULONG_PTR, nCount, 16, 4, 4);
TEST_FIELD(MIDL_STUBLESS_PROXY_INFO, PMIDL_SYNTAX_INFO, pSyntaxInfo, 20, 4, 4);
}
static void test_pack_MIDL_SYNTAX_INFO(void)
{
/* MIDL_SYNTAX_INFO (pack 4) */
}
static void test_pack_NDR_CCONTEXT(void)
{
/* NDR_CCONTEXT */
TEST_TYPE(NDR_CCONTEXT, 4, 4);
}
static void test_pack_NDR_NOTIFY_ROUTINE(void)
{
/* NDR_NOTIFY_ROUTINE */
}
static void test_pack_NDR_NOTIFY2_ROUTINE(void)
{
/* NDR_NOTIFY2_ROUTINE */
}
static void test_pack_NDR_RUNDOWN(void)
{
/* NDR_RUNDOWN */
}
static void test_pack_NDR_SCONTEXT(void)
{
/* NDR_SCONTEXT */
TEST_TYPE(NDR_SCONTEXT, 4, 4);
}
static void test_pack_PARRAY_INFO(void)
{
/* PARRAY_INFO */
TEST_TYPE(PARRAY_INFO, 4, 4);
TEST_TYPE_POINTER(PARRAY_INFO, 24, 4);
}
static void test_pack_PFORMAT_STRING(void)
{
/* PFORMAT_STRING */
TEST_TYPE(PFORMAT_STRING, 4, 4);
}
static void test_pack_PFULL_PTR_TO_REFID_ELEMENT(void)
{
/* PFULL_PTR_TO_REFID_ELEMENT */
TEST_TYPE(PFULL_PTR_TO_REFID_ELEMENT, 4, 4);
TEST_TYPE_POINTER(PFULL_PTR_TO_REFID_ELEMENT, 16, 4);
}
static void test_pack_PFULL_PTR_XLAT_TABLES(void)
{
/* PFULL_PTR_XLAT_TABLES */
TEST_TYPE(PFULL_PTR_XLAT_TABLES, 4, 4);
}
static void test_pack_PMIDL_SERVER_INFO(void)
{
/* PMIDL_SERVER_INFO */
TEST_TYPE(PMIDL_SERVER_INFO, 4, 4);
TEST_TYPE_POINTER(PMIDL_SERVER_INFO, 32, 4);
}
static void test_pack_PMIDL_STUB_DESC(void)
{
/* PMIDL_STUB_DESC */
TEST_TYPE(PMIDL_STUB_DESC, 4, 4);
}
static void test_pack_PMIDL_STUB_MESSAGE(void)
{
/* PMIDL_STUB_MESSAGE */
TEST_TYPE(PMIDL_STUB_MESSAGE, 4, 4);
}
static void test_pack_PMIDL_STUBLESS_PROXY_INFO(void)
{
/* PMIDL_STUBLESS_PROXY_INFO */
TEST_TYPE(PMIDL_STUBLESS_PROXY_INFO, 4, 4);
TEST_TYPE_POINTER(PMIDL_STUBLESS_PROXY_INFO, 24, 4);
}
static void test_pack_PMIDL_SYNTAX_INFO(void)
{
/* PMIDL_SYNTAX_INFO */
TEST_TYPE(PMIDL_SYNTAX_INFO, 4, 4);
}
static void test_pack_PNDR_ASYNC_MESSAGE(void)
{
/* PNDR_ASYNC_MESSAGE */
TEST_TYPE(PNDR_ASYNC_MESSAGE, 4, 4);
}
static void test_pack_PNDR_CORRELATION_INFO(void)
{
/* PNDR_CORRELATION_INFO */
TEST_TYPE(PNDR_CORRELATION_INFO, 4, 4);
}
static void test_pack_PSCONTEXT_QUEUE(void)
{
/* PSCONTEXT_QUEUE */
TEST_TYPE(PSCONTEXT_QUEUE, 4, 4);
TEST_TYPE_POINTER(PSCONTEXT_QUEUE, 8, 4);
}
static void test_pack_PXMIT_ROUTINE_QUINTUPLE(void)
{
/* PXMIT_ROUTINE_QUINTUPLE */
TEST_TYPE(PXMIT_ROUTINE_QUINTUPLE, 4, 4);
}
static void test_pack_SCONTEXT_QUEUE(void)
{
/* SCONTEXT_QUEUE (pack 4) */
TEST_TYPE(SCONTEXT_QUEUE, 8, 4);
TEST_FIELD(SCONTEXT_QUEUE, unsigned long, NumberOfObjects, 0, 4, 4);
TEST_FIELD(SCONTEXT_QUEUE, NDR_SCONTEXT *, ArrayOfObjects, 4, 4, 4);
}
static void test_pack_SERVER_ROUTINE(void)
{
/* SERVER_ROUTINE */
}
static void test_pack_STUB_THUNK(void)
{
/* STUB_THUNK */
}
static void test_pack_USER_MARSHAL_FREEING_ROUTINE(void)
{
/* USER_MARSHAL_FREEING_ROUTINE */
}
static void test_pack_USER_MARSHAL_MARSHALLING_ROUTINE(void)
{
/* USER_MARSHAL_MARSHALLING_ROUTINE */
}
static void test_pack_USER_MARSHAL_ROUTINE_QUADRUPLE(void)
{
/* USER_MARSHAL_ROUTINE_QUADRUPLE (pack 4) */
}
static void test_pack_USER_MARSHAL_SIZING_ROUTINE(void)
{
/* USER_MARSHAL_SIZING_ROUTINE */
}
static void test_pack_USER_MARSHAL_UNMARSHALLING_ROUTINE(void)
{
/* USER_MARSHAL_UNMARSHALLING_ROUTINE */
}
static void test_pack_XMIT_HELPER_ROUTINE(void)
{
/* XMIT_HELPER_ROUTINE */
}
static void test_pack_XMIT_ROUTINE_QUINTUPLE(void)
{
/* XMIT_ROUTINE_QUINTUPLE (pack 4) */
}
static void test_pack_PRPC_STUB_FUNCTION(void)
{
/* PRPC_STUB_FUNCTION */
}
static void test_pack(void)
{
test_pack_ARRAY_INFO();
test_pack_COMM_FAULT_OFFSETS();
test_pack_CS_STUB_INFO();
test_pack_EXPR_EVAL();
test_pack_FULL_PTR_TO_REFID_ELEMENT();
test_pack_FULL_PTR_XLAT_TABLES();
test_pack_GENERIC_BINDING_INFO();
test_pack_GENERIC_BINDING_ROUTINE_PAIR();
test_pack_I_RPC_HANDLE();
test_pack_MALLOC_FREE_STRUCT();
test_pack_MIDL_FORMAT_STRING();
test_pack_MIDL_SERVER_INFO();
test_pack_MIDL_STUBLESS_PROXY_INFO();
test_pack_MIDL_STUB_DESC();
test_pack_MIDL_STUB_MESSAGE();
test_pack_MIDL_SYNTAX_INFO();
test_pack_NDR_CCONTEXT();
test_pack_NDR_NOTIFY2_ROUTINE();
test_pack_NDR_NOTIFY_ROUTINE();
test_pack_NDR_RUNDOWN();
test_pack_NDR_SCONTEXT();
test_pack_PARRAY_INFO();
test_pack_PFORMAT_STRING();
test_pack_PFULL_PTR_TO_REFID_ELEMENT();
test_pack_PFULL_PTR_XLAT_TABLES();
test_pack_PMIDL_SERVER_INFO();
test_pack_PMIDL_STUBLESS_PROXY_INFO();
test_pack_PMIDL_STUB_DESC();
test_pack_PMIDL_STUB_MESSAGE();
test_pack_PMIDL_SYNTAX_INFO();
test_pack_PNDR_ASYNC_MESSAGE();
test_pack_PNDR_CORRELATION_INFO();
test_pack_PRPC_CLIENT_INTERFACE();
test_pack_PRPC_DISPATCH_TABLE();
test_pack_PRPC_MESSAGE();
test_pack_PRPC_POLICY();
test_pack_PRPC_PROTSEQ_ENDPOINT();
test_pack_PRPC_SERVER_INTERFACE();
test_pack_PRPC_STUB_FUNCTION();
test_pack_PRPC_SYNTAX_IDENTIFIER();
test_pack_PSCONTEXT_QUEUE();
test_pack_PXMIT_ROUTINE_QUINTUPLE();
test_pack_RPC_AUTHZ_HANDLE();
test_pack_RPC_AUTH_IDENTITY_HANDLE();
test_pack_RPC_AUTH_KEY_RETRIEVAL_FN();
test_pack_RPC_BINDING_HANDLE();
test_pack_RPC_BINDING_VECTOR();
test_pack_RPC_CLIENT_INTERFACE();
test_pack_RPC_DISPATCH_FUNCTION();
test_pack_RPC_DISPATCH_TABLE();
test_pack_RPC_IF_HANDLE();
test_pack_RPC_IF_ID();
test_pack_RPC_MESSAGE();
test_pack_RPC_POLICY();
test_pack_RPC_PROTSEQ_ENDPOINT();
test_pack_RPC_SERVER_INTERFACE();
test_pack_RPC_STATUS();
test_pack_RPC_SYNTAX_IDENTIFIER();
test_pack_RPC_VERSION();
test_pack_SCONTEXT_QUEUE();
test_pack_SERVER_ROUTINE();
test_pack_STUB_THUNK();
test_pack_USER_MARSHAL_FREEING_ROUTINE();
test_pack_USER_MARSHAL_MARSHALLING_ROUTINE();
test_pack_USER_MARSHAL_ROUTINE_QUADRUPLE();
test_pack_USER_MARSHAL_SIZING_ROUTINE();
test_pack_USER_MARSHAL_UNMARSHALLING_ROUTINE();
test_pack_UUID_VECTOR();
test_pack_XMIT_HELPER_ROUTINE();
test_pack_XMIT_ROUTINE_QUINTUPLE();
}
START_TEST(generated)
{
test_pack();
}
......@@ -50,14 +50,14 @@ typedef struct _RPC_BINDING_VECTOR
{
unsigned long Count;
RPC_BINDING_HANDLE BindingH[1];
} RPC_BINDING_VECTOR, *PRPC_BINDING_VECTOR;
} RPC_BINDING_VECTOR;
#define rpc_binding_vector_t RPC_BINDING_VECTOR
typedef struct _UUID_VECTOR
{
unsigned long Count;
UUID *Uuid[1];
} UUID_VECTOR, *PUUID_VECTOR;
} UUID_VECTOR;
#define uuid_vector_t UUID_VECTOR
typedef struct _RPC_IF_ID
......@@ -162,11 +162,11 @@ RPCRTAPI RPC_STATUS RPC_ENTRY
RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec );
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcEpRegisterA( RPC_IF_HANDLE IfSpec, PRPC_BINDING_VECTOR BindingVector,
PUUID_VECTOR UuidVector, unsigned char *Annotation );
RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector,
UUID_VECTOR* UuidVector, unsigned char *Annotation );
RPCRTAPI RPC_STATUS RPC_ENTRY
RpcEpRegisterW( RPC_IF_HANDLE IfSpec, PRPC_BINDING_VECTOR BindingVector,
PUUID_VECTOR UuidVector, unsigned short *Annotation );
RpcEpRegisterW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector,
UUID_VECTOR* UuidVector, unsigned short *Annotation );
#define RpcEpRegister WINELIB_NAME_AW(RpcEpRegister)
RPCRTAPI RPC_STATUS RPC_ENTRY
......
......@@ -129,6 +129,8 @@ typedef void (__RPC_USER *NDR_NOTIFY2_ROUTINE)(_wine_boolean flag);
struct _MIDL_STUB_MESSAGE;
struct _MIDL_STUB_DESC;
struct _FULL_PTR_XLAT_TABLES;
struct NDR_ALLOC_ALL_NODES_CONTEXT;
struct NDR_POINTER_QUEUE_STATE;
typedef void (__RPC_USER *EXPR_EVAL)(struct _MIDL_STUB_MESSAGE *);
typedef const unsigned char *PFORMAT_STRING;
......@@ -143,6 +145,13 @@ typedef struct
unsigned long *ActualCountArray;
} ARRAY_INFO, *PARRAY_INFO;
typedef struct
{
unsigned long WireCodeset;
unsigned long DesiredReceivingCodeset;
void *CSArrayInfo;
} CS_STUB_INFO;
typedef struct _NDR_PIPE_DESC *PNDR_PIPE_DESC;
typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE;
typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE;
......@@ -161,12 +170,13 @@ typedef struct _MIDL_STUB_MESSAGE
unsigned char *Memory;
int IsClient;
int ReuseBuffer;
unsigned char *AllocAllNodesMemory;
unsigned char *AllocAllNodesMemoryEnd;
struct NDR_ALLOC_ALL_NODES_CONTEXT *pAllocAllNodesContext;
struct NDR_POINTER_QUEUE_STATE *pPointerQueueState;
int IgnoreEmbeddedPointers;
unsigned char *PointerBufferMark;
unsigned char fBufferValid;
unsigned char Unused;
unsigned char uFlags;
unsigned short UniquePtrCount;
ULONG_PTR MaxCount;
unsigned long Offset;
unsigned long ActualCount;
......@@ -179,7 +189,7 @@ typedef struct _MIDL_STUB_MESSAGE
const struct _MIDL_STUB_DESC *StubDesc;
struct _FULL_PTR_XLAT_TABLES *FullPtrXlatTables;
unsigned long FullPtrRefId;
unsigned long ulUnused1;
unsigned long PointerLength;
int fInDontFree:1;
int fDontCallFreeInst:1;
int fInOnlyParam:1;
......@@ -199,12 +209,21 @@ typedef struct _MIDL_STUB_MESSAGE
unsigned long *SizePtrLengthArray;
void *pArgQueue;
unsigned long dwStubPhase;
PNDR_PIPE_DESC pPipeDesc;
void *LowStackMark;
PNDR_ASYNC_MESSAGE pAsyncMsg;
PNDR_CORRELATION_INFO pCorrInfo;
unsigned char *pCorrMemory;
void *pMemoryList;
ULONG_PTR w2kReserved[5];
CS_STUB_INFO *pCSInfo;
unsigned char *ConformanceMark;
unsigned char *VarianceMark;
INT_PTR Unused;
struct _NDR_PROC_CONTEXT *pContext;
INT_PTR Reserved51_1;
INT_PTR Reserved51_2;
INT_PTR Reserved51_3;
INT_PTR Reserved51_4;
INT_PTR Reserved51_5;
} MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE;
#include <poppack.h>
......@@ -286,6 +305,18 @@ typedef struct _MIDL_FORMAT_STRING
#endif
} MIDL_FORMAT_STRING;
typedef struct _MIDL_SYNTAX_INFO
{
RPC_SYNTAX_IDENTIFIER TransferSyntax;
RPC_DISPATCH_TABLE* DispatchTable;
PFORMAT_STRING ProcString;
const unsigned short* FmtStringOffset;
PFORMAT_STRING TypeString;
const void* aUserMarshalQuadruple;
ULONG_PTR pReserved1;
ULONG_PTR pReserved2;
} MIDL_SYNTAX_INFO, *PMIDL_SYNTAX_INFO;
typedef void (__RPC_API *STUB_THUNK)( PMIDL_STUB_MESSAGE );
typedef long (__RPC_API *SERVER_ROUTINE)();
......@@ -297,9 +328,9 @@ typedef struct _MIDL_SERVER_INFO_
PFORMAT_STRING ProcString;
const unsigned short *FmtStringOffset;
const STUB_THUNK *ThunkTable;
PFORMAT_STRING LocalFormatTypes;
PFORMAT_STRING LocalProcString;
const unsigned short *LocalFmtStringOffset;
PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
ULONG_PTR nCount;
PMIDL_SYNTAX_INFO pSyntaxInfo;
} MIDL_SERVER_INFO, *PMIDL_SERVER_INFO;
typedef struct _MIDL_STUBLESS_PROXY_INFO
......@@ -307,9 +338,9 @@ typedef struct _MIDL_STUBLESS_PROXY_INFO
PMIDL_STUB_DESC pStubDesc;
PFORMAT_STRING ProcFormatString;
const unsigned short *FormatStringOffset;
PFORMAT_STRING LocalFormatTypes;
PFORMAT_STRING LocalProcStrings;
const unsigned short *LocalFmtStringOffset;
PRPC_SYNTAX_IDENTIFIER pTransferSyntax;
ULONG_PTR nCount;
PMIDL_SYNTAX_INFO pSyntaxInfo;
} MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO;
typedef union _CLIENT_CALL_RETURN
......
......@@ -33,6 +33,14 @@ use output qw($output);
use c_function;
use c_type;
# Defined a couple common regexp tidbits
my $CALL_CONVENTION="__cdecl|__stdcall|" .
"__RPC_API|__RPC_STUB|__RPC_USER|" .
"CALLBACK|CDECL|NTAPI|PASCAL|RPC_ENTRY|RPC_VAR_ENTRY|" .
"VFWAPI|VFWAPIV|WINAPI|WINAPIV|" .
"WINE_UNUSED";
########################################################################
# new
#
......@@ -1211,11 +1219,7 @@ sub parse_c_function {
$self->_parse_c('inline|FAR', \$_, \$line, \$column);
$self->_parse_c("__cdecl|__stdcall|__RPC_STUB|" .
"CALLBACK|CDECL|PASCAL|" .
"RPC_ENTRY|RPC_VAR_ENTRY|" .
"VFWAPIV|VFWAPI|WINAPIV|WINAPI|" .
"WINE_UNUSED",
$self->_parse_c($CALL_CONVENTION,
\$_, \$line, \$column, \$calling_convention);
......@@ -1835,6 +1839,16 @@ sub parse_c_typedef {
\$kind, \$_name, \@field_type_names, \@field_names, \@names))
{
my $base_name;
foreach my $name (@names)
{
if ($name =~ /^\w+$/)
{
$base_name = $name;
last;
}
}
$base_name="$kind $_name" if (!defined $base_name and defined $_name);
$base_name=$kind if (!defined $base_name);
foreach my $name (@names) {
if ($name =~ /^\w+$/) {
my $type = &$$create_type();
......@@ -1846,10 +1860,6 @@ sub parse_c_typedef {
$type->field_names([@field_names]);
&$$found_type($type);
$base_name = $name;
} elsif (!defined($base_name)) {
$self->_parse_c_error($_, $line, $column, "typedef 1");
} elsif ($name =~ /^(\*+)\s*(?:RESTRICTED_POINTER\s+)?(\w+)$/) {
my $type_name = "$base_name $1";
$name = $2;
......@@ -2004,7 +2014,7 @@ sub parse_c_variable {
$type = $self->_format_c_type($type);
$finished = 1;
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\((?:\s*CALLBACK|\s*NTAPI|\s*WINAPI)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) {
} elsif(s/^((?:enum\s+|struct\s+|union\s+)?\w+\b(?:\s*\*)*\s*\(\s*(?:$CALL_CONVENTION)?(?:\s*\*)*)\s*(\w+)\s*(\)\s*\(.*?\))$//s) {
$type = $self->_format_c_type("$sign$1$3");
$name = $2;
......@@ -2061,7 +2071,7 @@ sub parse_c_variable {
if($finished) {
# Nothing
} elsif(s/^(\((?:__cdecl|PASCAL|WINAPI)?\s*\*?\s*(?:__cdecl|PASCAL|WINAPI)?\w+\s*(?:\[[^\]]*\]\s*)*\))\s*\(//) {
} elsif(s/^(\((?:$CALL_CONVENTION)?\s*\*?\s*(?:$CALL_CONVENTION)?\w+\s*(?:\[[^\]]*\]\s*)*\))\s*\(//) {
$self->_update_c_position($&, \$line, \$column);
$name = $1;
......
......@@ -908,6 +908,122 @@ __int32
__int64
__int8
%%%dlls/rpcrt4/tests
%%pack
%description
Unit tests for data structure packing
%header
rpc.h
rpcdce.h
rpcdcep.h
rpcndr.h
rpcproxy.h
%include
<stdarg.h>
"windef.h"
"winbase.h"
"rpc.h"
"rpcndr.h"
"rpcproxy.h"
%type
ARRAY_INFO
!CLIENT_CALL_RETURN # FIXME: 20040822: Mishandled by winapi_test
COMM_FAULT_OFFSETS
CS_STUB_INFO
EXPR_EVAL
FULL_PTR_TO_REFID_ELEMENT
FULL_PTR_XLAT_TABLES
GENERIC_BINDING_INFO
GENERIC_BINDING_ROUTINE_PAIR
IDL_CS_CONVERT
I_RPC_HANDLE
MALLOC_FREE_STRUCT
MIDL_FORMAT_STRING
MIDL_SERVER_INFO
MIDL_STUB_DESC
MIDL_STUB_MESSAGE
MIDL_STUBLESS_PROXY_INFO
MIDL_SYNTAX_INFO
NDR_CCONTEXT
NDR_CS_ROUTINES
NDR_CS_SIZE_CONVERT_ROUTINES
NDR_NOTIFY_ROUTINE
NDR_NOTIFY2_ROUTINE
NDR_RUNDOWN
NDR_SCONTEXT
NDR_USER_MARSHAL_INFO
NDR_USER_MARSHAL_INFO_LEVEL1
PARRAY_INFO
PFORMAT_STRING
PFULL_PTR_TO_REFID_ELEMENT
PFULL_PTR_XLAT_TABLES
PGENERIC_BINDING_INFO
PGENERIC_BINDING_ROUTINE_PAIR
PMIDL_SERVER_INFO
PMIDL_STUB_DESC
PMIDL_STUB_MESSAGE
PMIDL_STUBLESS_PROXY_INFO
PMIDL_SYNTAX_INFO
PNDR_ASYNC_MESSAGE
PNDR_CORRELATION_INFO
!PNDR_PIPE_DESC # Only defined in the DDK on Windows
!PNDR_PIPE_MESSAGE # Only defined in the DDK on Windows
PROXY_PHASE
PRPC_CLIENT_INTERFACE
PRPC_DISPATCH_TABLE
PRPC_MESSAGE
PRPC_POLICY
PRPC_PROTSEQ_ENDPOINT
PRPC_SERVER_INTERFACE
PRPC_STUB_FUNCTION
PRPC_SYNTAX_IDENTIFIER
PSCONTEXT_QUEUE
PXMIT_ROUTINE_QUINTUPLE
PUUID_VECTOR
RPC_AUTH_IDENTITY_HANDLE
RPC_AUTH_KEY_RETRIEVAL_FN
RPC_AUTHZ_HANDLE
RPC_BINDING_HANDLE
RPC_BINDING_VECTOR
!RPC_BLOCKING_FN # FIXME: Needs MSWMSG
RPC_CLIENT_INTERFACE
RPC_DISPATCH_FUNCTION
RPC_DISPATCH_TABLE
RPC_IF_HANDLE
RPC_IF_ID
RPC_MESSAGE
RPC_POLICY
RPC_PROTSEQ_ENDPOINT
RPC_SERVER_INTERFACE
RPC_SS_THREAD_HANDLE
RPC_STATUS
RPC_SYNTAX_IDENTIFIER
RPC_VERSION
SCONTEXT_QUEUE
SERVER_ROUTINE
STUB_PHASE
STUB_THUNK
USER_MARSHAL_CB
USER_MARSHAL_CB_TYPE
USER_MARSHAL_FREEING_ROUTINE
USER_MARSHAL_MARSHALLING_ROUTINE
USER_MARSHAL_ROUTINE_QUADRUPLE
USER_MARSHAL_SIZING_ROUTINE
USER_MARSHAL_UNMARSHALLING_ROUTINE
UUID_VECTOR
XLAT_SIDE
XMIT_HELPER_ROUTINE
XMIT_ROUTINE_QUINTUPLE
%%%dlls/shell32/tests
%%pack
......
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