---- client.c 2008-09-27 21:56:02.000000000 +0200
-+++ client.c 2008-09-27 20:49:05.000000000 +0200
-@@ -113,7 +113,7 @@
- }
- if (explicit_handle)
- {
-- if (!explicit_handle_var || !explicit_generic_handle_var || !context_handle_var)
-+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
- {
- error("%s() does not define an explicit binding handle!\n", def->name);
- return;
---- hash.c 2008-09-27 21:56:02.000000000 +0200
-+++ hash.c 2008-09-22 00:14:35.703125000 +0200
+diff -u wine-1.3.4/tools/widl/hash.c tools/widl/hash.c
+--- wine-1.3.4/tools/widl/hash.c 2010-09-19 17:48:47.640625000 +0200
++++ tools/widl/hash.c 2010-09-19 19:17:19.000000000 +0200
@@ -21,9 +21,7 @@
#include <stdio.h>
#include <stdarg.h>
-#include "winnls.h"
+#include <host/nls.h>
+ #include "widltypes.h"
#include "hash.h"
-
-@@ -535,6 +533,7 @@
- case LANG_SWEDISH: case LANG_SYRIAC: case LANG_TAMIL:
- case LANG_TATAR: case LANG_TELUGU: case LANG_THAI:
- case LANG_UKRAINIAN: case LANG_URDU: case LANG_UZBEK:
-+#ifndef __REACTOS__
- case LANG_VIETNAMESE: case LANG_GAELIC: case LANG_MALTESE:
- case LANG_TAJIK: case LANG_ROMANSH: case LANG_IRISH:
- case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_SUTU:
-@@ -542,6 +541,12 @@
- case LANG_XHOSA: case LANG_ZULU: case LANG_ESPERANTO:
- case LANG_WALON: case LANG_CORNISH: case LANG_WELSH:
- case LANG_BRETON:
-+#else
-+ case LANG_VIETNAMESE: case LANG_MALTESE: case LANG_IRISH:
-+ case LANG_SAMI: case LANG_UPPER_SORBIAN: case LANG_TSWANA:
-+ case LANG_XHOSA: case LANG_ZULU: case LANG_WELSH:
-+ case LANG_BRETON:
-+#endif
- nOffset = 16;
- pnLookup = Lookup_16;
- break;
---- header.c 2008-09-27 21:56:02.000000000 +0200
-+++ header.c 2008-09-27 20:49:05.000000000 +0200
-@@ -891,6 +891,8 @@
- const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
- int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
- const var_t* explicit_handle_var;
-+ const var_t* explicit_generic_handle_var = NULL;
-+ const var_t* context_handle_var = NULL;
- const func_t *cur;
- int prefixes_differ = strcmp(prefix_client, prefix_server);
-
-@@ -901,8 +903,14 @@
-
- /* check for a defined binding handle */
- explicit_handle_var = get_explicit_handle_var(cur);
-+ if (!explicit_handle_var)
-+ {
-+ explicit_generic_handle_var = get_explicit_generic_handle_var(cur);
-+ if (!explicit_generic_handle_var)
-+ context_handle_var = get_context_handle_var(cur);
-+ }
- if (explicit_handle) {
-- if (!explicit_handle_var) {
-+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var) {
- error("%s() does not define an explicit binding handle!\n", def->name);
- return;
- }
---- header.h 2008-09-27 21:56:02.000000000 +0200
-+++ header.h 2008-09-23 21:14:50.781250000 +0200
-@@ -66,6 +66,7 @@
- extern const var_t* get_explicit_handle_var(const func_t* func);
- extern const type_t* get_explicit_generic_handle_type(const var_t* var);
- extern const var_t* get_explicit_generic_handle_var(const func_t* func);
-+extern const var_t* get_context_handle_var(const func_t* func);
- extern int has_out_arg_or_return(const func_t *func);
- extern void write_guid(FILE *f, const char *guid_prefix, const char *name,
- const UUID *uuid);
-@@ -88,11 +89,19 @@
-
- static inline int is_context_handle(const type_t *type)
- {
-- const type_t *t;
-- for (t = type; is_ptr(t); t = t->ref)
-- if (is_attr(t->attrs, ATTR_CONTEXTHANDLE))
-+ if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
-+ return 1;
+diff -u wine-1.3.4/tools/widl/parser.y tools/widl/parser.y
+--- wine-1.3.4/tools/widl/parser.y 2010-09-19 17:49:40.578125000 +0200
++++ tools/widl/parser.y 2010-10-03 16:44:18.781250000 +0200
+@@ -1816,6 +1816,12 @@
+ else if (is_attr(attrs, ATTR_UUID) && !is_attr(attrs, ATTR_PUBLIC))
+ attrs = append_attr( attrs, make_attr(ATTR_PUBLIC) );
+
++ /* Append the SWITCHTYPE attribute to a union if it does not already have one. */
++ if (type_get_type_detect_alias(type) == TYPE_UNION &&
++ is_attr(attrs, ATTR_SWITCHTYPE) &&
++ !is_attr(type->attrs, ATTR_SWITCHTYPE))
++ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
+
-+ for (;;)
-+ {
-+ if (is_attr(type->attrs, ATTR_CONTEXTHANDLE))
- return 1;
-- return 0;
-+ else if (type->kind == TKIND_ALIAS)
-+ type = type->orig;
-+ else if (is_ptr(type))
-+ type = type->ref;
-+ else return 0;
-+ }
- }
-
- #endif
---- proxy.c 2008-09-27 21:56:02.000000000 +0200
-+++ proxy.c 2008-09-27 20:49:05.000000000 +0200
-@@ -463,41 +463,45 @@
- print_proxy("\n");
- }
-
--static int write_proxy_methods(type_t *iface)
-+static int write_proxy_methods(type_t *iface, int skip)
- {
- const func_t *cur;
- int i = 0;
-
-- if (iface->ref) i = write_proxy_methods(iface->ref);
-+ if (iface->ref) i = write_proxy_methods(iface->ref, iface->ref->ref != NULL);
- if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
- var_t *def = cur->def;
- if (!is_callas(def->attrs)) {
- if (i) fprintf(proxy, ",\n");
-- print_proxy( "%s_", iface->name);
-+ print_proxy( "%s%s_", skip ? "0\t/* " : "", iface->name);
- write_name(proxy, def);
-- fprintf(proxy, "_Proxy");
-+ fprintf(proxy, "_Proxy%s", skip ? " */" : "");
- i++;
- }
- }
- return i;
- }
-
--static int write_stub_methods(type_t *iface)
-+static int write_stub_methods(type_t *iface, int skip)
- {
- const func_t *cur;
- int i = 0;
-
-- if (iface->ref) i = write_stub_methods(iface->ref);
-+ if (iface->ref) i = write_stub_methods(iface->ref, TRUE);
- else return i; /* skip IUnknown */
+ LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
+ {
- if (iface->funcs) LIST_FOR_EACH_ENTRY( cur, iface->funcs, const func_t, entry ) {
- var_t *def = cur->def;
- if (!is_local(def->attrs)) {
-- if (i) fprintf(proxy,",\n");
-- print_proxy( "%s_", iface->name);
-- write_name(proxy, def);
-- fprintf(proxy, "_Stub");
-- i++;
-+ if (skip)
-+ print_proxy("STUB_FORWARDING_FUNCTION,\n");
-+ else {
-+ if (i) fprintf(proxy,",\n");
-+ print_proxy( "%s_", iface->name);
-+ write_name(proxy, def);
-+ fprintf(proxy, "_Stub");
-+ i++;
-+ }
- }
- }
- return i;
-@@ -551,7 +555,7 @@
- print_proxy( "},\n");
- print_proxy( "{\n");
- indent++;
-- write_proxy_methods(iface);
-+ write_proxy_methods(iface, FALSE);
- fprintf(proxy, "\n");
- indent--;
- print_proxy( "}\n");
-@@ -563,7 +567,7 @@
- print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
- print_proxy( "{\n");
- indent++;
-- stubs = write_stub_methods(iface);
-+ stubs = write_stub_methods(iface, FALSE);
- fprintf(proxy, "\n");
- indent--;
- fprintf(proxy, "};\n");
---- server.c 2008-09-27 21:56:02.000000000 +0200
-+++ server.c 2008-09-27 20:49:05.000000000 +0200
-@@ -60,13 +60,21 @@
- LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
- {
- const var_t *def = func->def;
-+ const var_t* context_handle_var = NULL;
-+ const var_t* explicit_generic_handle_var = NULL;
- int has_full_pointer = is_full_pointer_function(func);
-
- /* check for a defined binding handle */
- explicit_handle_var = get_explicit_handle_var(func);
-+ if (!explicit_handle_var)
-+ {
-+ explicit_generic_handle_var = get_explicit_generic_handle_var(func);
-+ if (!explicit_generic_handle_var)
-+ context_handle_var = get_context_handle_var(func);
-+ }
- if (explicit_handle)
- {
-- if (!explicit_handle_var)
-+ if (!explicit_handle_var && !explicit_generic_handle_var && !context_handle_var)
- {
- error("%s() does not define an explicit binding handle!\n", def->name);
- return;
-@@ -399,6 +407,7 @@
- print_server("/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
- print_server("#include <string.h>\n");
- fprintf(server, "\n");
-+ print_server("#define _SEH_NO_NATIVE_NLG\n");
- print_server("#include \"%s\"\n", header_name);
- fprintf(server, "\n");
- }
---- typelib.c 2008-09-27 21:56:02.000000000 +0200
-+++ typelib.c 2008-09-27 20:49:05.000000000 +0200
+diff -u wine-1.3.4/tools/widl/typelib.c tools/widl/typelib.c
+--- wine-1.3.4/tools/widl/typelib.c 2010-09-19 17:50:24.000000000 +0200
++++ tools/widl/typelib.c 2010-09-26 20:23:47.000000000 +0200
@@ -35,8 +35,7 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "widl.h"
#include "utils.h"
-@@ -360,10 +359,10 @@
-
- file_name = wpp_find_include(importlib->name, NULL);
- if(file_name) {
-- fd = open(file_name, O_RDONLY);
-+ fd = open(file_name, O_RDONLY | O_BINARY);
- free(file_name);
- }else {
-- fd = open(importlib->name, O_RDONLY);
-+ fd = open(importlib->name, O_RDONLY | O_BINARY);
- }
-
- if(fd < 0)
---- typelib_struct.h 2008-09-27 21:56:02.000000000 +0200
-+++ typelib_struct.h 2008-09-22 00:14:35.703125000 +0200
-@@ -302,7 +302,7 @@
- *
- */
-
--#include "pshpack1.h"
-+#include <host/pshpack1.h>
-
- typedef struct {
- /*00*/ DWORD SLTG_magic; /* 0x47544c53 == "SLTG" */
-@@ -599,7 +599,7 @@
- WORD typeofarray
- */
-
--#include "poppack.h"
-+#include <host/poppack.h>
-
- /*---------------------------END--------------------------------------------*/
- #endif
---- widl.c 2008-09-27 21:56:02.000000000 +0200
-+++ widl.c 2008-09-27 20:49:05.000000000 +0200
-@@ -174,7 +174,7 @@
- token = xstrdup(name);
- for (i=0; token[i]; i++) {
- if (!isalnum(token[i])) token[i] = '_';
-- else token[i] = toupper(token[i]);
-+ else token[i] = tolower(token[i]);
- }
- return token;
- }
-@@ -561,8 +561,8 @@
- fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
- fprintf(header, "#include <rpc.h>\n" );
- fprintf(header, "#include <rpcndr.h>\n\n" );
-- fprintf(header, "#ifndef __WIDL_%s\n", header_token);
-- fprintf(header, "#define __WIDL_%s\n", header_token);
-+ fprintf(header, "#ifndef __%s__\n", header_token);
-+ fprintf(header, "#define __%s__\n", header_token);
- start_cplusplus_guard(header);
- }
-
-@@ -607,7 +607,7 @@
- fprintf(header, "/* End additional prototypes */\n");
- fprintf(header, "\n");
- end_cplusplus_guard(header);
-- fprintf(header, "#endif /* __WIDL_%s */\n", header_token);
-+ fprintf(header, "#endif /* __%s__ */\n", header_token);
- fclose(header);
- }
-
---- widltypes.h 2008-09-27 21:56:02.000000000 +0200
-+++ widltypes.h 2008-09-26 19:42:52.859375000 +0200
+diff -u wine-1.3.4/tools/widl/widltypes.h tools/widl/widltypes.h
+--- wine-1.3.4/tools/widl/widltypes.h 2010-09-19 17:51:38.890625000 +0200
++++ tools/widl/widltypes.h 2010-09-19 19:17:19.656250000 +0200
@@ -21,6 +21,13 @@
#ifndef __WIDL_WIDLTYPES_H
#define __WIDL_WIDLTYPES_H
+#define max(a, b) ((a) > (b) ? a : b)
+
#include <stdarg.h>
+ #include <assert.h>
#include "guiddef.h"
- #include "wine/rpcfc.h"
-@@ -31,7 +38,9 @@
+@@ -32,7 +39,9 @@
typedef GUID UUID;
#endif
+#endif
#define FALSE 0
- #define RPC_FC_FUNCTION 0xfe
---- write_msft.c 2008-09-27 21:56:02.000000000 +0200
-+++ write_msft.c 2008-09-27 20:49:05.000000000 +0200
+ typedef struct _loc_info_t loc_info_t;
+diff -u wine-1.3.4/tools/widl/write_msft.c tools/widl/write_msft.c
+--- wine-1.3.4/tools/widl/write_msft.c 2010-09-19 17:51:48.531250000 +0200
++++ tools/widl/write_msft.c 2010-09-26 20:23:47.000000000 +0200
@@ -40,10 +40,8 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
+#include <host/typedefs.h>
+#include <host/nls.h>
- #include "widltypes.h"
+ #include "widl.h"
#include "typelib.h"