Author: fireball
Date: Sun Feb 10 13:10:44 2008
New Revision: 32252
URL:
http://svn.reactos.org/svn/reactos?rev=32252&view=rev
Log:
Sync to Wine-0.9.55:
- Rob Shearman <rob(a)codeweavers.com> Sun, 20 Jan 2008
widl: Write out code for initialising out-only client context handles.
- Francois Gouget <fgouget(a)free.fr> Wed, 23 Jan 2008
Assorted spelling fixes.
- Jacek Caban <jacek(a)codeweavers.com> Tue, 29 Jan 2008
widl: Ignore ATTR_LOCAL in create_msft_typeinfo.
- Rob Shearman <rob(a)codeweavers.com> Wed, 30 Jan 2008
widl: Don't search for a import file name with a path in the include directories for
compatibility with MIDL.
- Rob Shearman <rob(a)codeweavers.com> Wed, 30 Jan 2008
widl: Output code for initialising and freeing full pointer translation tables.
- Colin Finck <mail(a)colinfinck.de> Thu, 7 Feb 2008
widl: Support Windows paths in dup_basename and make_token.
- Colin Finck <mail(a)colinfinck.de> Thu, 7 Feb 2008
widl: Write the TLB file in binary mode, so the line endings won't be changed.
Modified:
trunk/reactos/tools/widl/client.c
trunk/reactos/tools/widl/header.c
trunk/reactos/tools/widl/parser.l
trunk/reactos/tools/widl/parser.yy.c
trunk/reactos/tools/widl/proxy.c
trunk/reactos/tools/widl/server.c
trunk/reactos/tools/widl/typegen.c
trunk/reactos/tools/widl/typegen.h
trunk/reactos/tools/widl/typelib_struct.h
trunk/reactos/tools/widl/widl_ros.diff
trunk/reactos/tools/widl/write_msft.c
Modified: trunk/reactos/tools/widl/client.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/client.c?rev=32…
==============================================================================
--- trunk/reactos/tools/widl/client.c (original)
+++ trunk/reactos/tools/widl/client.c Sun Feb 10 13:10:44 2008
@@ -85,6 +85,7 @@
{
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);
@@ -141,6 +142,9 @@
"_RetVal", "_RetVal");
}
fprintf(client, "\n");
+
+ if (has_full_pointer)
+ write_full_pointer_init(client, indent, func, FALSE);
/* check pointers */
check_pointers(func);
@@ -244,6 +248,9 @@
/* FIXME: emit client finally code */
+
+ if (has_full_pointer)
+ write_full_pointer_free(client, indent, func);
print_client("NdrFreeBuffer((PMIDL_STUB_MESSAGE)&_StubMsg);\n");
Modified: trunk/reactos/tools/widl/header.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/header.c?rev=32…
==============================================================================
--- trunk/reactos/tools/widl/header.c (original)
+++ trunk/reactos/tools/widl/header.c Sun Feb 10 13:10:44 2008
@@ -578,23 +578,21 @@
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");
}
}
Modified: trunk/reactos/tools/widl/parser.l
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/parser.l?rev=32…
==============================================================================
--- trunk/reactos/tools/widl/parser.l (original)
+++ trunk/reactos/tools/widl/parser.l Sun Feb 10 13:10:44 2008
@@ -414,7 +414,11 @@
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;
Modified: trunk/reactos/tools/widl/parser.yy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/parser.yy.c?rev…
==============================================================================
--- trunk/reactos/tools/widl/parser.yy.c (original)
+++ trunk/reactos/tools/widl/parser.yy.c Sun Feb 10 13:10:44 2008
@@ -2117,7 +2117,11 @@
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;
Modified: trunk/reactos/tools/widl/proxy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/proxy.c?rev=322…
==============================================================================
--- trunk/reactos/tools/widl/proxy.c (original)
+++ trunk/reactos/tools/widl/proxy.c Sun Feb 10 13:10:44 2008
@@ -254,6 +254,7 @@
{
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);
@@ -279,6 +280,9 @@
}
print_proxy( "\n");
+ if (has_full_pointer)
+ write_full_pointer_init(proxy, indent, cur, FALSE);
+
/* FIXME: trace */
clear_output_vars( cur->args );
@@ -325,6 +329,8 @@
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");
@@ -356,6 +362,7 @@
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);
@@ -384,6 +391,8 @@
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 );
@@ -438,6 +447,9 @@
print_proxy("{\n");
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");
Modified: trunk/reactos/tools/widl/server.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/server.c?rev=32…
==============================================================================
--- trunk/reactos/tools/widl/server.c (original)
+++ trunk/reactos/tools/widl/server.c Sun Feb 10 13:10:44 2008
@@ -62,6 +62,7 @@
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);
@@ -125,6 +126,9 @@
print_server("RpcTryExcept\n");
print_server("{\n");
indent++;
+
+ if (has_full_pointer)
+ write_full_pointer_init(server, indent, func, TRUE);
if (func->args)
{
@@ -236,6 +240,9 @@
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");
Modified: trunk/reactos/tools/widl/typegen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.c?rev=3…
==============================================================================
--- trunk/reactos/tools/widl/typegen.c (original)
+++ trunk/reactos/tools/widl/typegen.c Sun Feb 10 13:10:44 2008
@@ -186,6 +186,46 @@
if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
{
if (field->type && type_has_pointers(field->type))
+ return TRUE;
+ }
+ }
+
+ 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;
}
}
@@ -903,6 +943,32 @@
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;
@@ -2126,7 +2192,7 @@
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)
@@ -2724,6 +2790,8 @@
{
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);
Modified: trunk/reactos/tools/widl/typegen.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typegen.h?rev=3…
==============================================================================
--- trunk/reactos/tools/widl/typegen.h (original)
+++ trunk/reactos/tools/widl/typegen.h Sun Feb 10 13:10:44 2008
@@ -60,3 +60,6 @@
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);
Modified: trunk/reactos/tools/widl/typelib_struct.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/typelib_struct.…
==============================================================================
--- trunk/reactos/tools/widl/typelib_struct.h (original)
+++ trunk/reactos/tools/widl/typelib_struct.h Sun Feb 10 13:10:44 2008
@@ -92,16 +92,16 @@
/* 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 */
@@ -119,10 +119,10 @@
/* 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 */
@@ -171,7 +171,7 @@
/* 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
@@ -227,7 +227,7 @@
/* 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
Modified: trunk/reactos/tools/widl/widl_ros.diff
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/widl_ros.diff?r…
==============================================================================
--- trunk/reactos/tools/widl/widl_ros.diff (original)
+++ trunk/reactos/tools/widl/widl_ros.diff Sun Feb 10 13:10:44 2008
@@ -60,34 +60,6 @@
#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)
@@ -123,12 +95,3 @@
#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);
Modified: trunk/reactos/tools/widl/write_msft.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/widl/write_msft.c?re…
==============================================================================
--- trunk/reactos/tools/widl/write_msft.c (original)
+++ trunk/reactos/tools/widl/write_msft.c Sun Feb 10 13:10:44 2008
@@ -1839,6 +1839,9 @@
typeinfo->flags |= 0x10; /* TYPEFLAG_FHIDDEN */
break;
+ case ATTR_LOCAL:
+ break;
+
case ATTR_NONCREATABLE:
typeinfo->flags &= ~0x2; /* TYPEFLAG_FCANCREATE */
break;