Added stdcall64 entry point type to allow correct relay debugging
support for functions that return 64-bit values.

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 622fb24..7f03b23 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -43,6 +43,7 @@
     TYPE_INTERRUPT,    /* interrupt handler function (Win16) */
     TYPE_STUB,         /* unimplemented stub */
     TYPE_STDCALL,      /* stdcall function (Win32) */
+    TYPE_STDCALL64,    /* stdcall function with 64-bit return (Win32) */
     TYPE_CDECL,        /* cdecl function (Win32) */
     TYPE_VARARGS,      /* varargs function (Win32) */
     TYPE_EXTERN,       /* external symbol (Win32) */
@@ -75,7 +76,7 @@
 typedef struct
 {
     int  n_args;
-    char arg_types[32];
+    char arg_types[17];
     char link_name[80];
 } ORD_FUNCTION;
 
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 93332f9..44c3314 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -38,6 +38,7 @@
     "interrupt",    /* TYPE_INTERRUPT */
     "stub",         /* TYPE_STUB */
     "stdcall",      /* TYPE_STDCALL */
+    "stdcall64",    /* TYPE_STDCALL64 */
     "cdecl",        /* TYPE_CDECL */
     "varargs",      /* TYPE_VARARGS */
     "extern",       /* TYPE_EXTERN */
@@ -167,7 +168,7 @@
     switch(SpecType)
     {
     case SPEC_WIN16:
-        if (odp->type == TYPE_STDCALL)
+        if (odp->type == TYPE_STDCALL || odp->type == TYPE_STDCALL64)
             fatal_error( "'stdcall' not supported for Win16\n" );
         if (odp->type == TYPE_VARARGS)
 	    fatal_error( "'varargs' not supported for Win16\n" );
@@ -183,7 +184,7 @@
     token = GetToken();
     if (*token != '(') fatal_error( "Expected '(' got '%s'\n", token );
 
-    for (i = 0; i < sizeof(odp->u.func.arg_types)-1; i++)
+    for (i = 0; i < sizeof(odp->u.func.arg_types); i++)
     {
 	token = GetToken();
 	if (*token == ')')
@@ -206,7 +207,7 @@
         else if (!strcmp(token, "double"))
         {
             odp->u.func.arg_types[i++] = 'l';
-            odp->u.func.arg_types[i] = 'l';
+            if (i < sizeof(odp->u.func.arg_types)) odp->u.func.arg_types[i] = 'l';
         }
         else fatal_error( "Unknown variable type '%s'\n", token );
 
@@ -372,6 +373,7 @@
     case TYPE_PASCAL_16:
     case TYPE_PASCAL:
     case TYPE_STDCALL:
+    case TYPE_STDCALL64:
     case TYPE_VARARGS:
     case TYPE_CDECL:
         ParseExportFunction( odp );
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 413c141..f685a00 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -149,6 +149,7 @@
             fprintf( outfile, "%s", odp->u.ext.link_name );
             break;
         case TYPE_STDCALL:
+        case TYPE_STDCALL64:
         case TYPE_VARARGS:
         case TYPE_CDECL:
             fprintf( outfile, "%s", odp->u.func.link_name);
@@ -220,6 +221,7 @@
         ORDDEF *odp = Ordinals[i];
 
         if (odp && ((odp->type == TYPE_STDCALL) ||
+                    (odp->type == TYPE_STDCALL64) ||
                     (odp->type == TYPE_CDECL) ||
                     (odp->type == TYPE_REGISTER)))
         {
@@ -232,6 +234,9 @@
 
             switch(odp->type)
             {
+            case TYPE_STDCALL64:
+                if (j < 16) mask |= 0x80000000;
+                /* fall through */
             case TYPE_STDCALL:
                 fprintf( outfile, "    { 0xe9, { 0,0,0,0 }, 0xc2, 0x%04x, %s, 0x%08x }",
                          strlen(odp->u.func.arg_types) * sizeof(int),
@@ -310,6 +315,7 @@
             fprintf( outfile, "extern void %s();\n", odp->u.ext.link_name );
             break;
         case TYPE_STDCALL:
+        case TYPE_STDCALL64:
         case TYPE_VARARGS:
         case TYPE_CDECL:
             fprintf( outfile, "extern void %s();\n", odp->u.func.link_name );