widl: Use publicly defined NDR constants.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2018-06-12 21:19:11 -05:00 committed by Alexandre Julliard
parent 69cd52875a
commit f9c8c20298
9 changed files with 427 additions and 632 deletions

View file

@ -1,205 +0,0 @@
/*
* RPC format chars, as found by studying MIDL output.
* Some, but not all, usage of these are explained on MSDN.
*/
#ifndef __WINE_RPCFC_H
#define __WINE_RPCFC_H
/* base types */
#define RPC_FC_BYTE 0x01
#define RPC_FC_CHAR 0x02
#define RPC_FC_SMALL 0x03
#define RPC_FC_USMALL 0x04
#define RPC_FC_WCHAR 0x05
#define RPC_FC_SHORT 0x06
#define RPC_FC_USHORT 0x07
#define RPC_FC_LONG 0x08
#define RPC_FC_ULONG 0x09
#define RPC_FC_FLOAT 0x0a
#define RPC_FC_HYPER 0x0b
#define RPC_FC_DOUBLE 0x0c
#define RPC_FC_ENUM16 0x0d
#define RPC_FC_ENUM32 0x0e
#define RPC_FC_IGNORE 0x0f
#define RPC_FC_ERROR_STATUS_T 0x10
/* other stuff */
#define RPC_FC_RP 0x11 /* reference pointer */
#define RPC_FC_UP 0x12 /* unique pointer */
#define RPC_FC_OP 0x13 /* unique pointer in object ? */
#define RPC_FC_FP 0x14 /* full pointer */
#define RPC_FC_STRUCT 0x15 /* simple structure */
/* FC_STRUCT: align-1, NdrFcShort(size), fields */
#define RPC_FC_PSTRUCT 0x16 /* simple structure w/ pointers */
/* FC_PTRUCT: align-1, NdrFcShort(size), ptrs, fields */
#define RPC_FC_CSTRUCT 0x17 /* conformant structure */
#define RPC_FC_CPSTRUCT 0x18 /* conformant structure w/ pointers */
#define RPC_FC_CVSTRUCT 0x19 /* conformant varying struct */
#define RPC_FC_BOGUS_STRUCT 0x1a /* complex structure */
#define RPC_FC_CARRAY 0x1b /* conformant array */
/* FC_CARRAY: align-1, NdrFcShort(size), conformance, ptrs, fields */
#define RPC_FC_CVARRAY 0x1c /* conformant varying array */
/* FC_CARRAY: align-1, NdrFcShort(size), conformance, variance, ptrs, fields */
#define RPC_FC_SMFARRAY 0x1d /* small (<64K) fixed array */
/* FC_SMFARRAY: align-1, NdrFcShort(size), ptrs, fields */
#define RPC_FC_LGFARRAY 0x1e /* large (>= 64k) fixed array */
#define RPC_FC_SMVARRAY 0x1f /* small (<64k) varying array */
#define RPC_FC_LGVARRAY 0x20 /* large (>= 64k) varying array */
#define RPC_FC_BOGUS_ARRAY 0x21 /* complex array */
#define RPC_FC_C_CSTRING 0x22
#define RPC_FC_C_SSTRING 0x24
#define RPC_FC_C_WSTRING 0x25
#define RPC_FC_CSTRING 0x26
#define RPC_FC_SSTRING 0x28
#define RPC_FC_WSTRING 0x29
#define RPC_FC_ENCAPSULATED_UNION 0x2a
#define RPC_FC_NON_ENCAPSULATED_UNION 0x2b
#define RPC_FC_BYTE_COUNT_POINTER 0x2c /* [byte_count] ACF attribute */
#define RPC_FC_TRANSMIT_AS 0x2d
#define RPC_FC_REPRESENT_AS 0x2e
#define RPC_FC_IP 0x2f /* interface pointer */
/* FC_IP: FC_CONSTANT_IID iid */
/* FC_IP: FC_PAD correlation */
#define RPC_FC_BIND_CONTEXT 0x30
#define RPC_FC_BIND_GENERIC 0x31
#define RPC_FC_BIND_PRIMITIVE 0x32
#define RPC_FC_AUTO_HANDLE 0x33
#define RPC_FC_CALLBACK_HANDLE 0x34
#define RPC_FC_POINTER 0x36
#define RPC_FC_ALIGNM2 0x37
#define RPC_FC_ALIGNM4 0x38
#define RPC_FC_ALIGNM8 0x39
#define RPC_FC_STRUCTPAD1 0x3d
#define RPC_FC_STRUCTPAD2 0x3e
#define RPC_FC_STRUCTPAD3 0x3f
#define RPC_FC_STRUCTPAD4 0x40
#define RPC_FC_STRUCTPAD5 0x41
#define RPC_FC_STRUCTPAD6 0x42
#define RPC_FC_STRUCTPAD7 0x43
#define RPC_FC_STRING_SIZED 0x44
#define RPC_FC_NO_REPEAT 0x46
#define RPC_FC_FIXED_REPEAT 0x47
#define RPC_FC_VARIABLE_REPEAT 0x48
#define RPC_FC_FIXED_OFFSET 0x49
#define RPC_FC_VARIABLE_OFFSET 0x4a
#define RPC_FC_PP 0x4b /* pointer layout */
/* FC_PP: FC_PAD layouts */
/* layouts: FC_NO_REPEAT FC_PAD instance */
/* instance: NdrFcShort(memofs), NdrFcShort(bufofs), desc */
#define RPC_FC_EMBEDDED_COMPLEX 0x4c
/* FC_EMBEDDED_COMPLEX: padding, NdrFcShort(typeofs) */
#define RPC_FC_IN_PARAM 0x4d
/* FC_IN_PARAM: stacksiz, NdrFcShort(typeofs) */
#define RPC_FC_IN_PARAM_BASETYPE 0x4e
/* FC_IN_PARAM_BASETYPE: basetype */
#define RPC_FC_IN_PARAM_NO_FREE_INST 0x4f
#define RPC_FC_IN_OUT_PARAM 0x50
/* FC_IN_OUT_PARAM: stacksiz, NdrFcShort(typeofs) */
#define RPC_FC_OUT_PARAM 0x51
/* FC_OUT_PARAM: stacksiz, NdrFcShort(typeofs) */
#define RPC_FC_RETURN_PARAM 0x52
/* FC_RETURN_PARAM: stacksiz, NdrFcShort(typeofs) */
#define RPC_FC_RETURN_PARAM_BASETYPE 0x53
/* FC_RETURN_PARAM_BASETYPE: basetype */
#define RPC_FC_DEREFERENCE 0x54
#define RPC_FC_DIV_2 0x55
#define RPC_FC_MULT_2 0x56
#define RPC_FC_ADD_1 0x57
#define RPC_FC_SUB_1 0x58
#define RPC_FC_CALLBACK 0x59
#define RPC_FC_CONSTANT_IID 0x5a
/* FC_CONSTANT_IID: NdrFcLong(), NdrFcShort(), NdrFcShort(), 8x () */
#define RPC_FC_END 0x5b
#define RPC_FC_PAD 0x5c
#define RPC_FC_USER_MARSHAL 0xb4
#define RPC_FC_RANGE 0xb7
#define RPC_FC_INT3264 0xb8
#define RPC_FC_UINT3264 0xb9
/* FC_RP/UP/OP/FP: flags, NdrFcShort(typeofs)/basetype */
#define RPC_FC_P_ALLOCALLNODES 0x01
#define RPC_FC_P_DONTFREE 0x02
#define RPC_FC_P_ONSTACK 0x04 /* [alloced_on_stack] */
#define RPC_FC_P_SIMPLEPOINTER 0x08 /* [simple_pointer] */
#define RPC_FC_P_DEREF 0x10
#define RPC_FC_BIND_EXPLICIT 0x00
/* proc header: oiflags, NdrFcLong(rpcflags), NdrFcShort(procnum), NdrFcShort(stacksiz),
* oi2 header: NdrFcShort(clientbuf), NdrFcShort(servbuf), oi2flags, parmcount
* oi2 parameters: NdrFcShort(flags), NdrFcShort(stackofs), NdrFcShort(typeofs)/basetype */
#define RPC_FC_PROC_OIF_FULLPTR 0x01
#define RPC_FC_PROC_OIF_RPCSSALLOC 0x02
#define RPC_FC_PROC_OIF_OBJECT 0x04
#define RPC_FC_PROC_OIF_RPCFLAGS 0x08
#define RPC_FC_PROC_OIF_OBJ_V2 0x20
#define RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT 0x20
#define RPC_FC_PROC_OIF_NEWINIT 0x40
#define RPC_FC_PROC_PF_MUSTSIZE 0x0001
#define RPC_FC_PROC_PF_MUSTFREE 0x0002
#define RPC_FC_PROC_PF_PIPE 0x0004
#define RPC_FC_PROC_PF_IN 0x0008
#define RPC_FC_PROC_PF_OUT 0x0010
#define RPC_FC_PROC_PF_RETURN 0x0020
#define RPC_FC_PROC_PF_BASETYPE 0x0040
#define RPC_FC_PROC_PF_BYVAL 0x0080
#define RPC_FC_PROC_PF_SIMPLEREF 0x0100
#define RPC_FC_PROC_PF_DONTFREEINST 0x0200
#define RPC_FC_PROC_PF_SAVEASYNC 0x0400
#define RPC_FC_PROC_PF_SRVALLOCSIZE 0xe000 /* in 8 byte units */
/* correlation types */
#define RPC_FC_NORMAL_CONFORMANCE 0x00
#define RPC_FC_POINTER_CONFORMANCE 0x10
#define RPC_FC_TOP_LEVEL_CONFORMANCE 0x20
#define RPC_FC_CONSTANT_CONFORMANCE 0x40
#define RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE 0x80
/* user marshal flags */
#define USER_MARSHAL_UNIQUE 0x80
#define USER_MARSHAL_REF 0x40
#define USER_MARSHAL_POINTER 0xc0
#define USER_MARSHAL_IID 0x20
/* context handle flags */
#define NDR_CONTEXT_HANDLE_CANNOT_BE_NULL 0x01
#define NDR_CONTEXT_HANDLE_SERIALIZE 0x02
#define NDR_CONTEXT_HANDLE_NO_SERIALIZE 0x04
#define NDR_STRICT_CONTEXT_HANDLE 0x08
#endif /* __WINE_RPCFC_H */

View file

@ -91,7 +91,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
print_client("MIDL_STUB_MESSAGE _StubMsg;\n");
if (handle_var)
{
if (explicit_fc == RPC_FC_BIND_GENERIC)
if (explicit_fc == FC_BIND_GENERIC)
print_client("%s %s;\n",
get_explicit_generic_handle_type(handle_var)->name, handle_var->name );
print_client("RPC_BINDING_HANDLE _Handle;\n");
@ -113,7 +113,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
print_client("NdrFreeBuffer(&__frame->_StubMsg);\n");
if (explicit_fc == RPC_FC_BIND_GENERIC)
if (explicit_fc == FC_BIND_GENERIC)
{
fprintf(client, "\n");
print_client("if (__frame->_Handle)\n");
@ -144,7 +144,7 @@ static void write_function_stub( const type_t *iface, const var_t *func,
if (handle_var)
{
print_client( "__frame->_Handle = 0;\n" );
if (explicit_fc == RPC_FC_BIND_GENERIC)
if (explicit_fc == FC_BIND_GENERIC)
print_client("__frame->%s = %s;\n", handle_var->name, handle_var->name );
}
if (has_ret && decl_indirect(retval->type))
@ -180,16 +180,16 @@ static void write_function_stub( const type_t *iface, const var_t *func,
switch (explicit_fc)
{
case RPC_FC_BIND_PRIMITIVE:
case FC_BIND_PRIMITIVE:
print_client("__frame->_Handle = %s;\n", handle_var->name);
fprintf(client, "\n");
break;
case RPC_FC_BIND_GENERIC:
case FC_BIND_GENERIC:
print_client("__frame->_Handle = %s_bind(%s);\n",
get_explicit_generic_handle_type(handle_var)->name, handle_var->name);
fprintf(client, "\n");
break;
case RPC_FC_BIND_CONTEXT:
case FC_BIND_CONTEXT:
{
/* if the context_handle attribute appears in the chain of types
* without pointers being followed, then the context handle must

View file

@ -519,11 +519,11 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
break;
case EXPR_STRLIT:
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL);
break;
case EXPR_WSTRLIT:
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
result.type = type_new_pointer(FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL);
break;
case EXPR_CHARCONST:
result.is_temporary = TRUE;
@ -573,7 +573,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc
expr_loc->attr ? expr_loc->attr : "");
result.is_variable = FALSE;
result.is_temporary = TRUE;
result.type = type_new_pointer(RPC_FC_UP, result.type, NULL);
result.type = type_new_pointer(FC_UP, result.type, NULL);
break;
case EXPR_PPTR:
result = resolve_expression(expr_loc, cont_type, e->ref);

View file

@ -805,17 +805,17 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
if (!is_attr( var->attrs, ATTR_IN ) && is_attr( var->attrs, ATTR_OUT )) continue;
if (type_get_type( var->type ) == TYPE_BASIC && type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
{
*explicit_fc = RPC_FC_BIND_PRIMITIVE;
*explicit_fc = FC_BIND_PRIMITIVE;
return var;
}
if (get_explicit_generic_handle_type( var ))
{
*explicit_fc = RPC_FC_BIND_GENERIC;
*explicit_fc = FC_BIND_GENERIC;
return var;
}
if (is_context_handle( var->type ))
{
*explicit_fc = RPC_FC_BIND_CONTEXT;
*explicit_fc = FC_BIND_CONTEXT;
return var;
}
}
@ -824,13 +824,13 @@ const var_t *get_func_handle_var( const type_t *iface, const var_t *func,
{
if (type_get_type( var->type ) == TYPE_BASIC &&
type_basic_get_type( var->type ) == TYPE_BASIC_HANDLE)
*implicit_fc = RPC_FC_BIND_PRIMITIVE;
*implicit_fc = FC_BIND_PRIMITIVE;
else
*implicit_fc = RPC_FC_BIND_GENERIC;
*implicit_fc = FC_BIND_GENERIC;
return var;
}
*implicit_fc = RPC_FC_AUTO_HANDLE;
*implicit_fc = FC_AUTO_HANDLE;
return NULL;
}

View file

@ -38,7 +38,7 @@
#include "expr.h"
#include "typetree.h"
static unsigned char pointer_default = RPC_FC_UP;
static unsigned char pointer_default = FC_UP;
typedef struct list typelist_t;
struct typenode {
@ -1107,9 +1107,9 @@ threading_type:
;
pointer_type:
tREF { $$ = RPC_FC_RP; }
| tUNIQUE { $$ = RPC_FC_UP; }
| tPTR { $$ = RPC_FC_FP; }
tREF { $$ = FC_RP; }
| tUNIQUE { $$ = FC_UP; }
| tPTR { $$ = FC_FP; }
;
structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
@ -1501,12 +1501,12 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
}
if (is_ptr(ptr))
{
if (ptr_attr && ptr_attr != RPC_FC_UP &&
if (ptr_attr && ptr_attr != FC_UP &&
type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE)
warning_loc_info(&v->loc_info,
"%s: pointer attribute applied to interface "
"pointer type has no effect\n", v->name);
if (!ptr_attr && top && (*pt)->details.pointer.def_fc != RPC_FC_RP)
if (!ptr_attr && top && (*pt)->details.pointer.def_fc != FC_RP)
{
/* FIXME: this is a horrible hack to cope with the issue that we
* store an offset to the typeformat string in the type object, but
@ -1531,9 +1531,9 @@ static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const decl
t = type_pointer_get_ref(t);
if (type_get_type(t) != TYPE_BASIC &&
(get_basic_fc(t) != RPC_FC_CHAR &&
get_basic_fc(t) != RPC_FC_BYTE &&
get_basic_fc(t) != RPC_FC_WCHAR))
(get_basic_fc(t) != FC_CHAR &&
get_basic_fc(t) != FC_BYTE &&
get_basic_fc(t) != FC_WCHAR))
{
error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
v->name);
@ -1764,7 +1764,7 @@ static declarator_t *make_declarator(var_t *var)
static type_t *make_safearray(type_t *type)
{
return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0,
NULL, NULL, RPC_FC_RP);
NULL, NULL, FC_RP);
}
static typelib_t *make_library(const char *name, const attr_list_t *attrs)

View file

@ -152,7 +152,7 @@ static void free_variable( const var_t *arg, const char *local_var_prefix )
break;
case TGT_STRUCT:
if (get_struct_fc(type) != RPC_FC_STRUCT)
if (get_struct_fc(type) != FC_STRUCT)
print_proxy("/* FIXME: %s code for %s struct type 0x%x missing */\n", __FUNCTION__, arg->name, get_struct_fc(type) );
break;

View file

@ -104,7 +104,7 @@ static void write_function_stub(const type_t *iface, const var_t *func, unsigned
write_parameters_init(server, indent, func, "__frame->");
if (explicit_fc == RPC_FC_BIND_PRIMITIVE)
if (explicit_fc == FC_BIND_PRIMITIVE)
{
print_server("__frame->%s = _pRpcMessage->Handle;\n", handle_var->name);
fprintf(server, "\n");

File diff suppressed because it is too large Load diff

View file

@ -24,7 +24,7 @@
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
#include "wine/rpcfc.h"
#include "ndrtypes.h"
#include "wine/list.h"
#ifndef UUID_DEFINED