[Mplayer-dev-eng] Experimental patch for optimized "wine" build for mplayer

Juergen Keil jk at tools.de
Fri Jun 29 18:12:49 CEST 2001


Hi,

a few days ago there was an issue with "wine" header files,  with an mplayer
compilation picking up includes files from /usr/local/include instead of using
the header files from the mplayer source.

While looking at the bug fix for that issue, I've noticed that the "wine"
stuff in "main/loader" is not compiled with optimization; unlike all other
subdirectories of mplayer.

Well, turning on optimization for "wine" was easy,  but I soon learned why
optimization was disabled for "wine":  mplayer crashes inside wine for
almost every .avi file you throw at it.


The reason for these crashes are mismatches between function prototypes
using the "__stdcall" attribute and function definitions that do not
have a valid prototype in scope and at the same time omit the "__stdcall"
attribute.

This produces a *nice* mess no the CPU's stack;  the caller of such a function
with __stdcall prototype thinks the called function removes arguments from
the stack,  but the function does not!  And in case the compiler has optimized
out the frame-pointer register (-fomit-frame-pointer) we absolutely need a
correct stack-pointer, else access to the function's local variables and
parameter failes. 

It seems there have been attempts to fix these stack problem by __asm__ code
(STORE_ALL, REST_ALL macros; explicit "fsave" asm instructions to save FPU
registers, etc...); the lastest avifile-0.6 CVS even includes some
setitimer() stuff for xxxBSDs .


Appended is an experimental patch for the current mplayer CVS tree.  It tries
to add prototypes for all functions used inside "wine"; using WINAPI /
__stdcall attributes where appropriate.  I've tried to use -Wmissing-prototypes
and -Wimplicit-function-declaration to make sure that every wine function
has a valid prototype.  The __asm__ stack hacks are disabled.  And "wine"
can now be compiled with standard optimization (the same flags used elsewhere
in the mplayer code)[*].  (The patch also removes the config.h files in
loader and loader/wine imported from some other project;  I've tried to
update MPlayer's configure script to check for the things required by the
"wine"/loader.  The "wine"/loader stuff now uses mplayer's main config.h file)


I've tested this code now with a few .avi / .asf files and it seems to work
OK.  But I guess that such a big change can easily break a few things
(so this patch should probably not be included for the 0.18 release).

Can you please test this patch against a copy of your the current CVS
tree.  Does it configure / build properly?  Can the resulting mplayer
binary still play all your favourite .avi / .asf files that used to
work with the unpatched mplayer?  Are there perhaps some .avi / .asf
files that work now, that did not work without the patch?



[*] There's one issue remaining, acmStreamOpen() is misscompiled with gcc-3.0
    and -O3 -fomit-frame-pointer;  but that looks like a compiler bug to me.

    See "view problem report" #3480 here: http://gcc.gnu.org/cgi-bin/gnatsweb.pl

--
Jürgen Keil          		jk at tools.de
Tools GmbH			+49 (228) 9858011
-------------- next part --------------
Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.23
diff -u -B -r1.23 cfgparser.c
--- cfgparser.c	11 Jun 2001 00:12:09 -0000	1.23
+++ cfgparser.c	29 Jun 2001 15:06:10 -0000
@@ -405,6 +405,7 @@
 			/* break */
 		}	
 nextline:
+		;
 	}
 
 	free(line);
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.93
diff -u -B -r1.93 configure
--- configure	26 Jun 2001 23:34:03 -0000	1.93
+++ configure	29 Jun 2001 15:06:11 -0000
@@ -613,6 +613,10 @@
 _ggi=no
 $_cc $TMPC -o $TMPO -lggi > /dev/null 2>&1 && _ggi=yes
 
+_kstat=no
+$_cc $TMPC -o $TMPO -lkstat >/dev/null 2>&1 && _kstat=yes _archlibs="-lkstat $_archlibs"
+$_cc $TMPC -o $TMPO -lrt >/dev/null 2>&1 && _archlibs="-lrt $_archlibs"
+
 _binutils=no
 $_as libac3/downmix/downmix_i386.S -o $TMPO > /dev/null 2>&1 && _binutils=yes
 
@@ -686,7 +690,43 @@
 
 
 # ---
-# try to detect type of audio supported on this machine
+# check availability of some header files
+
+cat > $TMPC << EOF
+#include <malloc.h>
+int main( void ) { return 0; }
+EOF
+
+_malloc_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _malloc_h=yes
+
+
+cat > $TMPC << EOF
+#include <alloca.h>
+int main( void ) { return 0; }
+EOF
+
+_alloca_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _alloca_h=yes
+
+
+cat > $TMPC << EOF
+#include <sys/mman.h>
+int main( void ) { return 0; }
+EOF
+
+_sys_mman_h=no
+$_cc -o $TMPO $TMPC 2> /dev/null && _sys_mman_h=yes
+
+
+cat > $TMPC << EOF
+#include <dlfcn.h>
+int main( void ) {  return 0; }
+EOF
+
+_libdl=no
+$_cc -o $TMPO $TMPC -ldl 2> /dev/null && _libdl=yes
+
 
 cat > $TMPC << EOF
 #include <sys/soundcard.h>
@@ -697,6 +737,9 @@
 $_cc -o $TMPO $TMPC 2> /dev/null && _sys_soundcard_h=yes
 
 
+# ---
+# try to detect type of audio supported on this machine
+
 cat > $TMPC << EOF
 #include <sys/soundcard.h>
 int main( void ) {  int arg = SNDCTL_DSP_SETFRAGMENT; }
@@ -1214,6 +1257,12 @@
  _libtermcap=''
 fi
 
+if [ "$_kstat" = "yes" ]; then
+  _have_libkstat="#define HAVE_LIBKSTAT 1"
+else
+  _have_libkstat="#undef HAVE_LIBKSTAT"
+fi
+
 if [ "$_xmmp" = "yes" ]; then
  _xmmpaudio='#define USE_XMMP_AUDIO'
  _xmmplibs='-Llibxmm -lxmm'
@@ -1269,6 +1318,30 @@
  _have_soundcard_h='#undef  HAVE_SYS_SOUNDCARD_H'
 fi
 
+if [ "$_malloc_h" = "yes" ]; then
+ _have_malloc_h='#define HAVE_MALLOC_H 1'
+else
+ _have_malloc_h='#undef  HAVE_MALLOC_H'
+fi
+
+if [ "$_alloca_h" = "yes" ]; then
+ _have_alloca_h='#define HAVE_ALLOCA_H 1'
+else
+ _have_alloca_h='#undef  HAVE_ALLOCA_H'
+fi
+
+if [ "$_sys_mman_h" = "yes" ]; then
+ _have_mman_h='#define HAVE_SYS_MMAN_H 1'
+else
+ _have_mman_h='#undef  HAVE_SYS_MMAN_H'
+fi
+
+if [ "$_libdl" = "yes" ]; then
+ _have_libdl='#define HAVE_LIBDL 1'
+else
+ _have_libdl='#undef  HAVE_LIBDL'
+fi
+
 
 # Checking for CFLAGS
 if [ "$_profile" != "" ] || [ "$_debug" != "" ]; then
@@ -1539,6 +1612,22 @@
 
 /* Define this if your system has the header file for the OSS sound interface */
 $_have_soundcard_h
+
+/* Define this if your system has the "malloc.h" header file */
+$_have_malloc_h
+
+/* Define this if your system has the "alloca.h" header file */
+$_have_alloca_h
+
+/* Define this if your system has the "sys/mman.h" header file */
+$_have_mman_h
+
+
+/* Define this if you have the elf dynamic linker -ldl library */
+$_have_libdl
+
+/* Define this if you have the kstat kernel statistics library */
+$_have_libkstat
 
 
 /* LIRC (remote control, see www.lirc.org) support: */
Index: dll_init.c
===================================================================
RCS file: /cvsroot/mplayer/main/dll_init.c,v
retrieving revision 1.20
diff -u -B -r1.20 dll_init.c
--- dll_init.c	11 May 2001 02:05:36 -0000	1.20
+++ dll_init.c	29 Jun 2001 15:06:11 -0000
@@ -11,7 +11,7 @@
 
 #include "loader.h"
 //#include "wine/mmreg.h"
-//#include "wine/vfw.h"
+#include "wine/vfw.h"
 #include "wine/avifmt.h"
 
 #include "codec-cfg.h"
Index: libao2/ao_sun.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_sun.c,v
retrieving revision 1.4
diff -u -B -r1.4 ao_sun.c
--- libao2/ao_sun.c	23 Jun 2001 19:40:04 -0000	1.4
+++ libao2/ao_sun.c	29 Jun 2001 15:06:12 -0000
@@ -67,21 +67,21 @@
 // convert an OSS audio format specification into a sun audio encoding
 static int oss2sunfmt(int oss_format)
 {
-  switch (oss_format){
-  case AFMT_MU_LAW:
-    return AUDIO_ENCODING_ULAW;
-  case AFMT_A_LAW:
-    return AUDIO_ENCODING_ALAW;
-  case AFMT_S16_LE:
-    return AUDIO_ENCODING_LINEAR;
-  case AFMT_U8:
-    return AUDIO_ENCODING_LINEAR8;
+    switch (oss_format){
+    case AFMT_MU_LAW:
+	return AUDIO_ENCODING_ULAW;
+    case AFMT_A_LAW:
+	return AUDIO_ENCODING_ALAW;
+    case AFMT_S16_LE:
+	return AUDIO_ENCODING_LINEAR;
+    case AFMT_U8:
+	return AUDIO_ENCODING_LINEAR8;
 #ifdef	AUDIO_ENCODING_DVI	// Missing on NetBSD...
-  case AFMT_IMA_ADPCM:
-    return AUDIO_ENCODING_DVI;
+    case AFMT_IMA_ADPCM:
+	return AUDIO_ENCODING_DVI;
 #endif
-  default:
-    return AUDIO_ENCODING_NONE;
+    default:
+	return AUDIO_ENCODING_NONE;
   }
 }
 
@@ -101,7 +101,11 @@
     unsigned increment;
     unsigned min_increment;
 
-    len = 44100 * 4 / 4;    // amount of data for 0.25sec of 44.1khz, stereo, 16bit
+    len = 44100 * 4 / 4;    /* amount of data for 0.25sec of 44.1khz, stereo,
+			     * 16bit.  44kbyte can be sent sent to all 
+			     * supported sun audio devices without blocking in
+			     * the "write" below.
+			     */
     silence = calloc(1, len);
     if (silence == NULL)
 	goto error;
@@ -172,6 +176,15 @@
 	last_samplecnt = info.play.samples;
     }
 
+    /*
+     * For 44.1kkz, stereo, 16-bit format we would send sound data in 16kbytes
+     * chunks (== 4096 samples) to the audio device.  If we see a minimum
+     * sample counter increment from the soundcard driver of less than
+     * 2000 samples,  we assume that the driver provides a useable realtime
+     * sample counter in the AUDIO_INFO play.samples field.  Timing based
+     * on sample counts should be much more accurate than counting whole 
+     * 16kbyte chunks.
+     */
     if (min_increment < 2000)
 	rtsc_ok = RTSC_ENABLED;
 
@@ -198,92 +211,100 @@
 
 // to set/get/query special features/parameters
 static int control(int cmd,int arg){
-  switch(cmd){
+    switch(cmd){
     case AOCONTROL_SET_DEVICE:
-      audio_dev=(char*)arg;
-      return CONTROL_OK;
+	audio_dev=(char*)arg;
+	return CONTROL_OK;
     case AOCONTROL_QUERY_FORMAT:
-      return CONTROL_TRUE;
-  }
-  return CONTROL_UNKNOWN;
+	return CONTROL_TRUE;
+    }
+    return CONTROL_UNKNOWN;
 }
 
 // open & setup audio device
 // return: 1=success 0=fail
 static int init(int rate,int channels,int format,int flags){
 
-  audio_info_t info;
-  int byte_per_sec;
+    audio_info_t info;
+    int byte_per_sec;
 
-  if (ao_subdevice) audio_dev = ao_subdevice;
+    if (ao_subdevice) audio_dev = ao_subdevice;
 
-  if (enable_sample_timing == RTSC_UNKNOWN
-      && !getenv("AO_SUN_DISABLE_SAMPLE_TIMING")) {
-      enable_sample_timing = realtime_samplecounter_available(audio_dev);
-  }
+    if (enable_sample_timing == RTSC_UNKNOWN
+	&& !getenv("AO_SUN_DISABLE_SAMPLE_TIMING")) {
+	enable_sample_timing = realtime_samplecounter_available(audio_dev);
+    }
 
-  printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
-	 rate,channels,audio_out_format_name(format),format);
+    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
+	   rate,channels,audio_out_format_name(format),format);
 
-  audio_fd=open(audio_dev, O_WRONLY);
-  if(audio_fd<0){
-    printf("Can't open audio device %s, %s  -> nosound\n", audio_dev, strerror(errno));
-    return 0;
-  }
+    audio_fd=open(audio_dev, O_WRONLY);
+    if(audio_fd<0){
+	printf("Can't open audio device %s, %s  -> nosound\n", audio_dev, strerror(errno));
+	return 0;
+    }
 
-  ioctl(audio_fd, AUDIO_DRAIN, 0);
+    ioctl(audio_fd, AUDIO_DRAIN, 0);
 
-  AUDIO_INITINFO(&info);
-  info.play.encoding = oss2sunfmt(ao_format = format);
-  info.play.precision = (format==AFMT_S16_LE? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
-  info.play.channels = ao_channels = channels;
-  info.play.sample_rate = ao_samplerate = rate;
-  if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0)
-    printf("audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate\n",channels,audio_out_format_name(format),rate);
-  bytes_per_sample = channels * info.play.precision / 8;
-  byte_per_sec = bytes_per_sample * rate;
-  ao_outburst = byte_per_sec > 100000 ? 16384 : 8192;
-
-  if(ao_buffersize==-1){
-    // Measuring buffer size:
-    void* data;
-    ao_buffersize=0;
+    AUDIO_INITINFO(&info);
+    info.play.encoding = oss2sunfmt(ao_format = format);
+    info.play.precision = (format==AFMT_S16_LE? AUDIO_PRECISION_16:AUDIO_PRECISION_8);
+    info.play.channels = ao_channels = channels;
+    info.play.sample_rate = ao_samplerate = rate;
+    if(ioctl (audio_fd, AUDIO_SETINFO, &info)<0)
+	printf("audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate\n",
+	       channels, audio_out_format_name(format), rate);
+    bytes_per_sample = channels * info.play.precision / 8;
+    byte_per_sec = bytes_per_sample * rate;
+    ao_outburst = byte_per_sec > 100000 ? 16384 : 8192;
+
+#ifdef	__not_used__
+    /*
+     * hmm, ao_buffersize is currently not used in this driver, do there's
+     * no need to measure it
+     */
+    if(ao_buffersize==-1){
+	// Measuring buffer size:
+	void* data;
+	ao_buffersize=0;
 #ifdef HAVE_AUDIO_SELECT
-    data=malloc(ao_outburst); memset(data,0,ao_outburst);
-    while(ao_buffersize<0x40000){
-      fd_set rfds;
-      struct timeval tv;
-      FD_ZERO(&rfds); FD_SET(audio_fd,&rfds);
-      tv.tv_sec=0; tv.tv_usec = 0;
-      if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) break;
-      write(audio_fd,data,ao_outburst);
-      ao_buffersize+=ao_outburst;
-    }
-    free(data);
-    if(ao_buffersize==0){
-        printf("\n   ***  Your audio driver DOES NOT support select()  ***\n");
-          printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
-        return 0;
-    }
+	data = malloc(ao_outburst);
+	memset(data, format==AFMT_U8 ? 0x80 : 0, ao_outburst);
+	while(ao_buffersize<0x40000){
+	    fd_set rfds;
+	    struct timeval tv;
+	    FD_ZERO(&rfds); FD_SET(audio_fd,&rfds);
+	    tv.tv_sec=0; tv.tv_usec = 0;
+	    if(!select(audio_fd+1, NULL, &rfds, NULL, &tv)) break;
+	    write(audio_fd,data,ao_outburst);
+	    ao_buffersize+=ao_outburst;
+	}
+	free(data);
+	if(ao_buffersize==0){
+	    printf("\n   ***  Your audio driver DOES NOT support select()  ***\n");
+	    printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
+	    return 0;
+	}
 #ifdef	__svr4__
-    // remove the 0 bytes from the above ao_buffersize measurement from the
-    // audio driver's STREAMS queue
-    ioctl(audio_fd, I_FLUSH, FLUSHW);
+	// remove the 0 bytes from the above ao_buffersize measurement from the
+	// audio driver's STREAMS queue
+	ioctl(audio_fd, I_FLUSH, FLUSHW);
 #endif
-    ioctl(audio_fd, AUDIO_DRAIN, 0);
+	ioctl(audio_fd, AUDIO_DRAIN, 0);
 #endif
-  }
+    }
+#endif	/* __not_used__ */
 
-  AUDIO_INITINFO(&info);
-  info.play.samples = 0;
-  info.play.eof = 0;
-  info.play.error = 0;
-  ioctl (audio_fd, AUDIO_SETINFO, &info);
+    AUDIO_INITINFO(&info);
+    info.play.samples = 0;
+    info.play.eof = 0;
+    info.play.error = 0;
+    ioctl (audio_fd, AUDIO_SETINFO, &info);
 
-  queued_bursts = 0;
-  queued_samples = 0;
+    queued_bursts = 0;
+    queued_samples = 0;
 
-  return 1;
+    return 1;
 }
 
 // close audio device
@@ -373,11 +394,11 @@
     len /= ao_outburst;
     len = write(audio_fd, data, len*ao_outburst);
     if(len > 0) {
-      queued_samples += len / bytes_per_sample;
-      if (write(audio_fd,data,0) < 0)
-	  perror("ao_sun: send EOF audio record");
-      else
-	  queued_bursts ++;
+	queued_samples += len / bytes_per_sample;
+	if (write(audio_fd,data,0) < 0)
+	    perror("ao_sun: send EOF audio record");
+	else
+	    queued_bursts ++;
     }
     return len;
 }
Index: loader/Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/loader/Makefile,v
retrieving revision 1.2
diff -u -B -r1.2 Makefile
--- loader/Makefile	28 Mar 2001 21:43:21 -0000	1.2
+++ loader/Makefile	29 Jun 2001 15:06:12 -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
 
Index: loader/afl.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/afl.c,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 afl.c
--- loader/afl.c	24 Feb 2001 20:30:14 -0000	1.1.1.1
+++ loader/afl.c	29 Jun 2001 15:06:12 -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);
 
Index: loader/config.h
===================================================================
RCS file: loader/config.h
diff -N loader/config.h
--- loader/config.h	24 Feb 2001 20:30:26 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -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
Index: loader/driver.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/driver.c,v
retrieving revision 1.5
diff -u -B -r1.5 driver.c
--- loader/driver.c	11 Apr 2001 01:38:57 -0000	1.5
+++ loader/driver.c	29 Jun 2001 15:06:12 -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**);
-
-
-#ifdef __FreeBSD__
-#include <sys/time.h>
-#endif
+#include <setup_FS.h>
+#include "driver.h"
 
 
+#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;
Index: loader/driver.h
===================================================================
RCS file: loader/driver.h
diff -N loader/driver.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ loader/driver.h	29 Jun 2001 15:06:12 -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
Index: loader/elfdll.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/elfdll.c,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 elfdll.c
--- loader/elfdll.c	24 Feb 2001 20:30:14 -0000	1.1.1.1
+++ loader/elfdll.c	29 Jun 2001 15:06:12 -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>
Index: loader/ext.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/ext.c,v
retrieving revision 1.2
diff -u -B -r1.2 ext.c
--- loader/ext.c	18 Mar 2001 01:01:02 -0000	1.2
+++ loader/ext.c	29 Jun 2001 15:06:12 -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)
Index: loader/ext.h
===================================================================
RCS file: loader/ext.h
diff -N loader/ext.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ loader/ext.h	29 Jun 2001 15:06:12 -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
Index: loader/loader.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/loader.h,v
retrieving revision 1.2
diff -u -B -r1.2 loader.h
--- loader/loader.h	18 Mar 2001 01:01:02 -0000	1.2
+++ loader/loader.h	29 Jun 2001 15:06:12 -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
 }
Index: loader/module.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/module.c,v
retrieving revision 1.2
diff -u -B -r1.2 module.c
--- loader/module.c	18 Mar 2001 01:01:02 -0000	1.2
+++ loader/module.c	29 Jun 2001 15:06:12 -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
Index: loader/pe_image.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/pe_image.c,v
retrieving revision 1.2
diff -u -B -r1.2 pe_image.c
--- loader/pe_image.c	18 Mar 2001 01:01:02 -0000	1.2
+++ loader/pe_image.c	29 Jun 2001 15:06:12 -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;
@@ -886,8 +889,12 @@
  * DLL_PROCESS_ATTACH. Only new created threads do DLL_THREAD_ATTACH
  * (SDK)
  */
-extern void This_Is_Dirty_Hack()
+static void This_Is_Dirty_Hack(void)
 {
+    /*
+     * so this is a dirty hack.
+     * Why do we need it?
+     */
     void* mem=alloca(0x20000);
     *(int*)mem=0x1234;
 }
Index: loader/pe_resource.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/pe_resource.c,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 pe_resource.c
--- loader/pe_resource.c	24 Feb 2001 20:30:21 -0000	1.1.1.1
+++ loader/pe_resource.c	29 Jun 2001 15:06:12 -0000
@@ -22,6 +22,7 @@
 //#include "process.h"
 //#include "stackframe.h"
 #include <wine/debugtools.h>
+#include <ext.h>
 
 /**********************************************************************
  *  HMODULE32toPE_MODREF 
Index: loader/registry.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/registry.c,v
retrieving revision 1.5
diff -u -B -r1.5 registry.c
--- loader/registry.c	11 Apr 2001 01:38:57 -0000	1.5
+++ loader/registry.c	29 Jun 2001 15:06:12 -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");
Index: loader/resource.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/resource.c,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 resource.c
--- loader/resource.c	24 Feb 2001 20:30:21 -0000	1.1.1.1
+++ loader/resource.c	29 Jun 2001 15:06:12 -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
Index: loader/setup_FS.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/setup_FS.c,v
retrieving revision 1.3
diff -u -B -r1.3 setup_FS.c
--- loader/setup_FS.c	5 Jun 2001 02:26:56 -0000	1.3
+++ loader/setup_FS.c	29 Jun 2001 15:06:12 -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 */
Index: loader/setup_FS.h
===================================================================
RCS file: loader/setup_FS.h
diff -N loader/setup_FS.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ loader/setup_FS.h	29 Jun 2001 15:06:12 -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
Index: loader/vfl.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/vfl.c,v
retrieving revision 1.3
diff -u -B -r1.3 vfl.c
--- loader/vfl.c	11 Jun 2001 12:46:53 -0000	1.3
+++ loader/vfl.c	29 Jun 2001 15:06:12 -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,15 +56,9 @@
     "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]
  * Returns the version in major.minor form.
@@ -291,7 +290,9 @@
 	WINE_HIC	*whic = (WINE_HIC*)hic;
 	char qw[200];
 
+#if 0
     __asm__ __volatile__ ("fsave (%0)\n\t": :"r"(&qw));    
+#endif
     STORE_ALL;	
         /*__asm__
 	(
@@ -302,7 +303,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);
Index: loader/win32.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.c,v
retrieving revision 1.14
diff -u -B -r1.14 win32.c
--- loader/win32.c	11 Jun 2001 12:46:53 -0000	1.14
+++ loader/win32.c	29 Jun 2001 15:06:13 -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;
 }    
@@ -2742,7 +2787,7 @@
 //    return (void*)ext_unknown;
 }
 
-int my_garbagecollection()
+int my_garbagecollection(void)
 {
 #ifdef GARBAGE
     alc_list* pp,*ppsv;
Index: loader/win32.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.h,v
retrieving revision 1.1.1.1
diff -u -B -r1.1.1.1 win32.h
--- loader/win32.h	24 Feb 2001 20:30:26 -0000	1.1.1.1
+++ loader/win32.h	29 Jun 2001 15:06:13 -0000
@@ -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
Index: loader/wine/config.h
===================================================================
RCS file: loader/wine/config.h
diff -N loader/wine/config.h
--- loader/wine/config.h	24 Feb 2001 20:30:28 -0000	1.1.1.1
+++ /dev/null	1 Jan 1970 00:00:00 -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 */
Index: loader/wine/vfw.h
===================================================================
RCS file: /cvsroot/mplayer/main/loader/wine/vfw.h,v
retrieving revision 1.2
diff -u -B -r1.2 vfw.h
--- loader/wine/vfw.h	18 Mar 2001 01:01:03 -0000	1.2
+++ loader/wine/vfw.h	29 Jun 2001 15:06:13 -0000
@@ -429,7 +429,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,


More information about the MPlayer-dev-eng mailing list