programs: Move icinfo out of avitools.
diff --git a/programs/Makefile.in b/programs/Makefile.in
index 0c0426a..6f75a18 100644
--- a/programs/Makefile.in
+++ b/programs/Makefile.in
@@ -6,7 +6,6 @@
 VPATH     = @srcdir@
 
 SUBDIRS = \
-	avitools \
 	clock \
 	cmdlgtst \
 	control \
@@ -14,6 +13,7 @@
 	expand \
 	explorer \
 	hh \
+	icinfo \
 	msiexec \
 	notepad \
 	progman \
@@ -43,13 +43,13 @@
 
 # Sub-directories to run make install into
 INSTALLSUBDIRS = \
-	avitools \
 	clock \
 	control \
 	eject \
 	expand \
 	explorer \
 	hh \
+	icinfo \
 	msiexec \
 	notepad \
 	progman \
diff --git a/programs/avitools/.gitignore b/programs/avitools/.gitignore
deleted file mode 100644
index 8eb502f..0000000
--- a/programs/avitools/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-aviinfo
-aviplay
-icinfo
diff --git a/programs/avitools/Makefile.in b/programs/avitools/Makefile.in
deleted file mode 100644
index 9a378af..0000000
--- a/programs/avitools/Makefile.in
+++ /dev/null
@@ -1,71 +0,0 @@
-DLLDEFS    = @DLLDEFS@
-DLLFLAGS   = @DLLFLAGS@
-DEFS       = $(DLLDEFS) $(EXTRADEFS)
-TOPSRCDIR  = @top_srcdir@
-TOPOBJDIR  = ../..
-SRCDIR     = @srcdir@
-VPATH      = @srcdir@
-MODULE     = none
-PROGRAMS   = aviinfo.exe aviplay.exe icinfo.exe
-ALL_LIBS   = $(LIBWINE) $(LIBPORT) $(LDFLAGS) $(LIBS)
-
-C_SRCS = \
-	aviinfo.c \
-	aviplay.c \
-	icinfo.c
-
-@MAKE_RULES@
-
-all: aviinfo.exe$(DLLEXT) aviplay.exe$(DLLEXT) icinfo.exe$(DLLEXT) aviinfo$(EXEEXT) aviplay$(EXEEXT) icinfo$(EXEEXT)
-
-aviinfo.exe.so: aviinfo.o
-	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviinfo.o -L$(DLLDIR) -lavifil32 -lkernel32 $(ALL_LIBS)
-
-aviplay.exe.so: aviplay.o
-	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ aviplay.o -L$(DLLDIR) -lavifil32 -lddraw -lkernel32 $(ALL_LIBS)
-
-icinfo.exe.so: icinfo.o
-	$(WINEGCC) -B$(TOOLSDIR)/tools/winebuild -mwindows -o $@ icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32 $(ALL_LIBS)
-
-aviinfo.exe: aviinfo.o
-	$(CC) -o $@ aviinfo.o -lavifil32 $(ALL_LIBS)
-
-aviplay.exe: aviplay.o
-	$(CC) -o $@ aviplay.o -lavifil32 -lddraw $(ALL_LIBS)
-
-icinfo.exe: icinfo.o
-	$(CC) -o $@ icinfo.o -lmsvfw32 $(ALL_LIBS)
-
-$(PROGRAMS:.exe=): $(WINEWRAPPER)
-	$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
-
-# Rules for installation
-
-.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
-
-install_prog.so: $(PROGRAMS:%=%.so)
-	$(MKINSTALLDIRS) $(DESTDIR)$(dlldir)
-	$(INSTALL_PROGRAM) aviinfo.exe.so $(DESTDIR)$(dlldir)/aviinfo.exe.so
-	$(INSTALL_PROGRAM) aviplay.exe.so $(DESTDIR)$(dlldir)/aviplay.exe.so
-	$(INSTALL_PROGRAM) icinfo.exe.so $(DESTDIR)$(dlldir)/icinfo.exe.so
-
-install_prog: $(PROGRAMS)
-	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
-	$(INSTALL_PROGRAM) aviinfo.exe $(DESTDIR)$(bindir)/aviinfo.exe
-	$(INSTALL_PROGRAM) aviplay.exe $(DESTDIR)$(bindir)/aviplay.exe
-	$(INSTALL_PROGRAM) icinfo.exe $(DESTDIR)$(bindir)/icinfo.exe
-
-uninstall_prog.so:
-	$(RM) $(DESTDIR)$(dlldir)/aviinfo.exe.so $(DESTDIR)$(dlldir)/aviplay.exe.so $(DESTDIR)$(dlldir)/icinfo.exe.so
-
-uninstall_prog:
-	$(RM) $(DESTDIR)$(bindir)/aviinfo.exe $(DESTDIR)$(bindir)/aviplay.exe $(DESTDIR)$(bindir)/icinfo.exe
-
-install:: install_prog$(DLLEXT)
-
-uninstall:: uninstall_prog$(DLLEXT)
-
-clean::
-	$(RM) $(PROGRAMS:.exe=)
-
-### Dependencies:
diff --git a/programs/avitools/aviinfo.c b/programs/avitools/aviinfo.c
deleted file mode 100644
index 7c79f67..0000000
--- a/programs/avitools/aviinfo.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 1999 Marcus Meissner
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include "windef.h"
-#include "windows.h"
-#include "mmsystem.h"
-#include "vfw.h"
-
-
-int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
-{
-    unsigned int	n;
-    HRESULT		hres;
-    PAVIFILE		avif;
-    PAVISTREAM		vids,auds;
-    AVIFILEINFO		afi;
-    AVISTREAMINFO	asi;
-
-    AVIFileInit();
-    if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
-    	fprintf(stderr,"Usage: aviinfo <avifilename>\n");
-	exit(1);
-    }
-    hres = AVIFileOpen(&avif,cmdline,OF_READ,NULL);
-    if (hres) {
-    	fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
-	exit(1);
-    }
-    hres = AVIFileInfo(avif,&afi,sizeof(afi));
-    if (hres) {
-    	fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
-	exit(1);
-    }
-    fprintf(stderr,"AVI File Info:\n");
-    fprintf(stderr,"\tdwMaxBytesPerSec: %ld\n",afi.dwMaxBytesPerSec);
-#define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x",");
-    fprintf(stderr,"\tdwFlags: 0x%lx (",afi.dwFlags);
-    FF(HASINDEX);FF(MUSTUSEINDEX);FF(ISINTERLEAVED);FF(WASCAPTUREFILE);
-    FF(COPYRIGHTED);
-    fprintf(stderr,")\n");
-#undef FF
-#define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x",");
-    fprintf(stderr,"\tdwCaps: 0x%lx (",afi.dwCaps);
-    FF(CANREAD);FF(CANWRITE);FF(ALLKEYFRAMES);FF(NOCOMPRESSION);
-    fprintf(stderr,")\n");
-#undef FF
-    fprintf(stderr,"\tdwStreams: %ld\n",afi.dwStreams);
-    fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",afi.dwSuggestedBufferSize);
-    fprintf(stderr,"\tdwWidth: %ld\n",afi.dwWidth);
-    fprintf(stderr,"\tdwHeight: %ld\n",afi.dwHeight);
-    fprintf(stderr,"\tdwScale: %ld\n",afi.dwScale);
-    fprintf(stderr,"\tdwRate: %ld\n",afi.dwRate);
-    fprintf(stderr,"\tdwLength: %ld\n",afi.dwLength);
-    fprintf(stderr,"\tdwEditCount: %ld\n",afi.dwEditCount);
-    fprintf(stderr,"\tszFileType: %s\n",afi.szFileType);
-
-    for (n = 0;n<afi.dwStreams;n++) {
-    	    char buf[5];
-	    PAVISTREAM	ast;
-
-	    hres = AVIFileGetStream(avif,&ast,0,n);
-	    if (hres) {
-		fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
-		exit(1);
-	    }
-	    hres = AVIStreamInfo(ast,&asi,sizeof(asi));
-	    if (hres) {
-		fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
-		exit(1);
-	    }
-	    fprintf(stderr,"Stream %d:\n",n);
-	    buf[4]='\0';memcpy(buf,&(asi.fccType),4);
-	    fprintf(stderr,"\tfccType: %s\n",buf);
-	    memcpy(buf,&(asi.fccHandler),4);
-	    fprintf(stderr,"\tfccHandler: %s\n",buf);
-	    fprintf(stderr,"\tdwFlags: 0x%08lx\n",asi.dwFlags);
-	    fprintf(stderr,"\tdwCaps: 0x%08lx\n",asi.dwCaps);
-	    fprintf(stderr,"\twPriority: %d\n",asi.wPriority);
-	    fprintf(stderr,"\twLanguage: %d\n",asi.wLanguage);
-	    fprintf(stderr,"\tdwScale: %ld\n",asi.dwScale);
-	    fprintf(stderr,"\tdwRate: %ld\n",asi.dwRate);
-	    fprintf(stderr,"\tdwStart: %ld\n",asi.dwStart);
-	    fprintf(stderr,"\tdwLength: %ld\n",asi.dwLength);
-	    fprintf(stderr,"\tdwInitialFrames: %ld\n",asi.dwInitialFrames);
-	    fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",asi.dwSuggestedBufferSize);
-	    fprintf(stderr,"\tdwQuality: %ld\n",asi.dwQuality);
-	    fprintf(stderr,"\tdwSampleSize: %ld\n",asi.dwSampleSize);
-	    fprintf(stderr,"\tdwEditCount: %ld\n",asi.dwEditCount);
-	    fprintf(stderr,"\tdwFormatChangeCount: %ld\n",asi.dwFormatChangeCount);
-	    fprintf(stderr,"\tszName: %s\n",asi.szName);
-	    switch (asi.fccType) {
-	    case streamtypeVIDEO:
-	    	vids = ast;
-		break;
-	    case streamtypeAUDIO:
-	    	auds = ast;
-		break;
-	    default:  {
-	    	char type[5];
-		type[4]='\0';memcpy(type,&(asi.fccType),4);
-
-	    	fprintf(stderr,"Unhandled streamtype %s\n",type);
-		break;
-	    }
-	    }
-	    AVIStreamRelease(ast);
-    }
-    AVIFileRelease(avif);
-    AVIFileExit();
-    return 0;
-}
diff --git a/programs/avitools/aviplay.c b/programs/avitools/aviplay.c
deleted file mode 100644
index 2aad746..0000000
--- a/programs/avitools/aviplay.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Very simple AVIPLAYER
- *
- * Copyright 1999 Marcus Meissner
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * Status:
- * 	- plays .avi streams, video only
- *	- requires Microsoft avifil32.dll and builtin msvfw32.dll.
- *
- * Todo:
- *	- audio support (including synchronization etc)
- *	- replace DirectDraw by a 'normal' window, including dithering, controls
- *	  etc.
- *
- * Bugs:
- *	- no time scheduling, video plays too fast using DirectDraw/XF86DGA
- *	- requires DirectDraw with all disadvantages.
- */
-
-#include <stdio.h>
-#include <time.h>
-#include <assert.h>
-#include <string.h>
-
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-#include "windows.h"
-#include "wingdi.h"
-#include "mmsystem.h"
-#include "ddraw.h"
-#include "vfw.h"
-
-
-int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
-{
-    int			bytesline,i,n,pos;
-    time_t		tstart,tend;
-    LONG		cnt;
-    BITMAPINFOHEADER	*bmi;
-    HRESULT		hres;
-    PAVIFILE		avif;
-    PAVISTREAM		vids=NULL,auds=NULL;
-    AVIFILEINFO		afi;
-    AVISTREAMINFO	asi;
-    PGETFRAME		vidgetframe=NULL;
-    LPDIRECTDRAW	ddraw;
-    DDSURFACEDESC	dsdesc;
-    LPDIRECTDRAWSURFACE dsurf;
-    LPDIRECTDRAWPALETTE dpal;
-    PALETTEENTRY	palent[256];
-
-    AVIFileInit();
-    if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
-    	fprintf(stderr,"Usage: aviplay <avifilename>\n");
-	exit(1);
-    }
-    hres = AVIFileOpen(&avif,cmdline,OF_READ,NULL);
-    if (hres) {
-    	fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
-	exit(1);
-    }
-    hres = AVIFileInfo(avif,&afi,sizeof(afi));
-    if (hres) {
-    	fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
-	exit(1);
-    }
-    for (n=0;n<afi.dwStreams;n++) {
-    	    char buf[5];
-	    PAVISTREAM	ast;
-
-	    hres = AVIFileGetStream(avif,&ast,0,n);
-	    if (hres) {
-		fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
-		exit(1);
-	    }
-	    hres = AVIStreamInfo(ast,&asi,sizeof(asi));
-	    if (hres) {
-		fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
-		exit(1);
-	    }
-	    fprintf(stderr,"[Stream %d: ",n);
-	    buf[4]='\0';memcpy(buf,&(asi.fccType),4);
-	    fprintf(stderr,"%s.",buf);
-	    buf[4]='\0';memcpy(buf,&(asi.fccHandler),4);
-	    fprintf(stderr,"%s, %s]\n",buf,asi.szName);
-	    switch (asi.fccType) {
-	    case streamtypeVIDEO:
-	    	vids = ast;
-		break;
-	    case streamtypeAUDIO:
-	    	auds = ast;
-		break;
-	    default:  {
-	    	char type[5];
-		type[4]='\0';memcpy(type,&(asi.fccType),4);
-
-	    	fprintf(stderr,"Unhandled streamtype %s\n",type);
-	    	AVIStreamRelease(ast);
-		break;
-	    }
-	    }
-    }
-/********************* begin video setup ***********************************/
-    if (!vids) {
-    	fprintf(stderr,"No video stream found. Good Bye.\n");
-	exit(0);
-    }
-    cnt = sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD);
-    bmi = HeapAlloc(GetProcessHeap(),0,cnt);
-    hres = AVIStreamReadFormat(vids,0,bmi,&cnt);
-    if (hres) {
-    	fprintf(stderr,"AVIStreamReadFormat vids: 0x%08lx\n",hres);
-	exit(1);
-    }
-    vidgetframe = NULL;
-    bmi->biCompression = 0; /* we want it in raw form, uncompressed */
-    /* recalculate the image size */
-    bmi->biSizeImage = ((bmi->biWidth*bmi->biBitCount+31)&~0x1f)*bmi->biPlanes*bmi->biHeight/8;
-    bytesline = ((bmi->biWidth*bmi->biBitCount+31)&~0x1f)*bmi->biPlanes/8;
-    vidgetframe = AVIStreamGetFrameOpen(vids,bmi);
-    if (!vidgetframe) {
-    	fprintf(stderr,"AVIStreamGetFrameOpen: failed\n");
-	exit(1);
-    }
-/********************* end video setup ***********************************/
-
-/********************* begin display setup *******************************/
-    hres = DirectDrawCreate(NULL,&ddraw,NULL);
-    if (hres) {
-    	fprintf(stderr,"DirectDrawCreate: 0x%08lx\n",hres);
-	exit(1);
-    }
-    hres = IDirectDraw_SetDisplayMode(ddraw,bmi->biWidth,bmi->biHeight,bmi->biBitCount);
-    if (hres) {
-    	fprintf(stderr,"ddraw.SetDisplayMode: 0x%08lx (change resolution!)\n",hres);
-	exit(1);
-    }
-    dsdesc.dwSize=sizeof(dsdesc);
-    dsdesc.dwFlags = DDSD_CAPS;
-    dsdesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-    hres = IDirectDraw_CreateSurface(ddraw,&dsdesc,&dsurf,NULL);
-    if (hres) {
-    	fprintf(stderr,"ddraw.CreateSurface: 0x%08lx\n",hres);
-	exit(1);
-    }
-    if (bmi->biBitCount==8) {
-    	RGBQUAD		*rgb = (RGBQUAD*)(bmi+1);
-	int		i;
-
-	hres = IDirectDraw_CreatePalette(ddraw,DDPCAPS_8BIT,NULL,&dpal,NULL);
-	if (hres) {
-	    fprintf(stderr,"ddraw.CreateSurface: 0x%08lx\n",hres);
-	    exit(1);
-	}
-	IDirectDrawSurface_SetPalette(dsurf,dpal);
-	for (i=0;i<bmi->biClrUsed;i++) {
-	    palent[i].peRed = rgb[i].rgbRed;
-	    palent[i].peBlue = rgb[i].rgbBlue;
-	    palent[i].peGreen = rgb[i].rgbGreen;
-	}
-	IDirectDrawPalette_SetEntries(dpal,0,0,bmi->biClrUsed,palent);
-    } else
-	dpal = NULL;
-/********************* end display setup *******************************/
-
-    tstart = time(NULL);
-    pos = 0;
-    while (1) {
-    	LPVOID		decodedframe;
-	LPBITMAPINFOHEADER lpbmi;
-	LPVOID		decodedbits;
-
-/* video stuff */
-	if (!(decodedframe=AVIStreamGetFrame(vidgetframe,pos++)))
-	    break;
-	lpbmi = (LPBITMAPINFOHEADER)decodedframe;
-	decodedbits = (LPVOID)(((DWORD)decodedframe)+lpbmi->biSize);
-	if (lpbmi->biBitCount == 8) {
-	/* can't detect palette change that way I think */
-	    RGBQUAD	*rgb = (RGBQUAD*)(lpbmi+1);
-	    int		i,palchanged;
-
-	    /* skip used colorentries. */
-	    decodedbits=(char*)decodedbits+bmi->biClrUsed*sizeof(RGBQUAD);
-	    palchanged = 0;
-	    for (i=0;i<bmi->biClrUsed;i++) {
-	    	if (	(palent[i].peRed != rgb[i].rgbRed) ||
-	    		(palent[i].peBlue != rgb[i].rgbBlue) ||
-	    		(palent[i].peGreen != rgb[i].rgbGreen)
-		) {
-			palchanged = 1;
-			break;
-		}
-	    }
-	    if (palchanged) {
-		for (i=0;i<bmi->biClrUsed;i++) {
-		    palent[i].peRed = rgb[i].rgbRed;
-		    palent[i].peBlue = rgb[i].rgbBlue;
-		    palent[i].peGreen = rgb[i].rgbGreen;
-		}
-		IDirectDrawPalette_SetEntries(dpal,0,0,bmi->biClrUsed,palent);
-	    }
-	}
-	dsdesc.dwSize = sizeof(dsdesc);
-	hres = IDirectDrawSurface_Lock(dsurf,NULL,&dsdesc,DDLOCK_WRITEONLY,0);
-	if (hres) {
-	    fprintf(stderr,"dsurf.Lock: 0x%08lx\n",hres);
-	    exit(1);
-	}
-	/* Argh. AVIs are upside down. */
-	for (i=0;i<dsdesc.dwHeight;i++) {
-	    memcpy( (char *)dsdesc.lpSurface+(i*dsdesc.u1.lPitch),
-		    (char *)decodedbits+bytesline*(dsdesc.dwHeight-i-1),
-		    bytesline
-	    );
-	}
-	IDirectDrawSurface_Unlock(dsurf,dsdesc.lpSurface);
-    }
-    tend = time(NULL);
-    AVIStreamGetFrameClose(vidgetframe);
-
-    IDirectDrawSurface_Release(dsurf);
-    IDirectDraw_RestoreDisplayMode(ddraw);
-    IDirectDraw_Release(ddraw);
-    if (vids) AVIStreamRelease(vids);
-    if (auds) AVIStreamRelease(auds);
-    fprintf(stderr,"%d frames at %g frames/s\n",pos,pos*1.0/(tend-tstart));
-    AVIFileRelease(avif);
-    AVIFileExit();
-    return 0;
-}
diff --git a/programs/icinfo/.gitignore b/programs/icinfo/.gitignore
new file mode 100644
index 0000000..365d3f2
--- /dev/null
+++ b/programs/icinfo/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+icinfo
diff --git a/programs/icinfo/Makefile.in b/programs/icinfo/Makefile.in
new file mode 100644
index 0000000..0d0c589
--- /dev/null
+++ b/programs/icinfo/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+MODULE    = icinfo.exe
+APPMODE   = -mwindows
+IMPORTS   = msvfw32 kernel32
+
+C_SRCS = icinfo.c
+
+@MAKE_PROG_RULES@
+
+### Dependencies:
diff --git a/programs/avitools/icinfo.c b/programs/icinfo/icinfo.c
similarity index 100%
rename from programs/avitools/icinfo.c
rename to programs/icinfo/icinfo.c