A few non-x86 Winelib fixes.
diff --git a/include/wintypes.h b/include/wintypes.h
index 038ad96..e2445b4 100644
--- a/include/wintypes.h
+++ b/include/wintypes.h
@@ -110,10 +110,8 @@
typedef long LONG_PTR;
typedef unsigned long ULONG_PTR;
typedef double DOUBLE;
-#ifdef __i386__
typedef double LONGLONG;
typedef double ULONGLONG;
-#endif /*__i386__*/
/* Integer types. These are the same for emulator and library. */
@@ -396,8 +394,18 @@
#define OFFSETOF(ptr) (LOWORD(ptr))
/* Macros to access unaligned or wrong-endian WORDs and DWORDs. */
+/* Note: These macros are semantically broken, at least for wrc. wrc
+ spits out data in the platform's current binary format, *not* in
+ little-endian format. These macros are used throughout the resource
+ code to load and store data to the resources. Since it is unlikely
+ that we'll ever be dealing with little-endian resource data, the
+ byte-swapping nature of these macros has been disabled. Rather than
+ remove the use of these macros from the resource loading code, the
+ macros have simply been disabled. In the future, someone may want
+ to reactivate these macros for other purposes. In that case, the
+ resource code will have to be modified to use different macros. */
-#ifdef __i386__
+#if 1
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
#define GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
@@ -411,7 +419,7 @@
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
-#endif /* __i386__ */
+#endif /* 1 */
/* MIN and MAX macros */
diff --git a/include/wrc_rsc.h b/include/wrc_rsc.h
index 7abfdf9..5cd0a5b 100644
--- a/include/wrc_rsc.h
+++ b/include/wrc_rsc.h
@@ -27,7 +27,7 @@
INT32 resid; /* The resource id if resname == NULL */
LPSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */
- LPSTR typename;
+ LPSTR restypename;
LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */
} wrc_resource16_t;
@@ -37,7 +37,7 @@
INT32 resid; /* The resource id if resname == NULL */
LPWSTR resname;
INT32 restype; /* The resource type-id if typename == NULL */
- LPWSTR typename;
+ LPWSTR restypename;
LPBYTE data; /* Actual resource data */
UINT32 datasize; /* The size of the resource */
} wrc_resource32_t;
diff --git a/misc/lstr.c b/misc/lstr.c
index 2e1c9d8..4820205 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -543,6 +543,8 @@
DWORD nSize,
LPDWORD args /* va_list *args */
) {
+#ifdef __i386__
+/* This implementation is completely dependant on the format of the va_list on x86 CPUs */
LPSTR target,t;
DWORD talloced;
LPSTR from,f;
@@ -698,6 +700,9 @@
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer):
strlen(lpBuffer);
+#else
+ return 0;
+#endif /* __i386__ */
}
#undef ADD_TO_T
@@ -714,6 +719,8 @@
DWORD nSize,
LPDWORD args /* va_list *args */
) {
+#ifdef __i386__
+/* This implementation is completely dependant on the format of the va_list on x86 CPUs */
LPSTR target,t;
DWORD talloced;
LPSTR from,f;
@@ -870,5 +877,8 @@
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
lstrlen32W(*(LPWSTR*)lpBuffer):
lstrlen32W(lpBuffer);
+#else
+ return 0;
+#endif /* __i386__ */
}
#undef ADD_TO_T
diff --git a/misc/wsprintf.c b/misc/wsprintf.c
index 96b23b4..7947467 100644
--- a/misc/wsprintf.c
+++ b/misc/wsprintf.c
@@ -239,6 +239,29 @@
return len;
}
+/***********************************************************************
+ * WPRINTF_ExtractVAPtr (Not a Windows API)
+ */
+static LPVOID WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list args )
+{
+ switch(format->type)
+ {
+ case WPR_WCHAR:
+ return (LPVOID)va_arg( args, WCHAR );
+ case WPR_CHAR:
+ return (LPVOID)va_arg( args, CHAR );
+ case WPR_STRING:
+ return (LPVOID)va_arg( args, LPCSTR);
+ case WPR_WSTRING:
+ return (LPVOID)va_arg( args, LPCWSTR);
+ case WPR_HEXA:
+ case WPR_SIGNED:
+ case WPR_UNSIGNED:
+ return (LPVOID)va_arg( args, INT32 );
+ default:
+ return NULL;
+ }
+}
/***********************************************************************
* wvsnprintf16 (Not a Windows API)
@@ -344,6 +367,7 @@
LPSTR p = buffer;
UINT32 i, len;
CHAR number[20];
+ LPVOID argPtr = NULL;
while (*spec && (maxlen > 1))
{
@@ -351,29 +375,30 @@
spec++;
if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
spec += WPRINTF_ParseFormatA( spec, &format );
- len = WPRINTF_GetLen( &format, args, number, maxlen - 1 );
+ argPtr = WPRINTF_ExtractVAPtr( &format, args );
+ len = WPRINTF_GetLen( &format, &argPtr, number, maxlen - 1 );
if (!(format.flags & WPRINTF_LEFTALIGN))
for (i = format.precision; i < format.width; i++, maxlen--)
*p++ = ' ';
switch(format.type)
{
case WPR_WCHAR:
- if ((*p = (CHAR)va_arg( args, WCHAR ))) p++;
+ if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_CHAR:
- if ((*p = va_arg( args, CHAR ))) p++;
+ if ((*p = (CHAR)argPtr)) p++;
else if (format.width > 1) *p++ = ' ';
else len = 0;
break;
case WPR_STRING:
- memcpy( p, va_arg( args, LPCSTR ), len );
+ memcpy( p, (LPCSTR)argPtr, len );
p += len;
break;
case WPR_WSTRING:
{
- LPCWSTR ptr = va_arg( args, LPCWSTR );
+ LPCWSTR ptr = (LPCWSTR)argPtr;
for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
}
break;
@@ -393,7 +418,7 @@
for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
memcpy( p, number, len );
p += len;
- (void)va_arg( args, INT32 ); /* Go to the next arg */
+ /* Go to the next arg */
break;
case WPR_UNKNOWN:
continue;
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index 2dbbc89..e5bea37 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -377,6 +377,7 @@
HMODULE32 hModule;
int i;
+#ifdef __i386__
if (!(TRACE_ON(relay) || WARN_ON(relay)))
return;
for (dll = BuiltinDLLs; dll->descr; dll++) {
@@ -402,6 +403,7 @@
}
}
}
+#endif /* __i386__ */
return;
}
diff --git a/relay32/relay386.c b/relay32/relay386.c
index 082c302..a2c8ef4 100644
--- a/relay32/relay386.c
+++ b/relay32/relay386.c
@@ -4,7 +4,6 @@
* Copyright 1997 Alexandre Julliard
*/
-#ifdef __i386__
#include <assert.h>
#include <string.h>
@@ -18,6 +17,7 @@
char **debug_relay_excludelist = NULL, **debug_relay_includelist = NULL;
+#ifdef __i386__
/***********************************************************************
* RELAY_ShowDebugmsgRelay
*
diff --git a/relay32/snoop.c b/relay32/snoop.c
index aac32c8..216ccd4 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -18,10 +18,10 @@
#include "debugstr.h"
#include "debug.h"
-#ifdef __i386__
-
char **debug_snoop_excludelist = NULL, **debug_snoop_includelist = NULL;
+#ifdef __i386__
+
#ifdef NEED_UNDERSCORE_PREFIX
# define PREFIX "_"
#else