changeset 1307:d8c1b0b38edc

Add prototypes to wine/loader stuff, so that we can catch __stdcall function attribute mismatch between caller/caller. wine/loader is less sensitive to optimization now. (now that avifile-0.6 has the same patch installed, we're a bit closer to their CVS tree) Speed up win32 "QueryPerformanceFrequency" emulation on solaris.
author jkeil
date Thu, 12 Jul 2001 15:27:48 +0000
parents 7ce37211e454
children ffd63a75700c
files loader/Makefile loader/afl.c loader/config.h loader/driver.c loader/driver.h loader/elfdll.c loader/ext.c loader/ext.h loader/loader.h loader/module.c loader/pe_image.c loader/pe_resource.c loader/registry.c loader/resource.c loader/setup_FS.c loader/setup_FS.h loader/vfl.c loader/win32.c loader/win32.h loader/wine/config.h loader/wine/vfw.h
diffstat 21 files changed, 534 insertions(+), 698 deletions(-) [+]
line wrap: on
line diff
--- a/loader/Makefile	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/Makefile	Thu Jul 12 15:27:48 2001 +0000
@@ -1,18 +1,25 @@
 include ../config.mak
 
 # Generated automatically from Makefile.in by configure.
-DEFINES=-rdynamic -fPIC $(WIN32_PATH) $(CDOPT) -D__WINE__ -Ddbg_printf=__vprintf \
+DEFINES=$(WIN32_PATH) -D__WINE__ -Ddbg_printf=__vprintf \
 	-DTRACE=__vprintf # -DDETAILED_OUT
 
 LIB_OBJECTS= setup_FS.o pe_image.o module.o \
 ext.o win32.o driver.o pe_resource.o \
 resource.o registry.o elfdll.o afl.o vfl.o
 
-CFLAGS=-g -I.
+# gcc-3.0 produces buggy code for acmStreamOpen() with
+# "-O3 -fomit-frame-pointer" or "-O2 -fomit-frame-pointer
+# -finline-functions -frename-registers" (code is OK with sole -O2),
+# the bad code accesses parameters via %ebp without setting up a
+# propper %ebp first!
+# -fno-omit-frame-pointer works around this gcc-3.0 bug.  gcc-2.95.2 is OK.
+WARN_FLAGS = -Wmissing-prototypes -Wimplicit-function-declaration
+CFLAGS=-I. -I.. $(OPTFLAGS) $(EXTRA_INC) $(WARN_FLAGS) -fno-omit-frame-pointer
+#CFLAGS=-I. -I.. -O $(WARN_FLAGS) -g #-fno-omit-frame-pointer
 
-CDOPT=-g
 all: libloader.a
-    
+
 clean:
 	-rm -f *.o libloader.a
 
--- a/loader/afl.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/afl.c	Thu Jul 12 15:27:48 2001 +0000
@@ -22,8 +22,11 @@
 #include <config.h>
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
+#include "win32.h"
+
 #include <wine/winbase.h>
 #include <wine/windef.h>
 #include <wine/winuser.h>
@@ -34,11 +37,13 @@
 #include <wine/msacm.h>
 #include <wine/msacmdrv.h>
 #include "wineacm.h"
-#pragma pack(1)
+#include "ext.h"
+#include "driver.h"
+
 #define OpenDriverA DrvOpen
-extern HDRVR VFWAPI DrvOpen(long);
 #define CloseDriver DrvClose
-extern HDRVR VFWAPI DrvClose(long);
+
+#pragma pack(1)
 
 static PWINE_ACMSTREAM	ACM_GetStream(HACMSTREAM has)
 {
@@ -394,6 +399,8 @@
     int			wfxSrcSize;
     int			wfxDstSize;
     
+    //printf("gcc-3.0 bug, pwfxSrc=%p, pwfxSrc->cbSize=%d\n", pwfxSrc, pwfxSrc->cbSize);
+
     TRACE("(%p, 0x%08x, %p, %p, %p, %ld, %ld, %ld)\n",
 	  phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
 
--- a/loader/config.h	Thu Jul 12 15:23:26 2001 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-
-/* include/config.h.  Generated automatically by configure.  */
-/* include/config.h.in.  Generated automatically from configure.in by autoheader.  */
-#define USE_SDL 1
-/* #undef QUIET */
-/* #undef TIMING */
-/* #undef DETAILED_OUT */
-#define MMX 1
-#define HAVE_LIBXXF86DGA 1
-#define HAVE_LIBXXF86VM 1
-#define USE_TSC 1
-
-/* Define to empty if the keyword does not work.  */
-/* #undef const */
-
-/* Define if you don't have vprintf but do have _doprnt.  */
-/* #undef HAVE_DOPRNT */
-
-/* Define if you have a working `mmap' system call.  */
-#define HAVE_MMAP 1
-
-/* Define if you have the vprintf function.  */
-#define HAVE_VPRINTF 1
-
-/* Define as __inline if that's what the C compiler calls it.  */
-/* #undef inline */
-
-/* Define as the return type of signal handlers (int or void).  */
-#define RETSIGTYPE void
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
-
-/* Define if you can safely include both <sys/time.h> and <time.h>.  */
-#define TIME_WITH_SYS_TIME 1
-
-/* Define if you have the ftime function.  */
-#define HAVE_FTIME 1
-
-/* Define if you have the getpagesize function.  */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the gettimeofday function.  */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the strdup function.  */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strstr function.  */
-#define HAVE_STRSTR 1
-
-/* Define if you have the <fcntl.h> header file.  */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <limits.h> header file.  */
-#define HAVE_LIMITS_H 1
-
-/* Define if you have the <malloc.h> header file.  */
-#define HAVE_MALLOC_H 1
-
-/* Define if you have the <sys/ioctl.h> header file.  */
-#define HAVE_SYS_IOCTL_H 1
-
-/* Define if you have the <sys/time.h> header file.  */
-#define HAVE_SYS_TIME_H 1
-
-/* Define if you have the <unistd.h> header file.  */
-#define HAVE_UNISTD_H 1
-
-/* Define if you have the dl library (-ldl).  */
-#define HAVE_LIBDL 1
-
-/* Define if you have the jpeg library (-ljpeg).  */
-#define HAVE_LIBJPEG 1
--- a/loader/driver.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/driver.c	Thu Jul 12 15:27:48 2001 +0000
@@ -1,29 +1,38 @@
 #include <config.h>
 #include <stdio.h>
-
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
-#else
+#endif
 #include <stdlib.h>
+#ifdef __FreeBSD__
+#include <sys/time.h>
 #endif
 
+#include <win32.h>
 #include <wine/driver.h>
 #include <wine/pe_image.h>
 #include <wine/winreg.h>
 #include <wine/vfw.h>
 #include <registry.h>
-
-//#include "com.h"
-//typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**);
+#include <setup_FS.h>
+#include "driver.h"
 
 
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#endif
-
-
+#if 1
+/*
+ * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to
+ * WINAPI/no-WINAPI bustage.
+ *
+ * There should be no need for the STORE_ALL/REST_ALL hack once all 
+ * function definitions agree with their prototypes (WINAPI-wise) and
+ * we make sure, that we do not call these functions without a proper
+ * prototype in scope.
+ */
+#define	STORE_ALL	/**/
+#define	REST_ALL	/**/
+#else
 #define STORE_ALL \
-    __asm__ ( \
+    __asm__( \
     "push %%ebx\n\t" \
     "push %%ecx\n\t" \
     "push %%edx\n\t" \
@@ -31,25 +40,16 @@
     "push %%edi\n\t"::)
 
 #define REST_ALL \
-    __asm__ ( \
+    __asm__( \
     "pop %%edi\n\t" \
     "pop %%esi\n\t" \
     "pop %%edx\n\t" \
     "pop %%ecx\n\t" \
     "pop %%ebx\n\t"::)
+#endif
 
 
 
-typedef struct {
-    UINT             uDriverSignature;
-    HINSTANCE        hDriverModule;
-    DRIVERPROC       DriverProc;
-    DWORD            dwDriverID;
-} DRVR;
-
-typedef DRVR  *PDRVR;
-typedef DRVR  *NPDRVR;
-typedef DRVR  *LPDRVR;
     
 static DWORD dwDrvID = 0;
 
@@ -119,10 +119,9 @@
 }
 
 
-extern char* def_path; //=WIN32_PATH;    // path to codecs
 char* win32_codec_name=NULL;  // must be set before calling DrvOpen() !!!
 
-HDRVR
+HDRVR VFWAPI
 DrvOpen(LPARAM lParam2)
 {
     ICOPEN *icopen=(ICOPEN *) lParam2;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loader/driver.h	Thu Jul 12 15:27:48 2001 +0000
@@ -0,0 +1,11 @@
+
+#ifndef loader_driver_h
+#define	loader_driver_h
+
+#include <wine/windef.h>
+#include <wine/vfw.h>
+
+extern HDRVR VFWAPI DrvOpen(LPARAM lParam2);
+extern void DrvClose(HDRVR hdrvr);
+
+#endif
--- a/loader/elfdll.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/elfdll.c	Thu Jul 12 15:27:48 2001 +0000
@@ -9,9 +9,9 @@
 
 #include <string.h>
 #include <ctype.h>
+#include <stdio.h>
 #include <stdlib.h>
 
-#include <wine/config.h>
 #include <wine/windef.h>
 //#include <wine/global.h>
 //#include <wine/process.h>
--- a/loader/ext.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/ext.c	Thu Jul 12 15:27:48 2001 +0000
@@ -6,10 +6,10 @@
  *
  ********************************************************/
 #include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
 #ifdef HAVE_MALLOC_H
 #include <malloc.h>
-#else
-#include <stdlib.h>
 #endif
 #include <unistd.h>
 #include <sys/mman.h>
@@ -18,7 +18,11 @@
 #include <string.h>
 #include <stdarg.h>
 #include <wine/windef.h>
-//#include <wine/winbase.h>
+#include <wine/winbase.h>
+#include <wine/debugtools.h>
+#include <wine/heap.h>
+#include "ext.h"
+
 int dbg_header_err( const char *dbg_channel, const char *func )
 {
     return 0; 
@@ -35,7 +39,7 @@
 {
     return 0; 
 }
-int dbg_vprintf( const char *format, ... )
+int dbg_vprintf( const char *format, va_list args )
 {
     return 0; 
 }
@@ -50,12 +54,12 @@
     return 0; 
 }
     
-int GetProcessHeap()
+HANDLE WINAPI GetProcessHeap(void)
 {
     return 1;
 }
 
-void* HeapAlloc(int heap, int flags, int size)
+LPVOID WINAPI HeapAlloc(HANDLE heap, DWORD flags, DWORD size)
 {
     if(flags & 0x8)
 	return calloc(size, 1);
@@ -63,7 +67,7 @@
 	return malloc(size);
 }
 
-int HeapFree(int heap, int flags, void* mem)
+WIN_BOOL WINAPI HeapFree(HANDLE heap, DWORD flags,LPVOID mem)
 {
     if (mem) free(mem);
     return 1;
@@ -71,34 +75,34 @@
 
 static int last_error;
 
-int GetLastError()
+DWORD WINAPI GetLastError(void)
 {
     return last_error;
 }
 
-int SetLastError(int error)
+VOID WINAPI SetLastError(DWORD error)
 { 
-    return last_error=error;
+    last_error = error;
 }    
 
-int ReadFile(int handle, void* mem, unsigned long size, long* result, long flags)
+WIN_BOOL WINAPI ReadFile(HANDLE handle,LPVOID mem, DWORD size, LPDWORD result, LPOVERLAPPED flags)
 {
     *result=read(handle, mem, size);
     return *result;
 }    
-int lstrcmpiA(const char* c1, const char* c2)
+int WINAPI lstrcmpiA(const char* c1, const char* c2)
 {
     return strcasecmp(c1,c2);
 }
-int lstrcpynA(char* dest, const char* src, int num)
+LPSTR WINAPI lstrcpynA(LPSTR dest, LPCSTR src, INT num)
 {
-    return strncmp(dest,src,num);
+    return strncpy(dest,src,num);
 }
-int lstrlenA(const char* s)
+int WINAPI lstrlenA(const char* s)
 {
     return strlen(s);
 }   
-int lstrlenW(const short* s)
+INT WINAPI lstrlenW(LPCWSTR s)
 {
     int l;
     if(!s)
@@ -108,8 +112,9 @@
 	l++;
      return l;
 }
-int lstrcpynWtoA(char* dest, const char* src, int count)
+LPSTR WINAPI lstrcpynWtoA(LPSTR dest, LPCWSTR src, INT count)
 {
+    LPSTR rval = dest;
     int moved=0;
     if((dest==0) || (src==0))
 	return 0;
@@ -118,10 +123,11 @@
         *dest=*src;
 	moved++;
 	if(*src==0)
-	    return moved;
+	    break;
 	src++;
 	dest++;
     }
+    return rval;
 }
 int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n)
 {
@@ -147,7 +153,7 @@
 }			
 		
 		
-int IsBadReadPtr(void* data, int size)
+WIN_BOOL WINAPI IsBadReadPtr(LPCVOID data, UINT size)
 {
     if(size==0)
 	return 0;
@@ -155,14 +161,14 @@
         return 1;
     return 0;
 }   
-char* HEAP_strdupA(const char* string)
+LPSTR HEAP_strdupA(HANDLE heap, DWORD flags, LPCSTR string)
 {
 //    return strdup(string);
     char* answ=malloc(strlen(string)+1);
     strcpy(answ, string);
     return answ;
 }
-short* HEAP_strdupAtoW(void* heap, void* hz, const char* string)
+LPWSTR HEAP_strdupAtoW(HANDLE heap, DWORD flags, LPCSTR string)
 {
     int size, i;
     short* answer;
@@ -174,7 +180,7 @@
 	answer[i]=(short)string[i];
     return answer;	
 }
-char* HEAP_strdupWtoA(void* heap, void* hz, const short* string)
+LPSTR HEAP_strdupWtoA(HANDLE heap, DWORD flags, LPCWSTR string)
 {
     int size, i;
     char* answer;
@@ -322,9 +328,12 @@
 #define	PAGE_GUARD		0x100
 #define	PAGE_NOCACHE		0x200
 
-HANDLE CreateFileMappingA(int hFile, void* lpAttr,
-DWORD flProtect, DWORD dwMaxHigh, DWORD dwMaxLow, const char* name)
+HANDLE WINAPI CreateFileMappingA(HANDLE handle, LPSECURITY_ATTRIBUTES lpAttr,
+				 DWORD flProtect,
+				 DWORD dwMaxHigh, DWORD dwMaxLow,
+				 LPCSTR name)
 {
+    int hFile = (int)handle;
     unsigned int len;
     HANDLE answer;
     int anon=0;
@@ -381,7 +390,7 @@
     }
     return (HANDLE)0;
 }        
-int UnmapViewOfFile(HANDLE handle)
+WIN_BOOL WINAPI UnmapViewOfFile(LPVOID handle)
 {
     file_mapping* p;
     int result;
@@ -389,7 +398,7 @@
 	return (HANDLE)0;
     for(p=fm; p; p=p->next)
     {
-	if(p->handle==handle)
+	if(p->handle==(HANDLE)handle)
 	{
 	    result=munmap((void*)handle, p->mapping_size);
 	    if(p->next)p->next->prev=p->prev;
@@ -418,7 +427,7 @@
 #define MEM_COMMIT              0x00001000
 #define MEM_RESERVE             0x00002000
 
-void* VirtualAlloc(void* address, DWORD size, DWORD type,  DWORD protection)
+void* WINAPI VirtualAlloc(void* address, DWORD size, DWORD type,  DWORD protection)
 {
     void* answer;
     int fd=open("/dev/zero", O_RDWR);
@@ -488,7 +497,7 @@
         return answer;
     }	
 }    	
-int VirtualFree(void*  address, int t1, int t2)//not sure
+WIN_BOOL WINAPI VirtualFree(LPVOID address, DWORD t1, DWORD t2)//not sure
 {
     virt_alloc* str=vm;
     int answer;
@@ -509,8 +518,10 @@
     return -1;
 }
 
-int WideCharToMultiByte(unsigned int codepage, long flags, const short* src,
-     int srclen,char* dest, int destlen, const char* defch, int* used_defch)
+INT WINAPI WideCharToMultiByte(UINT codepage, DWORD flags, 
+			       LPCWSTR src, INT srclen,
+			       LPSTR dest, INT destlen,
+			       LPCSTR defch, WIN_BOOL*used_defch)
 {
     int i;
     if(src==0)
@@ -541,12 +552,13 @@
     }	    
     return min(srclen, destlen);
 }
-int MultiByteToWideChar(unsigned int codepage,long flags, const char* src, int srclen,
-    short* dest, int destlen)
+INT WINAPI MultiByteToWideChar(UINT codepage, DWORD flags,
+			       LPCSTR src, INT srclen,
+			       LPWSTR dest, INT destlen)
 {
     return 0;
 }
-HANDLE OpenFileMappingA(long access, long prot, char* name)
+HANDLE WINAPI OpenFileMappingA(DWORD access, WIN_BOOL prot, LPCSTR name)
 {
     file_mapping* p;
     if(fm==0)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loader/ext.h	Thu Jul 12 15:27:48 2001 +0000
@@ -0,0 +1,15 @@
+
+#ifndef loader_ext_h
+#define loader_ext_h
+
+#include <wine/windef.h>
+
+extern LPVOID FILE_dommap( int unix_handle, LPVOID start,
+			   DWORD size_high, DWORD size_low,
+			   DWORD offset_high, DWORD offset_low,
+			   int prot, int flags );
+extern int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low );
+extern int wcsnicmp(const unsigned short* s1, const unsigned short* s2, int n);
+extern int __vprintf( const char *format, ... );
+
+#endif
--- a/loader/loader.h	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/loader.h	Thu Jul 12 15:27:48 2001 +0000
@@ -279,7 +279,8 @@
 );
 void MSACM_RegisterAllDrivers(void);
 
-int WINAPI LoadStringA(long instance, long  id, void* buf, long size);
+INT WINAPI LoadStringA( HINSTANCE instance, UINT resource_id,
+                            LPSTR buffer, INT buflen );
 
 #ifdef __cplusplus
 }
--- a/loader/module.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/module.c	Thu Jul 12 15:27:48 2001 +0000
@@ -15,6 +15,11 @@
 
 #include <sys/mman.h>
 #include <sys/types.h>
+#ifdef HAVE_LIBDL
+#include <wine/elfdll.h>
+#include <dlfcn.h>
+#endif
+
 /*
 #ifdef __linux__
 #include <asm/unistd.h>
@@ -48,6 +53,7 @@
 #include <wine/module.h>
 #include <wine/pe_image.h>
 #include <wine/debugtools.h>
+#include "win32.h"
 
 struct modref_list_t;
 
@@ -79,7 +85,7 @@
     return list->wm;
 }    
 
-void MODULE_RemoveFromList(WINE_MODREF *mod)
+static void MODULE_RemoveFromList(WINE_MODREF *mod)
 {
     modref_list* list=local_wm;
     if(list==0)
@@ -478,7 +484,7 @@
 	return retproc;
 #ifdef HAVE_LIBDL	
     case MODULE32_ELF:
-	retproc = (FARPROC) dlsym( wm->module, function);
+	retproc = (FARPROC) dlsym( (void*)wm->module, function);
 	if (!retproc) SetLastError(ERROR_PROC_NOT_FOUND);
 	return retproc;
 #endif
--- a/loader/pe_image.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/pe_image.c	Thu Jul 12 15:27:48 2001 +0000
@@ -34,16 +34,19 @@
  *   to 4096 byte boundaries on disk.
  */
 #include <config.h>
-#include <wine/config.h>
 
 #include <errno.h>
 #include <assert.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
@@ -54,6 +57,7 @@
 #include <wine/pe_image.h>
 #include <wine/module.h>
 #include <wine/debugtools.h>
+#include <ext.h>
 
 #include "win32.h"
 
@@ -64,7 +68,7 @@
 extern void* LookupExternal(const char* library, int ordinal);
 extern void* LookupExternalByName(const char* library, const char* name);
 
-void dump_exports( HMODULE hModule )
+static void dump_exports( HMODULE hModule )
 { 
   char		*Module;
   int		i, j;
@@ -236,7 +240,7 @@
 	}
 }
 
-DWORD fixup_imports( WINE_MODREF *wm )
+static DWORD fixup_imports( WINE_MODREF *wm )
 {
     IMAGE_IMPORT_DESCRIPTOR	*pe_imp;
     PE_MODREF			*pem;
@@ -561,7 +565,6 @@
         }
     }
 
-
     
     load_addr = nt->OptionalHeader.ImageBase;
     vma_size = calc_vma_size( hModule );
@@ -881,17 +884,26 @@
  * due to the PROCESS_Create stuff.
  */
 
+#if	0
+/*
+ * so this is a dirty hack.
+ * Why do we need it?
+ *
+ * Disable it for now, let's see if it breaks something
+ */
+static void This_Is_Dirty_Hack(void)
+{
+    void* mem=alloca(0x20000);
+    *(int*)mem=0x1234;
+}
+#endif
+
+
 /* Called if the library is loaded or freed.
  * NOTE: if a thread attaches a DLL, the current thread will only do
  * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH
  * (SDK)
  */
-extern void This_Is_Dirty_Hack()
-{
-    void* mem=alloca(0x20000);
-    *(int*)mem=0x1234;
-}
-
 WIN_BOOL PE_InitDLL( WINE_MODREF *wm, DWORD type, LPVOID lpReserved )
 {
     WIN_BOOL retv = TRUE;
@@ -927,7 +939,9 @@
 		break;
 	}	
 	TRACE("for %s\n", wm->filename);
+#if 0
 	This_Is_Dirty_Hack();
+#endif
         retv = entry( wm->module, type, lpReserved );
     }
 
--- a/loader/pe_resource.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/pe_resource.c	Thu Jul 12 15:27:48 2001 +0000
@@ -22,6 +22,7 @@
 //#include "process.h"
 //#include "stackframe.h"
 #include <wine/debugtools.h>
+#include <ext.h>
 
 /**********************************************************************
  *  HMODULE32toPE_MODREF 
--- a/loader/registry.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/registry.c	Thu Jul 12 15:27:48 2001 +0000
@@ -1,7 +1,9 @@
 #include <config.h>
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <pwd.h>
 #include <sys/types.h>
 
@@ -11,6 +13,8 @@
 #include <wine/winerror.h>
 
 #include <registry.h>
+#include <ext.h>
+
 //#undef TRACE
 //#define TRACE printf
 struct reg_value
@@ -40,14 +44,14 @@
 
 extern char *get_path(char *);
 
-static void create_registry();
-static void open_registry();
-static void save_registry();
+static void create_registry(void);
+static void open_registry(void);
+static void save_registry(void);
 
 
 
 
-static void create_registry(){
+static void create_registry(void){
     if(regs)
     {
 	printf("Logic error: create_registry() called with existing registry\n");
@@ -65,7 +69,7 @@
     reg_size=2;
     save_registry();
 }
-static void open_registry()
+static void open_registry(void)
 {
 	int fd;
 	int i;
@@ -120,7 +124,7 @@
 	return;
 }
 
-static void save_registry()
+static void save_registry(void)
 {
 	int fd, i, len;
 //         struct passwd* pwent;
@@ -227,7 +231,7 @@
 	strcat(full_name, subkey);
 	return full_name;
 }
-struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len)
+static struct reg_value* insert_reg_value(int handle, const char* name, int type, const void* value, int len)
 {
 	reg_handle_t* t;
 	struct reg_value* v;
@@ -263,7 +267,7 @@
 	return v;
 }
 
-static void init_registry()
+static void init_registry(void)
 {
 #ifdef DETAILED_OUT
 	printf("Initializing registry\n");
--- a/loader/resource.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/resource.c	Thu Jul 12 15:27:48 2001 +0000
@@ -7,6 +7,7 @@
 #include <config.h>
 
 #include <assert.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -20,6 +21,8 @@
 #include <wine/module.h>
 #include <wine/debugtools.h>
 #include <wine/winerror.h>
+#include <loader.h>
+
 #define CP_ACP					0
 
 WORD WINE_LanguageId=0x409;//english
--- a/loader/setup_FS.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/setup_FS.c	Thu Jul 12 15:27:48 2001 +0000
@@ -10,7 +10,7 @@
 #ifdef __linux__
 #include <asm/unistd.h>
 #include <asm/ldt.h>
-#else
+#else /* !__linux__ */
 
 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
 #include <machine/sysarch.h>
@@ -22,7 +22,9 @@
 /* solaris x86: add missing prototype for sysi86() */
 extern int sysi86(int, void*);
 #define       TEB_SEL_IDX     NUMSYSLDTS
-#endif
+#endif /* __svr4__ */
+
+
 
 #define LDT_ENTRIES     8192
 #define LDT_ENTRY_SIZE  8
@@ -42,7 +44,10 @@
 #define MODIFY_LDT_CONTENTS_DATA        0
 #define MODIFY_LDT_CONTENTS_STACK       1
 #define MODIFY_LDT_CONTENTS_CODE        2
-#endif
+#endif /* !__linux__ */
+
+#include "setup_FS.h"
+
 
 
 /* user level (privilege level: 3) ldt (1<<2) segment selector */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/loader/setup_FS.h	Thu Jul 12 15:27:48 2001 +0000
@@ -0,0 +1,10 @@
+
+#ifndef setup_FS_h
+#define setup_FS_h
+
+extern void setup_FS_Segment(void);
+extern void Setup_LDT_Keeper(void);
+extern void Restore_LDT_Keeper(void);
+
+
+#endif
--- a/loader/vfl.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/vfl.c	Thu Jul 12 15:27:48 2001 +0000
@@ -6,6 +6,9 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "win32.h"
+#include "loader.h"
+
 #include "wine/winbase.h"
 #include "wine/windef.h"
 #include "wine/winuser.h"
@@ -13,29 +16,31 @@
 #include "wine/winestring.h"
 #include "wine/driver.h"
 #include "wine/avifmt.h"
+#include "driver.h"
+
 
 #define FIXME_(X) printf
 #define FIXME printf
 
+#define OpenDriverA DrvOpen
+#define CloseDriver DrvClose
+
 long VFWAPI VideoForWindowsVersion(void);
 
-extern void* my_mreq(int size, int to_zero);
-extern      void DrvClose(HDRVR hdrvr);
-extern int my_release(void* memory);
 
-long VFWAPIV ICDecompress(HIC hic,long dwFlags,LPBITMAPINFOHEADER lpbiFormat,void* lpData,LPBITMAPINFOHEADER lpbi,void* lpBits);
-
-WIN_BOOL VFWAPI	ICInfo(long fccType, long fccHandler, ICINFO * lpicinfo);
-LRESULT	VFWAPI	ICGetInfo(HIC hic,ICINFO *picinfo, long cb);
-HIC	VFWAPI	ICOpen(long fccType, long fccHandler, UINT wMode);
-HIC	VFWAPI	ICOpenFunction(long fccType, long fccHandler, unsigned int wMode, void* lpfnHandler);
-
-LRESULT VFWAPI ICClose(HIC hic);
-LRESULT	VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
-HIC	VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
-
-#define OpenDriverA DrvOpen
-extern HDRVR VFWAPI DrvOpen(long);
+#if 1
+/*
+ * STORE_ALL/REST_ALL seems like an attempt to workaround problems due to
+ * WINAPI/no-WINAPI bustage.
+ *
+ * There should be no need for the STORE_ALL/REST_ALL hack once all 
+ * function definitions agree with their prototypes (WINAPI-wise) and
+ * we make sure, that we do not call these functions without a proper
+ * prototype in scope.
+ */
+#define	STORE_ALL	/**/
+#define	REST_ALL	/**/
+#else
 #define STORE_ALL \
     __asm__ ( \
     "push %%ebx\n\t" \
@@ -51,14 +56,8 @@
     "pop %%edx\n\t" \
     "pop %%ecx\n\t" \
     "pop %%ebx\n\t"::)
-
+#endif
 
-typedef struct {
-    unsigned int               uDriverSignature;
-    void*        hDriverModule;
-    DRIVERPROC        DriverProc;
-    long                dwDriverID;
-} DRVR;
 
 /***********************************************************************
  *		VideoForWindowsVersion		[MSVFW.2][MSVIDEO.2]
@@ -351,7 +350,9 @@
 	WINE_HIC	*whic = (WINE_HIC*)hic;
 	char qw[200];
 
+#if 0
     __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));    
+#endif
     STORE_ALL;	
         /*__asm__
 	(
@@ -362,7 +363,9 @@
         );*/
     	ret = whic->driverproc(whic->private,1,msg,lParam1,lParam2);
     REST_ALL;	
+#if 0
     __asm__ __volatile__ ("frstor (%0)\n\t": :"r"(&qw));    
+#endif
 //	} else
 
 //		ret = SendDriverMessage(whic->hdrv,msg,lParam1,lParam2);
--- a/loader/win32.c	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/win32.c	Thu Jul 12 15:27:48 2001 +0000
@@ -28,6 +28,9 @@
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/timeb.h>
+#if HAVE_LIBKSTAT
+#include <kstat.h>
+#endif
 
 #include <wine/winbase.h>
 #include <wine/winreg.h>
@@ -77,8 +80,6 @@
     "popl %%ebx\n\t"
     ::"a"(z));
 }    
-#include <sys/time.h>
-#include <unistd.h>
 static unsigned int c_localcount_notsc()
 {
     struct timeval tv;
@@ -100,12 +101,13 @@
     result+=limit*tv.tv_usec;
     *z=result;
 }
-static unsigned int localcount_stub();
-static void longcount_stub(long long*);
+
+static unsigned int localcount_stub(void);
+static void longcount_stub(long long* z);
 static unsigned int (*localcount)()=localcount_stub;
 static void (*longcount)(long long*)=longcount_stub;
 
-static unsigned int localcount_stub()
+static unsigned int localcount_stub(void)
 {
     unsigned int regs[4];
     do_cpuid(regs);
@@ -139,7 +141,7 @@
 }
 
 int LOADER_DEBUG=1;
-inline void dbgprintf(char* fmt, ...)
+static inline void dbgprintf(char* fmt, ...)
 {
 #ifdef DETAILED_OUT
     if(LOADER_DEBUG)
@@ -168,7 +170,7 @@
 
 static unsigned char* heap=NULL; 
 static int heap_counter=0;
-void test_heap()
+static void test_heap()
 {
     int offset=0;	
     if(heap==0)
@@ -326,7 +328,7 @@
 char extcode[20000];// place for 200 unresolved exports
 int pos=0;
 
-int WINAPI ext_unknown()
+int WINAPI ext_unknown(void)
 {
     printf("Unknown func called\n");
     return 0;
@@ -403,18 +405,13 @@
     return 0;
 }    
 
-typedef struct {
-    unsigned int     	uDriverSignature;
-    void*        	hDriverModule;
-    void*    		DriverProc;
-    unsigned int        dwDriverID;
-} DRVR;
-
 void* WINAPI expGetDriverModuleHandle(DRVR* pdrv)
 {
     void* result;
-    if (pdrv==NULL) result=NULL;
-    result=pdrv->hDriverModule;
+    if (pdrv==NULL)
+	result=NULL;
+    else
+	result=(void*) pdrv->hDriverModule;
     dbgprintf("GetDriverModuleHandle(0x%x) => 0x%x\n", pdrv, result);
     return result;
 }
@@ -992,15 +989,14 @@
     dbgprintf("GetCurrentProcess() => %d\n", getpid());
     return getpid();
 }                  
-struct tls_s;
-typedef struct tls_s
+
+struct tls_s
 {
     void* value;
     int used;
     struct tls_s* prev;
     struct tls_s* next;
-}tls_t;
-
+};
 tls_t* g_tls=NULL;    
     
 void* WINAPI expTlsAlloc()
@@ -1131,12 +1127,12 @@
     result=i;
     }
     if(s1)
-    dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s',
-	size %d, dest buffer 0x%x, dest size %d) => %d\n",
+    dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string 0x%x='%s', "
+	"size %d, dest buffer 0x%x, dest size %d) => %d\n",
 	    v1, v2, s1, s1, siz1, s2, siz2, result);
     else
-    dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL,
-	size %d, dest buffer 0x%x, dest size %d) =>\n",
+    dbgprintf("MultiByteToWideChar(codepage %d, flags 0x%x, string NULL, "
+	"size %d, dest buffer 0x%x, dest size %d) =>\n",
 	    v1, v2, siz1, s2, siz2, result);
     return result;
 }
@@ -1305,7 +1301,86 @@
     return 1; 
 }
 
-static double old_freq()
+/*
+ * return CPU clock (in kHz), using linux's /proc filesystem (/proc/cpuinfo)
+ */
+static double linux_cpuinfo_freq()
+{
+    double freq=-1;
+    FILE *f;
+    char line[200];
+    char *s,*value;
+	
+    f = fopen ("/proc/cpuinfo", "r");
+    if (f != NULL) {
+	while (fgets(line,sizeof(line),f)!=NULL) {
+	    /* NOTE: the ':' is the only character we can rely on */
+	    if (!(value = strchr(line,':')))
+		continue;
+	    /* terminate the valuename */
+	    *value++ = '\0';
+	    /* skip any leading spaces */
+	    while (*value==' ') value++;
+	    if ((s=strchr(value,'\n')))
+		*s='\0';
+
+	    if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))
+		&& sscanf(value, "%lf", &freq) == 1) {
+		freq*=1000;
+		break;
+	    }		
+	}
+	fclose(f);
+    }
+    return freq;
+}
+
+
+static double
+solaris_kstat_freq()
+{
+#if	HAVE_LIBKSTAT
+    /*
+     * try to extract the CPU speed from the solaris kernel's kstat data
+     */
+    kstat_ctl_t   *kc;
+    kstat_t       *ksp;
+    kstat_named_t *kdata;
+    int            mhz = 0;
+
+    kc = kstat_open();
+    if (kc != NULL)
+    {
+	ksp = kstat_lookup(kc, "cpu_info", 0, "cpu_info0");
+
+	/* kstat found and name/value pairs? */
+	if (ksp != NULL && ksp->ks_type == KSTAT_TYPE_NAMED)
+	{
+	    /* read the kstat data from the kernel */
+	    if (kstat_read(kc, ksp, NULL) != -1)
+	    {
+		/*
+		 * lookup desired "clock_MHz" entry, check the expected
+		 * data type
+		 */
+		kdata = (kstat_named_t *)kstat_data_lookup(ksp, "clock_MHz");
+		if (kdata != NULL && kdata->data_type == KSTAT_DATA_INT32)
+		    mhz = kdata->value.i32;
+	    }
+	}
+	kstat_close(kc);
+    }
+
+    if (mhz > 0)
+	return mhz * 1000.;
+#endif	/* HAVE_LIBKSTAT */
+    return -1;		// kstat stuff is not available, CPU freq is unknown
+}
+
+/*
+ * Measure CPU freq using the pentium's time stamp counter register (TSC)
+ */
+static double tsc_freq()
 {
     static double ofreq=0.0;
     int i;
@@ -1320,48 +1395,18 @@
     ofreq = (double)(y-x)/1000.;
     return ofreq;
 }
+
 static double CPU_Freq()
 {
-//#ifdef USE_TSC
-	FILE *f = fopen ("/proc/cpuinfo", "r");
-	char line[200];
-	char model[200]="unknown";
-	char flags[500]="";
-	char	*s,*value;
-	double freq=-1;
+    double freq;
 	
-	if (!f)
-	{
-	    //printf("Can't open /proc/cpuinfo for reading\n");
-	    return old_freq();
-	}    
-	while (fgets(line,200,f)!=NULL) 
-	{
-		/* NOTE: the ':' is the only character we can rely on */
-		if (!(value = strchr(line,':')))
-			continue;
-		/* terminate the valuename */
-		*value++ = '\0';
-		/* skip any leading spaces */
-		while (*value==' ') value++;
-		if ((s=strchr(value,'\n')))
-			*s='\0';
+    if ((freq = linux_cpuinfo_freq()) > 0)
+	return freq;
 
-		if (!strncasecmp(line, "cpu MHz",strlen("cpu MHz"))) 
-		{
-		    sscanf(value, "%lf", &freq);
-		    freq*=1000;
-		    break;
-		}
-		continue;
-		
-	}
-	fclose(f);
-	if(freq<0)return old_freq();
+    if ((freq = solaris_kstat_freq()) > 0)
 	return freq;
-//#else
-//	return old_freq();
-//#endif    	
+
+    return tsc_freq();	
 }
 
 long WINAPI expQueryPerformanceFrequency(long long* z)
@@ -1658,12 +1703,12 @@
 {
     long result=CreateFileMappingA(hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name);
     if(!name)
-    dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, 
-	flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n",
+    dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, "
+	"flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0) => %d\n",
 	    hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, result);
     else
-    dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, 
-	flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n",
+    dbgprintf("CreateFileMappingA(file 0x%x, lpAttr 0x%x, "
+	"flProtect 0x%x, dwMaxHigh 0x%x, dwMaxLow 0x%x, name 0x%x='%s') => %d\n",
 	    hFile, lpAttr, flProtect, dwMaxHigh, dwMaxLow, name, name, result);    
     return result;
 }    
@@ -2746,7 +2791,7 @@
 //    return (void*)ext_unknown;
 }
 
-int my_garbagecollection()
+int my_garbagecollection(void)
 {
 #ifdef GARBAGE
     alc_list* pp,*ppsv;
--- a/loader/win32.h	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/win32.h	Thu Jul 12 15:27:48 2001 +0000
@@ -1,1 +1,210 @@
-int ext_unknown();
+#ifndef loader_win32_h
+#define loader_win32_h
+
+#include <time.h>
+
+#include <wine/windef.h>
+#include <wine/winbase.h>
+#include <com.h>
+
+extern void* my_mreq(int size, int to_zero);
+extern int my_release(void* memory);
+extern int my_size(char* memory);
+extern int my_garbagecollection(void);
+
+
+typedef struct {
+    UINT             uDriverSignature;
+    HINSTANCE        hDriverModule;
+    DRIVERPROC       DriverProc;
+    DWORD            dwDriverID;
+} DRVR;
+
+typedef DRVR  *PDRVR;
+typedef DRVR  *NPDRVR;
+typedef DRVR  *LPDRVR;
+
+typedef struct tls_s tls_t;
+
+extern int WINAPI ext_unknown(void);
+
+extern int WINAPI expIsBadWritePtr(void* ptr, unsigned int count);
+extern int WINAPI expIsBadReadPtr(void* ptr, unsigned int count);
+extern int WINAPI expDisableThreadLibraryCalls(int module);
+extern void* WINAPI expGetDriverModuleHandle(DRVR* pdrv);
+extern void* WINAPI expGetModuleHandleA(const char* name);
+extern void* WINAPI expCreateThread(void* pSecAttr, long dwStackSize, void* lpStartAddress,
+				    void* lpParameter, long dwFlags, long* dwThreadId);
+extern void* WINAPI expCreateEventA(void* pSecAttr, char bManualReset,
+				    char bInitialState, const char* name);
+extern void* WINAPI expSetEvent(void* event);
+extern void* WINAPI expResetEvent(void* event);
+extern void* WINAPI expWaitForSingleObject(void* object, int duration);
+extern WIN_BOOL WINAPI expIsProcessorFeaturePresent(DWORD v);
+extern void WINAPI expGetSystemInfo(SYSTEM_INFO* si);
+extern long WINAPI expGetVersion(void);
+long WINAPI expGetVersionExA(OSVERSIONINFOA* c);
+extern HANDLE WINAPI expHeapCreate(long flags, long init_size, long max_size);
+extern void* WINAPI expHeapAlloc(HANDLE heap, int flags, int size);
+extern long WINAPI expHeapDestroy(void* heap);
+extern long WINAPI expHeapFree(int arg1, int arg2, void* ptr);
+extern long WINAPI expHeapSize(int heap, int flags, void* pointer);
+extern long WINAPI expGetProcessHeap(void);
+extern void* WINAPI expVirtualAlloc(void* v1, long v2, long v3, long v4);
+extern int WINAPI expVirtualFree(void* v1, int v2, int v3);
+extern void WINAPI expInitializeCriticalSection(CRITICAL_SECTION* c);
+extern void WINAPI expEnterCriticalSection(CRITICAL_SECTION* c);
+extern void WINAPI expLeaveCriticalSection(CRITICAL_SECTION* c);
+extern void WINAPI expDeleteCriticalSection(CRITICAL_SECTION *c);
+extern int WINAPI expGetCurrentThreadId(void);
+extern int WINAPI expGetCurrentProcess(void);
+extern void* WINAPI expTlsAlloc(void);
+extern int WINAPI expTlsSetValue(tls_t* index, void* value);
+extern void* WINAPI expTlsGetValue(tls_t* index);
+extern int WINAPI expTlsFree(tls_t* index);
+extern void* WINAPI expLocalAlloc(int flags, int size);
+extern void* WINAPI expLocalLock(void* z);
+extern void* WINAPI expGlobalAlloc(int flags, int size);
+extern void* WINAPI expGlobalLock(void* z);
+extern int WINAPI expLoadStringA(long instance, long  id, void* buf, long size);
+extern long WINAPI expMultiByteToWideChar(long v1, long v2, char* s1, long siz1, short* s2, int siz2);
+extern long WINAPI expWideCharToMultiByte(long v1, long v2, short* s1, long siz1, char* s2, int siz2, char* c3, int* siz3);
+extern long WINAPI expGetVersionExA(OSVERSIONINFOA* c);
+extern HANDLE WINAPI expCreateSemaphoreA(char* v1, long init_count, long max_count, char* name);
+extern long WINAPI expReleaseSemaphore(long hsem, long increment, long* prev_count);
+extern long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey);
+extern long WINAPI expRegCloseKey(long key);
+
+extern long WINAPI expRegQueryValueExA(long key, const char* value, int* reserved, int* type, int* data, int* count);
+extern long WINAPI expRegCreateKeyExA(long key, const char* name, long reserved,
+				      void* classs, long options, long security,
+				      void* sec_attr, int* newkey, int* status);
+extern long WINAPI expRegSetValueExA(long key, const char* name, long v1, long v2, void* data, long size);
+extern long WINAPI expRegOpenKeyA (long hKey, LPCSTR lpSubKey, int* phkResult);
+extern long WINAPI expQueryPerformanceCounter(long long* z);
+extern long WINAPI expQueryPerformanceFrequency(long long* z);
+extern long WINAPI exptimeGetTime(void);
+extern void* WINAPI expLocalHandle(void* v);
+extern void* WINAPI expGlobalHandle(void* v);
+extern int WINAPI expGlobalUnlock(void* v);
+extern void* WINAPI expGlobalFree(void* v);
+extern void* WINAPI expGlobalReAlloc(void* v, int size, int flags);
+extern int WINAPI expLocalUnlock(void* v);
+extern void* WINAPI expLocalFree(void* v);
+extern HRSRC WINAPI expFindResourceA(HMODULE module, char* name, char* type);
+extern HGLOBAL WINAPI expLoadResource(HMODULE module, HRSRC res);
+extern void* WINAPI expLockResource(long res);
+extern int WINAPI expFreeResource(long res);
+extern int WINAPI expCloseHandle(long v1);
+extern const char* WINAPI expGetCommandLineA(void);
+extern LPWSTR WINAPI expGetEnvironmentStringsW(void);
+extern void * WINAPI expRtlZeroMemory(void *p, size_t len);
+extern void * WINAPI expRtlMoveMemory(void *dst, void *src, size_t len);
+extern void * WINAPI expRtlFillMemory(void *p, int ch, size_t len);
+extern int WINAPI expFreeEnvironmentStringsW(short* strings);
+extern int WINAPI expFreeEnvironmentStringsA(char* strings);
+extern LPWSTR WINAPI expGetEnvironmentStringsW(void);
+LPCSTR WINAPI expGetEnvironmentStrings(void);
+extern int WINAPI expGetStartupInfoA(STARTUPINFOA *s);
+extern int WINAPI expGetStdHandle(int z);
+extern int WINAPI expGetFileType(int handle);
+extern int WINAPI expSetHandleCount(int count);
+extern int WINAPI expGetACP(void);
+extern int WINAPI expGetModuleFileNameA(int module, char* s, int len);
+extern int WINAPI expSetUnhandledExceptionFilter(void* filter);
+extern int WINAPI expLoadLibraryA(char* name);
+extern int WINAPI expFreeLibrary(int module);
+extern void* WINAPI expGetProcAddress(HMODULE mod, char* name);
+extern long WINAPI expCreateFileMappingA(int hFile, void* lpAttr,
+					 long flProtect, long dwMaxHigh, long dwMaxLow, const char* name);
+extern long WINAPI expOpenFileMappingA(long hFile, long hz, const char* name);
+extern void* WINAPI expMapViewOfFile(HANDLE file, DWORD mode, DWORD offHigh, DWORD offLow, DWORD size);
+extern void* WINAPI expUnmapViewOfFile(void* view);
+extern void* WINAPI expSleep(int time);
+extern void* WINAPI expCreateCompatibleDC(int hdc);
+extern int WINAPI expGetDeviceCaps(int hdc, int unk);
+extern WIN_BOOL WINAPI expDeleteDC(int hdc);
+extern int WINAPI expGetPrivateProfileIntA(const char* appname, const char* keyname, int default_value, const char* filename);
+extern int WINAPI expGetProfileIntA(const char* appname, const char* keyname, int default_value);
+extern int WINAPI expGetPrivateProfileStringA(const char* appname, const char* keyname,
+					      const char* def_val, char* dest, unsigned int len, const char* filename);
+extern int WINAPI expWritePrivateProfileStringA(const char* appname, const char* keyname,
+						const char* string, const char* filename);
+extern int WINAPI expDefDriverProc(int _private, int id, int msg, int arg1, int arg2);
+extern int WINAPI expSizeofResource(int v1, int v2);
+extern int WINAPI expGetLastError(void);
+extern void WINAPI expSetLastError(int error);
+extern long WINAPI exptimeGetTime(void);
+extern int WINAPI expStringFromGUID2(GUID* guid, char* str, int cbMax);
+extern int WINAPI expGetFileVersionInfoSizeA(const char* name, int* lpHandle);
+extern int WINAPI expIsBadStringPtrW(const short* string, int nchars);
+extern int WINAPI expIsBadStringPtrA(const char* string, int nchars);
+extern long WINAPI expInterlockedIncrement( long* dest );
+extern long WINAPI expInterlockedDecrement( long* dest );
+extern void WINAPI expOutputDebugStringA( const char* string );
+extern int WINAPI expGetDC(int hwnd);
+extern int WINAPI expGetDesktopWindow(void);
+extern int WINAPI expReleaseDC(int hwnd, int hdc);
+extern int WINAPI expLoadCursorA(int handle,LPCSTR name);
+extern int WINAPI expSetCursor(void *cursor);
+extern int WINAPI expGetSystemPaletteEntries(int hdc, int iStartIndex, int nEntries, void* lppe);
+extern int WINAPI expGetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation);
+extern void WINAPI expGetLocalTime(SYSTEMTIME* systime);
+extern int WINAPI expGetSystemTime(SYSTEMTIME* systime);
+extern int WINAPI expGetEnvironmentVariableA(const char* name, char* field, int size);
+extern void* WINAPI expCoTaskMemAlloc(ULONG cb);
+extern void WINAPI expCoTaskMemFree(void* cb);
+extern long WINAPI expCoCreateInstance(GUID* rclsid, struct IUnknown* pUnkOuter,
+				       long dwClsContext, GUID* riid, void** ppv);
+extern int WINAPI expIsRectEmpty(CONST RECT *lprc);
+extern unsigned int WINAPI expGetTempPathA(unsigned int len, char* path);
+extern HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd);
+extern WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA p);
+extern WIN_BOOL WINAPI expFindClose(HANDLE h);
+extern UINT WINAPI expSetErrorMode(UINT i);
+extern UINT      WINAPI expGetWindowsDirectoryA(LPSTR s,UINT c);
+extern WIN_BOOL  WINAPI expDeleteFileA(LPCSTR s);
+extern WIN_BOOL  WINAPI expFileTimeToLocalFileTime(const FILETIME* cpf, LPFILETIME pf);
+extern UINT WINAPI expGetTempFileNameA(LPCSTR cs1,LPCSTR cs2,UINT i,LPSTR ps);
+extern HANDLE WINAPI expCreateFileA(LPCSTR cs1,DWORD i1,DWORD i2,
+				    LPSECURITY_ATTRIBUTES p1, DWORD i3,DWORD i4,HANDLE i5);
+extern LPCSTR WINAPI expGetSystemDirectoryA(void);
+extern WIN_BOOL WINAPI expReadFile(HANDLE h,LPVOID pv,DWORD size,LPDWORD rd,LPOVERLAPPED unused);
+extern WIN_BOOL WINAPI expWriteFile(HANDLE h,LPCVOID pv,DWORD size,LPDWORD wr,LPOVERLAPPED unused);
+extern DWORD  WINAPI expSetFilePointer(HANDLE h, LONG val, LPLONG ext, DWORD whence);
+extern HDRVR WINAPI expOpenDriverA(LPCSTR szDriverName, LPCSTR szSectionName,
+				   LPARAM lParam2);
+HDRVR WINAPI expOpenDriver(LPCSTR szDriverName, LPCSTR szSectionName,
+			   LPARAM lParam2) ;
+extern WIN_BOOL WINAPI expGetProcessAffinityMask(HANDLE hProcess,
+						 LPDWORD lpProcessAffinityMask,
+						 LPDWORD lpSystemAffinityMask);
+extern  DWORD WINAPI expRegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
+				       LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count );
+extern INT WINAPI expMulDiv(int nNumber,int nNumerator,int nDenominator);
+extern LONG WINAPI explstrcmpiA(const char* str1, const char* str2);
+extern LONG WINAPI explstrlenA(const char* str1);
+extern LONG WINAPI explstrcpyA(char* str1, const char* str2);
+extern LONG WINAPI expInterlockedExchange(long *dest, long l);
+
+extern void* CDECL expmalloc(int size);
+extern void CDECL expfree(void* mem);
+extern void* CDECL expnew(int size);
+extern int CDECL expdelete(void* memory);
+extern int CDECL exp_initterm(int v1, int v2);
+
+extern int expwsprintfA(char* string, char* format, ...);
+extern char* expstrrchr(char* string, int value);
+extern char* expstrchr(char* string, int value);
+extern int expstrlen(char* str);
+extern int expstrcpy(char* str1, const char* str2);
+extern int expstrcmp(const char* str1, const char* str2);
+extern int expstrcat(char* str1, const char* str2);
+extern int expisalnum(int c);
+extern int expmemmove(void* dest, void* src, int n);
+extern int expmemcmp(void* dest, void* src, int n);
+extern void *expmemcpy(void* dest, void* src, int n) ;
+extern time_t exptime(time_t* t);
+extern void* LookupExternal(const char* library, int ordinal);
+
+#endif
--- a/loader/wine/config.h	Thu Jul 12 15:23:26 2001 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-/* include/config.h.  Generated automatically by configure.  */
-/* include/config.h.in.  Generated automatically from configure.in by autoheader.  */
-
-/* Define if using alloca.c.  */
-/* #undef C_ALLOCA */
-
-/* Define to empty if the keyword does not work.  */
-/* #undef const */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
-   This function is required for alloca.c support on those systems.  */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define if you have alloca, as a function or macro.  */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
-#define HAVE_ALLOCA_H 1
-
-/* Define as __inline if that's what the C compiler calls it.  */
-/* #undef inline */
-
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
-/* #undef STAT_MACROS_BROKEN */
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
-
-/* Define if your processor stores words with the most significant
-   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
-/* #undef WORDS_BIGENDIAN */
-
-/* Define if the X Window System is missing or not being used.  */
-/* #undef X_DISPLAY_MISSING */
-
-/* Define if symbols declared in assembly code need an underscore prefix */
-/* #undef NEED_UNDERSCORE_PREFIX */
-
-/* Define to use .string instead of .ascii */
-#define HAVE_ASM_STRING 1
-
-/* Define if struct msghdr contains msg_accrights */
-/* #undef HAVE_MSGHDR_ACCRIGHTS */
-
-/* Define if struct sockaddr_un contains sun_len */
-/* #undef HAVE_SOCKADDR_SUN_LEN */
-
-/* Define if you have the Xxf86dga library (-lXxf86dga).  */
-#define HAVE_LIBXXF86DGA 1
-
-/* Define if you have the Xxf86dga library version 2.0 (-lXxf86dga).  */
-/* #undef HAVE_LIBXXF86DGA2 */
-
-/* Define if you have the X Shm extension */
-#define HAVE_LIBXXSHM 1
-
-/* Define if you have the Xxf86vm library */
-#define HAVE_LIBXXF86VM 1
-
-/* Define if you have the Xpm library */
-#define HAVE_LIBXXPM 1
-
-/* Define if you have the Open Sound system.  */
-#define HAVE_OSS 1
-
-/* Define if you have the Open Sound system (MIDI interface).  */
-#define HAVE_OSS_MIDI 1
-
-/* Define if X libraries are not reentrant (compiled without -D_REENTRANT).  */
-/* #undef NO_REENTRANT_X11 */
-
-/* Define if libc is not reentrant  */
-/* #undef NO_REENTRANT_LIBC */
-
-/* Define if libc uses __errno_location for reentrant errno */
-#define HAVE__ERRNO_LOCATION 1
-
-/* Define if libc uses __error for reentrant errno */
-/* #undef HAVE__ERROR */
-
-/* Define if libc uses ___errno for reentrant errno */
-/* #undef HAVE___ERRNO */
-
-/* Define if libc uses __thr_errno for reentrant errno */
-/* #undef HAVE__THR_ERRNO */
-
-/* Define if all debug messages are to be compiled out */
-/* #undef NO_DEBUG_MSGS */
-
-/* Define if TRACE messages are to be compiled out */
-/* #undef NO_TRACE_MSGS */
-
-/* Define if the struct statfs has the member bavail */
-#define STATFS_HAS_BAVAIL 1
-
-/* Define if the struct statfs has the member bfree */
-#define STATFS_HAS_BFREE 1
-
-/* Define if the struct statfs is defined by <sys/vfs.h> */
-#define STATFS_DEFINED_BY_SYS_VFS 1
-
-/* Define if the struct statfs is defined by <sys/statfs.h> */
-#define STATFS_DEFINED_BY_SYS_STATFS 1
-
-/* Define if the struct statfs is defined by <sys/mount.h> */
-/* #undef STATFS_DEFINED_BY_SYS_MOUNT */
-
-/* Define if ncurses have the new resizeterm function */
-#define HAVE_RESIZETERM 1
-
-/* Define if ncurses have the new getbkgd function */
-#define HAVE_GETBKGD 1
-
-/* Define if IPX should use netipx/ipx.h from libc */
-#define HAVE_IPX_GNU 1
-
-/* Define if IPX includes are taken from Linux kernel */
-/* #undef HAVE_IPX_LINUX */
-
-/* Define if Mesa is present on the system or not */
-/* #undef HAVE_LIBMESAGL */
-
-/* Define if the system has dynamic link library support with the dl* API */
-#define HAVE_DL_API 1
-
-/* Define if <linux/joystick.h> defines the Linux 2.2 joystick API */
-#define HAVE_LINUX_22_JOYSTICK_API 1
-
-/* Define if the OpenGL implementation supports the GL_EXT_color_table extension */
-/* #undef HAVE_GL_COLOR_TABLE */
-
-/* Define if the OpenGL implementation supports the GL_EXT_paletted_texture extension */
-/* #undef HAVE_GL_PALETTED_TEXTURE */
-
-/* The number of bytes in a long long.  */
-#define SIZEOF_LONG_LONG 8
-
-/* Define if you have the __libc_fork function.  */
-/* #undef HAVE___LIBC_FORK */
-
-/* Define if you have the _lwp_create function.  */
-/* #undef HAVE__LWP_CREATE */
-
-/* Define if you have the clone function.  */
-#define HAVE_CLONE 1
-
-/* Define if you have the connect function.  */
-#define HAVE_CONNECT 1
-
-/* Define if you have the dlopen function.  */
-/* #undef HAVE_DLOPEN */
-
-/* Define if you have the gethostbyname function.  */
-#define HAVE_GETHOSTBYNAME 1
-
-/* Define if you have the getnetbyaddr function.  */
-#define HAVE_GETNETBYADDR 1
-
-/* Define if you have the getnetbyname function.  */
-#define HAVE_GETNETBYNAME 1
-
-/* Define if you have the getpagesize function.  */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the getprotobyname function.  */
-#define HAVE_GETPROTOBYNAME 1
-
-/* Define if you have the getprotobynumber function.  */
-#define HAVE_GETPROTOBYNUMBER 1
-
-/* Define if you have the getservbyport function.  */
-#define HAVE_GETSERVBYPORT 1
-
-/* Define if you have the getsockopt function.  */
-#define HAVE_GETSOCKOPT 1
-
-/* Define if you have the inet_network function.  */
-#define HAVE_INET_NETWORK 1
-
-/* Define if you have the memmove function.  */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the openpty function.  */
-#define HAVE_OPENPTY 1
-
-/* Define if you have the rfork function.  */
-/* #undef HAVE_RFORK */
-
-/* Define if you have the select function.  */
-#define HAVE_SELECT 1
-
-/* Define if you have the sendmsg function.  */
-#define HAVE_SENDMSG 1
-
-/* Define if you have the settimeofday function.  */
-#define HAVE_SETTIMEOFDAY 1
-
-/* Define if you have the sigaltstack function.  */
-#define HAVE_SIGALTSTACK 1
-
-/* Define if you have the statfs function.  */
-#define HAVE_STATFS 1
-
-/* Define if you have the strcasecmp function.  */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strerror function.  */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strncasecmp function.  */
-#define HAVE_STRNCASECMP 1
-
-/* Define if you have the tcgetattr function.  */
-#define HAVE_TCGETATTR 1
-
-/* Define if you have the timegm function.  */
-#define HAVE_TIMEGM 1
-
-/* Define if you have the usleep function.  */
-#define HAVE_USLEEP 1
-
-/* Define if you have the vfscanf function.  */
-#define HAVE_VFSCANF 1
-
-/* Define if you have the wait4 function.  */
-#define HAVE_WAIT4 1
-
-/* Define if you have the waitpid function.  */
-#define HAVE_WAITPID 1
-
-/* Define if you have the <GL/gl.h> header file.  */
-/* #undef HAVE_GL_GL_H */
-
-/* Define if you have the <GL/glx.h> header file.  */
-/* #undef HAVE_GL_GLX_H */
-
-/* Define if you have the <X11/Xlib.h> header file.  */
-#define HAVE_X11_XLIB_H 1
-
-/* Define if you have the <X11/extensions/XShm.h> header file.  */
-#define HAVE_X11_EXTENSIONS_XSHM_H 1
-
-/* Define if you have the <X11/extensions/xf86dga.h> header file.  */
-#define HAVE_X11_EXTENSIONS_XF86DGA_H 1
-
-/* Define if you have the <X11/extensions/xf86vmode.h> header file.  */
-#define HAVE_X11_EXTENSIONS_XF86VMODE_H 1
-
-/* Define if you have the <X11/xpm.h> header file.  */
-#define HAVE_X11_XPM_H 1
-
-/* Define if you have the <a.out.h> header file.  */
-#define HAVE_A_OUT_H 1
-
-/* Define if you have the <a_out.h> header file.  */
-#define HAVE_A_OUT_H 1
-
-/* Define if you have the <arpa/inet.h> header file.  */
-#define HAVE_ARPA_INET_H 1
-
-/* Define if you have the <arpa/nameser.h> header file.  */
-#define HAVE_ARPA_NAMESER_H 1
-
-/* Define if you have the <curses.h> header file.  */
-/* #undef HAVE_CURSES_H */
-
-/* Define if you have the <dlfcn.h> header file.  */
-#define HAVE_DLFCN_H 1
-
-/* Define if you have the <elf.h> header file.  */
-#define HAVE_ELF_H 1
-
-/* Define if you have the <float.h> header file.  */
-#define HAVE_FLOAT_H 1
-
-/* Define if you have the <libio.h> header file.  */
-#define HAVE_LIBIO_H 1
-
-/* Define if you have the <link.h> header file.  */
-#define HAVE_LINK_H 1
-
-/* Define if you have the <linux/cdrom.h> header file.  */
-#define HAVE_LINUX_CDROM_H 1
-
-/* Define if you have the <linux/joystick.h> header file.  */
-#define HAVE_LINUX_JOYSTICK_H 1
-
-/* Define if you have the <linux/ucdrom.h> header file.  */
-/* #undef HAVE_LINUX_UCDROM_H */
-
-/* Define if you have the <machine/soundcard.h> header file.  */
-/* #undef HAVE_MACHINE_SOUNDCARD_H */
-
-/* Define if you have the <ncurses.h> header file.  */
-#define HAVE_NCURSES_H 1
-
-/* Define if you have the <net/if.h> header file.  */
-#define HAVE_NET_IF_H 1
-
-/* Define if you have the <netinet/in.h> header file.  */
-#define HAVE_NETINET_IN_H 1
-
-/* Define if you have the <netinet/tcp.h> header file.  */
-#define HAVE_NETINET_TCP_H 1
-
-/* Define if you have the <pty.h> header file.  */
-#define HAVE_PTY_H 1
-
-/* Define if you have the <resolv.h> header file.  */
-#define HAVE_RESOLV_H 1
-
-/* Define if you have the <sched.h> header file.  */
-#define HAVE_SCHED_H 1
-
-/* Define if you have the <socket.h> header file.  */
-/* #undef HAVE_SOCKET_H */
-
-/* Define if you have the <soundcard.h> header file.  */
-/* #undef HAVE_SOUNDCARD_H */
-
-/* Define if you have the <strings.h> header file.  */
-#define HAVE_STRINGS_H 1
-
-/* Define if you have the <sys/cdio.h> header file.  */
-/* #undef HAVE_SYS_CDIO_H */
-
-/* Define if you have the <sys/errno.h> header file.  */
-#define HAVE_SYS_ERRNO_H 1
-
-/* Define if you have the <sys/file.h> header file.  */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/filio.h> header file.  */
-/* #undef HAVE_SYS_FILIO_H */
-
-/* Define if you have the <sys/ipc.h> header file.  */
-#define HAVE_SYS_IPC_H 1
-
-/* Define if you have the <sys/lwp.h> header file.  */
-/* #undef HAVE_SYS_LWP_H */
-
-/* Define if you have the <sys/mman.h> header file.  */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define if you have the <sys/modem.h> header file.  */
-/* #undef HAVE_SYS_MODEM_H */
-
-/* Define if you have the <sys/mount.h> header file.  */
-#define HAVE_SYS_MOUNT_H 1
-
-/* Define if you have the <sys/msg.h> header file.  */
-#define HAVE_SYS_MSG_H 1
-
-/* Define if you have the <sys/param.h> header file.  */
-#define HAVE_SYS_PARAM_H 1
-
-/* Define if you have the <sys/reg.h> header file.  */
-#define HAVE_SYS_REG_H 1
-
-/* Define if you have the <sys/shm.h> header file.  */
-#define HAVE_SYS_SHM_H 1
-
-/* Define if you have the <sys/signal.h> header file.  */
-#define HAVE_SYS_SIGNAL_H 1
-
-/* Define if you have the <sys/socket.h> header file.  */
-#define HAVE_SYS_SOCKET_H 1
-
-/* Define if you have the <sys/sockio.h> header file.  */
-/* #undef HAVE_SYS_SOCKIO_H */
-
-/* Define if you have the <sys/soundcard.h> header file.  */
-#define HAVE_SYS_SOUNDCARD_H 1
-
-/* Define if you have the <sys/statfs.h> header file.  */
-#define HAVE_SYS_STATFS_H 1
-
-/* Define if you have the <sys/strtio.h> header file.  */
-/* #undef HAVE_SYS_STRTIO_H */
-
-/* Define if you have the <sys/syscall.h> header file.  */
-#define HAVE_SYS_SYSCALL_H 1
-
-/* Define if you have the <sys/v86.h> header file.  */
-/* #undef HAVE_SYS_V86_H */
-
-/* Define if you have the <sys/v86intr.h> header file.  */
-/* #undef HAVE_SYS_V86INTR_H */
-
-/* Define if you have the <sys/vfs.h> header file.  */
-#define HAVE_SYS_VFS_H 1
-
-/* Define if you have the <sys/vm86.h> header file.  */
-#define HAVE_SYS_VM86_H 1
-
-/* Define if you have the <sys/wait.h> header file.  */
-#define HAVE_SYS_WAIT_H 1
-
-/* Define if you have the <syscall.h> header file.  */
-#define HAVE_SYSCALL_H 1
-
-/* Define if you have the <ucontext.h> header file.  */
-#define HAVE_UCONTEXT_H 1
-
-/* Define if you have the <wctype.h> header file.  */
-#define HAVE_WCTYPE_H 1
-
-/* Define if you have the curses library (-lcurses).  */
-/* #undef HAVE_LIBCURSES */
-
-/* Define if you have the i386 library (-li386).  */
-/* #undef HAVE_LIBI386 */
-
-/* Define if you have the m library (-lm).  */
-#define HAVE_LIBM 1
-
-/* Define if you have the mmap library (-lmmap).  */
-/* #undef HAVE_LIBMMAP */
-
-/* Define if you have the ncurses library (-lncurses).  */
-#define HAVE_LIBNCURSES 1
-
-/* Define if you have the ossaudio library (-lossaudio).  */
-/* #undef HAVE_LIBOSSAUDIO */
-
-/* Define if you have the w library (-lw).  */
-/* #undef HAVE_LIBW */
-
-/* Define if you have the xpg4 library (-lxpg4).  */
-/* #undef HAVE_LIBXPG4 */
--- a/loader/wine/vfw.h	Thu Jul 12 15:23:26 2001 +0000
+++ b/loader/wine/vfw.h	Thu Jul 12 15:27:48 2001 +0000
@@ -442,7 +442,7 @@
 LRESULT	VFWAPI ICSendMessage(HIC hic, unsigned int msg, long dw1, long dw2);
 HIC	VFWAPI ICLocate(long fccType, long fccHandler, LPBITMAPINFOHEADER lpbiIn, LPBITMAPINFOHEADER lpbiOut, short wFlags);
 
-int VFWAPI ICDoSomething();
+int VFWAPI ICDoSomething(void);
 
 long	VFWAPIV	ICDrawBegin(
         HIC			hic,