{
const var_t *def = func->def;
const var_t* explicit_handle_var;
+ int has_full_pointer = is_full_pointer_function(func);
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
}
fprintf(client, "\n");
+ if (has_full_pointer)
+ write_full_pointer_init(client, indent, func, FALSE);
+
/* check pointers */
check_pointers(func);
/* FIXME: emit client finally code */
+ if (has_full_pointer)
+ write_full_pointer_free(client, indent, func);
+
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
indent--;
var_t *def = cur->def;
if (!is_callas(def->attrs)) {
const var_t *arg;
- int argc = 0;
- int c;
-
- if (cur->args) LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) argc++;
fprintf(header, "#define %s_", name);
write_name(header,def);
- fprintf(header, "(p");
- for (c=0; c<argc; c++)
- fprintf(header, ",%c", c+'a');
+ fprintf(header, "(This");
+ if (cur->args)
+ LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
+ fprintf(header, ",%s", arg->name);
fprintf(header, ") ");
- fprintf(header, "(p)->lpVtbl->");
+ fprintf(header, "(This)->lpVtbl->");
write_name(header, def);
- fprintf(header, "(p");
- for (c=0; c<argc; c++)
- fprintf(header, ",%c", c+'a');
+ fprintf(header, "(This");
+ if (cur->args)
+ LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
+ fprintf(header, ",%s", arg->name);
fprintf(header, ")\n");
}
}
import->next = first_import;
first_import = import;
- if (!(path = wpp_find_include( fname, input_name )))
+ /* don't search for a file name with a path in the include directories,
+ * for compatibility with MIDL */
+ if (strchr( fname, '/' ) || strchr( fname, '\\' ))
+ path = strdup( fname );
+ else if (!(path = wpp_find_include( fname, input_name )))
error_loc("Unable to open include file %s\n", fname);
import_stack[ptr].temp_name = temp_name;
import->next = first_import;
first_import = import;
- if (!(path = wpp_find_include( fname, input_name )))
+ /* don't search for a file name with a path in the include directories,
+ * for compatibility with MIDL */
+ if (strchr( fname, '/' ) || strchr( fname, '\\' ))
+ path = strdup( fname );
+ else if (!(path = wpp_find_include( fname, input_name )))
error_loc("Unable to open include file %s\n", fname);
import_stack[ptr].temp_name = temp_name;
{
var_t *def = cur->def;
int has_ret = !is_void(def->type);
+ int has_full_pointer = is_full_pointer_function(cur);
indent = 0;
write_type_decl_left(proxy, def->type);
}
print_proxy( "\n");
+ if (has_full_pointer)
+ write_full_pointer_init(proxy, indent, cur, FALSE);
+
/* FIXME: trace */
clear_output_vars( cur->args );
print_proxy( "RpcFinally\n" );
print_proxy( "{\n" );
indent++;
+ if (has_full_pointer)
+ write_full_pointer_free(proxy, indent, cur);
print_proxy( "NdrProxyFreeBuffer(This, &_StubMsg);\n" );
indent--;
print_proxy( "}\n");
var_t *def = cur->def;
const var_t *arg;
int has_ret = !is_void(def->type);
+ int has_full_pointer = is_full_pointer_function(cur);
indent = 0;
print_proxy( "void __RPC_STUB %s_", iface->name);
print_proxy("RpcTryFinally\n");
print_proxy("{\n");
indent++;
+ if (has_full_pointer)
+ write_full_pointer_init(proxy, indent, cur, TRUE);
print_proxy("if ((_pRpcMessage->DataRepresentation & 0xffff) != NDR_LOCAL_DATA_REPRESENTATION)\n");
indent++;
print_proxy("NdrConvert( &_StubMsg, &__MIDL_ProcFormatString.Format[%u]);\n", proc_offset );
write_remoting_arguments(proxy, indent+1, cur, PASS_OUT, PHASE_FREE);
+ if (has_full_pointer)
+ write_full_pointer_free(proxy, indent, cur);
+
print_proxy("}\n");
print_proxy("RpcEndFinally\n");
LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
{
const var_t *def = func->def;
+ int has_full_pointer = is_full_pointer_function(func);
/* check for a defined binding handle */
explicit_handle_var = get_explicit_handle_var(func);
print_server("{\n");
indent++;
+ if (has_full_pointer)
+ write_full_pointer_init(server, indent, func, TRUE);
+
if (func->args)
{
print_server("if ((_pRpcMessage->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION)\n");
write_remoting_arguments(server, indent, func, PASS_OUT, PHASE_FREE);
+ if (has_full_pointer)
+ write_full_pointer_free(server, indent, func);
+
indent--;
print_server("}\n");
print_server("RpcEndFinally\n");
return FALSE;
}
+static int type_has_full_pointer(const type_t *type)
+{
+ if (is_user_type(type))
+ return FALSE;
+ else if (type->type == RPC_FC_FP)
+ return TRUE;
+ else if (is_ptr(type))
+ return FALSE;
+ else if (is_array(type))
+ return type_has_full_pointer(type->ref);
+ else if (is_struct(type->type))
+ {
+ const var_t *field;
+ if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
+ {
+ if (type_has_full_pointer(field->type))
+ return TRUE;
+ }
+ }
+ else if (is_union(type->type))
+ {
+ var_list_t *fields;
+ const var_t *field;
+ if (type->type == RPC_FC_ENCAPSULATED_UNION)
+ {
+ const var_t *uv = LIST_ENTRY(list_tail(type->fields), const var_t, entry);
+ fields = uv->type->fields;
+ }
+ else
+ fields = type->fields;
+ if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
+ {
+ if (field->type && type_has_full_pointer(field->type))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
static unsigned short user_type_offset(const char *name)
{
user_type_t *ut;
return size;
}
+int is_full_pointer_function(const func_t *func)
+{
+ const var_t *var;
+ if (type_has_full_pointer(func->def->type))
+ return TRUE;
+ if (!func->args)
+ return FALSE;
+ LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
+ if (type_has_full_pointer( var->type ))
+ return TRUE;
+ return FALSE;
+}
+
+void write_full_pointer_init(FILE *file, int indent, const func_t *func, int is_server)
+{
+ print_file(file, indent, "_StubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,%s);\n",
+ is_server ? "XLAT_SERVER" : "XLAT_CLIENT");
+ fprintf(file, "\n");
+}
+
+void write_full_pointer_free(FILE *file, int indent, const func_t *func)
+{
+ print_file(file, indent, "NdrFullPointerXlatFree(_StubMsg.FullPtrXlatTables);\n");
+ fprintf(file, "\n");
+}
+
static unsigned int write_nonsimple_pointer(FILE *file, const type_t *type, size_t offset)
{
short absoff = type->ref->typestring_offset;
off = write_array_tfs(file, var->attrs, type, var->name, typeformat_offset);
ptr_type = get_attrv(var->attrs, ATTR_POINTERTYPE);
/* Top level pointers to conformant arrays may be handled specially
- since we can bypass the pointer, but if the array is burried
+ since we can bypass the pointer, but if the array is buried
beneath another pointer (e.g., "[size_is(,n)] int **p" then we
always need to write the pointer. */
if (!ptr_type && var->type != type)
{
if (pass == PASS_OUT)
{
+ if (!in_attr)
+ print_file(file, indent, "*%s = 0;\n", var->name);
print_file(file, indent, "NdrClientContextUnmarshall(\n");
print_file(file, indent + 1, "&_StubMsg,\n");
print_file(file, indent + 1, "(NDR_CCONTEXT *)%s,\n", var->name);
int get_padding(const var_list_t *fields);
int is_user_type(const type_t *t);
expr_t *get_size_is_expr(const type_t *t, const char *name);
+int is_full_pointer_function(const func_t *func);
+void write_full_pointer_init(FILE *file, int indent, const func_t *func, int is_server);
+void write_full_pointer_free(FILE *file, int indent, const func_t *func);
/* layout of the main segment directory */
typedef struct tagMSFT_SegDir {
-/*1*/MSFT_pSeg pTypeInfoTab; /* each type info get an entry of 0x64 bytes */
+/*1*/MSFT_pSeg pTypeInfoTab; /* each typeinfo gets an entry of 0x64 bytes */
/* (25 ints) */
/*2*/MSFT_pSeg pImpInfo; /* table with info for imported types */
-/*3*/MSFT_pSeg pImpFiles; /* import libaries */
+/*3*/MSFT_pSeg pImpFiles; /* import libraries */
/*4*/MSFT_pSeg pRefTab; /* References table */
-/*5*/MSFT_pSeg pLibtab; /* always exists, alway same size (0x80) */
+/*5*/MSFT_pSeg pLibtab; /* always exists, always same size (0x80) */
/* hash table w offsets to guid????? */
/*6*/MSFT_pSeg pGuidTab; /* all guids are stored here together with */
/* offset in some table???? */
-/*7*/MSFT_pSeg res07; /* always created, alway same size (0x200) */
+/*7*/MSFT_pSeg res07; /* always created, always same size (0x200) */
/* purpose largely unknown */
/*8*/MSFT_pSeg pNametab; /* name tables */
/*9*/MSFT_pSeg pStringtab; /* string table */
/* base type info data */
typedef struct tagMSFT_TypeInfoBase {
/*000*/ INT typekind; /* it is the TKIND_xxx */
- /* some byte alignment stuf */
+ /* some byte alignment stuff */
INT memoffset; /* points past the file, if no elements */
INT res2; /* zero if no element, N*0x40 */
- INT res3; /* -1 if no lement, (N-1)*0x38 */
+ INT res3; /* -1 if no element, (N-1)*0x38 */
/*010*/ INT res4; /* always? 3 */
INT res5; /* always? zero */
INT cElement; /* counts elements, HI=cVars, LO=cFuncs */
/* function description data */
typedef struct {
-/* INT recsize; record size including some xtra stuff */
+/* INT recsize; record size including some extra stuff */
INT DataType; /* data type of the member, eg return of function */
INT Flags; /* something to do with attribute flags (LOWORD) */
#ifdef WORDS_BIGENDIAN
/* Variable description data */
typedef struct {
-/* INT recsize; // record size including some xtra stuff */
+/* INT recsize; // record size including some extra stuff */
INT DataType; /* data type of the variable */
INT Flags; /* VarFlags (LOWORD) */
#ifdef WORDS_BIGENDIAN
#include "widl.h"
#include "utils.h"
-Index: utils.c
-===================================================================
---- utils.c (revision 32187)
-+++ utils.c (working copy)
-@@ -136,6 +136,9 @@
- name = "widl.tab";
-
- slash = strrchr(name, '/');
-+ if (!slash)
-+ slash = strrchr(name, '\\');
-+
- if (slash)
- name = slash + 1;
-
-Index: widl.c
-===================================================================
---- widl.c (revision 32187)
-+++ widl.c (working copy)
-@@ -166,6 +166,9 @@
- int i;
-
- slash = strrchr(name, '/');
-+ if(!slash)
-+ slash = strrchr(name, '\\');
-+
- if (slash) name = slash + 1;
-
- token = xstrdup(name);
Index: widltypes.h
===================================================================
--- widltypes.h (revision 32187)
#include "widltypes.h"
#include "typelib.h"
-@@ -2415,7 +2413,7 @@
-
- retval = TYPE_E_IOERROR;
-
-- fd = creat(typelib->typelib->filename, 0666);
-+ fd = open(typelib->typelib->filename, O_CREAT | O_WRONLY | O_TRUNC | O_BINARY, 0666);
- if (fd == -1) return retval;
-
- filepos = sizeof(MSFT_Header) + sizeof(MSFT_SegDir);
typeinfo->flags |= 0x10; /* TYPEFLAG_FHIDDEN */
break;
+ case ATTR_LOCAL:
+ break;
+
case ATTR_NONCREATABLE:
typeinfo->flags &= ~0x2; /* TYPEFLAG_FCANCREATE */
break;