Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Nov 1999 18:44:01 +0100 (CET)
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        se@freebsd.org, Stefan.Esser@o-tel-o.de
Subject:   ports/15118: wine-991114 once more
Message-ID:  <199911271744.SAA54798@saturn.kn-bremen.de>

next in thread | raw e-mail | index | archive | help

>Number:         15118
>Category:       ports
>Synopsis:       wine-991114 once more
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 27 10:00:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Juergen Lock
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
me?  organized?
>Environment:

	3.3-STABLE i386, xpm-3.4k, Mesa-3.0

>Description:

Here's a new update relative to the 991114 port now in the tree...

1. Output a little warning when building without debug info.
2. Use/set fs/gs from the sigcontext struct so that it correctly runs
on recent -stable (the fs/gs handling has just been MFC'd.)  I have
extracted the relevant diffs from cvs and placed them into files/ for
users running older -stable or -releases.
3. Fix another ptrace bug, the debugger now actually seems to work again...
4. Also install regapi, and some doc files.
5. And added some patches from the wine-patches list. (patches/patch-e*)

>How-To-Repeat:

	n/a

>Fix:

Changed files:
	Makefile files/README.patch
	pkg/MESSAGE pkg/PLIST

New files:
	files/patch-3.3-sys-fsgs
	patches/patch-af patches/patch-au patches/patch-bc
	patches/patch-bd patches/patch-be patches/patch-ea
	patches/patch-eb patches/patch-ec patches/patch-ed
	patches/patch-ee patches/patch-ef patches/patch-eg
	patches/patch-eh

Index: Makefile
===================================================================
RCS file: /home/cvs/cvs/ports/emulators/wine/Makefile,v
retrieving revision 1.75
diff -u -u -r1.75 Makefile
--- Makefile	1999/11/21 20:02:12	1.75
+++ Makefile	1999/11/27 11:54:50
@@ -14,7 +14,8 @@
 
 MAINTAINER=	se@FreeBSD.org
 
-LIB_DEPENDS=	Xpm.4:${PORTSDIR}/graphics/xpm
+LIB_DEPENDS=	Xpm.4:${PORTSDIR}/graphics/xpm \
+		GL.14:${PORTSDIR}/graphics/Mesa3
 
 DATE=		991114
 WRKSRC=		${WRKDIR}/wine-${DATE}
@@ -26,27 +27,75 @@
 .if !defined(NDEBUG)
 STRIP=
 CFLAGS+=	-g
+.else
+pre-extract:
+	@${ECHO} "NDEBUG has been set, building without debug info..."
+	@${ECHO} "This will save diskspace but it makes debugging harder."
+	@${ECHO} "If for example wine crashes and you would like to send"
+	@${ECHO} "the backtrace it then dumps to the developers (or"
+	@${ECHO} "comp.emulators.ms-windows.wine) it will be much more useful"
+	@${ECHO} "to them if you first rebuild without this and generate it again."
+	@${ECHO} "(If you're _not_ low on diskspace there is not really a reason to"
+	@${ECHO} "use this flag, the resulting wine won't use more VM or anything like"
+	@${ECHO} "that when running, only when it has to enter the debugger...)"
 .endif
 
 post-configure:
-		cd ${WRKSRC} && make depend
+	cd ${WRKSRC} && make depend
 
+post-build:
+	cd ${WRKSRC}/programs/regapi && ${MAKE}
+	${SED} '1s/bash/sh/;s-\./\(reg.*\.pl\)-'${PREFIX}/lib/wine/reg/'\1-' <${WRKSRC}/programs/regapi/regSet.sh >${WRKDIR}/regSet.sh
+	${SED} 's-\(Change directory to \)<dirs to wine>/tools$$-\1your program'"'"'s dir (or wherever you need to be to run it)-;s-\./\(bug_report\.pl\)-'${PREFIX}/lib/wine/'\1-' <${WRKSRC}/documentation/bugreports >${WRKDIR}/bugreports
+	${SED} 's-\(look at the file \)<dirs to wine>/wine.ini-\1'${PREFIX}/etc/wine.conf.sample- <${WRKSRC}/documentation/config >${WRKDIR}/config
+
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/wine ${PREFIX}/bin
-	${INSTALL_PROGRAM} ${WRKSRC}/tools/fnt2bdf ${PREFIX}/bin
-	${INSTALL_PROGRAM} ${WRKSRC}/windows/x11drv/wineclipsrv ${PREFIX}/bin
+	${INSTALL_PROGRAM} -s ${WRKSRC}/tools/fnt2bdf ${PREFIX}/bin
+	${INSTALL_PROGRAM} -s ${WRKSRC}/windows/x11drv/wineclipsrv ${PREFIX}/bin
+	${INSTALL_PROGRAM} -s ${WRKSRC}/programs/regapi/regapi ${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKDIR}/regSet.sh ${PREFIX}/bin
 	${INSTALL_DATA} ${WRKSRC}/wine.ini ${PREFIX}/etc/wine.conf.sample
 	[ -f ${PREFIX}/etc/wine.conf ] \
 		|| ${INSTALL_DATA} ${WRKSRC}/wine.ini ${PREFIX}/etc/wine.conf
 	${INSTALL_DATA} ${WRKSRC}/wine.sym ${PREFIX}/etc
 	${INSTALL_DATA} ${WRKSRC}/documentation/wine.man ${PREFIX}/man/man1/wine.1
 	${INSTALL_DATA} ${WRKSRC}/documentation/wine.conf.man ${PREFIX}/man/man5/wine.conf.5
-	-@${MKDIR} ${PREFIX}/lib/wine 2>/dev/null
+	-@${MKDIR} ${PREFIX}/lib/wine/documentation ${PREFIX}/lib/wine/reg 2>/dev/null
+	${INSTALL_DATA} ${WRKDIR}/bugreports ${WRKDIR}/config \
+		${WRKSRC}/README \
+		${WRKSRC}/ANNOUNCE \
+		${WRKSRC}/AUTHORS \
+		${WRKSRC}/LICENSE \
+		${WRKSRC}/WARRANTY \
+		${WRKSRC}/documentation/cdrom-labels \
+		${WRKSRC}/documentation/debugging \
+		${WRKSRC}/documentation/dlls \
+		${WRKSRC}/documentation/fonts \
+		${WRKSRC}/documentation/ioport-trace-hints \
+		${WRKSRC}/documentation/lables-and-serial-nubers \
+		${WRKSRC}/documentation/no-windows \
+		${WRKSRC}/documentation/printing \
+		${WRKSRC}/documentation/psdriver \
+		${WRKSRC}/documentation/psdrv.reg \
+		${WRKSRC}/documentation/ttfserver \
+		${PREFIX}/lib/wine/documentation
+	${INSTALL_DATA} ${WRKSRC}/debugger/README \
+		${PREFIX}/lib/wine/documentation/README.debugger
+	${INSTALL_DATA} ${WRKSRC}/programs/regapi/README \
+		${PREFIX}/lib/wine/documentation/README.regapi
+	${INSTALL_SCRIPT} ${WRKSRC}/tools/bug_report.pl \
+		${PREFIX}/lib/wine
+	${INSTALL_SCRIPT} \
+		${WRKSRC}/programs/regapi/regFixer.pl \
+		${WRKSRC}/programs/regapi/regRestorer.pl \
+		${PREFIX}/lib/wine/reg
 	${INSTALL_DATA} ${FILESDIR}/README.patch \
 		${FILESDIR}/patch-3.3-sys-ldtshare \
 		${FILESDIR}/patch-3.3-sys-sigtrap \
+		${FILESDIR}/patch-3.3-sys-fsgs \
 		${PREFIX}/lib/wine
-	${INSTALL_DATA} ${WRKSRC}/winedefault.reg ${PREFIX}/lib/wine/
+	${INSTALL_DATA} ${WRKSRC}/winedefault.reg ${PREFIX}/lib/wine
 	${ECHO}
 	@${SED} s+%%PREFIX%%+${PREFIX}+g <${PKGMESSAGE}
 
Index: files/README.patch
===================================================================
RCS file: /home/cvs/cvs/ports/emulators/wine/files/README.patch,v
retrieving revision 1.1
diff -u -u -r1.1 README.patch
--- README.patch	1999/11/14 20:49:29	1.1
+++ README.patch	1999/11/27 12:14:00
@@ -1,4 +1,4 @@
-Here are two patches for FreeBSD's kernel that are necessary for wine
+Here are some patches for FreeBSD's kernel that are necessary for wine
 (well not strictly _necessary_ but without them parts of it won't work.)
 They unfortunately didn't make it into the base distribution in time
 for the 3.3 release code freeze...
@@ -14,27 +14,50 @@
 correctly show a crash backtrace but all commands that use single-
 stepping failed.)
 
+patch-3.3-sys-fsgs:
+always set/use the sc_fs and sc_gs entries in the sigcontext struct,
+making -stable behave the same as -current there.  this should finally
+allow signal handling of a wine that was built on -stable to correctly
+run on -current too.  The corresponding wine change is in the port in
+patches/patch-af, it is also in wine's CVS tree now, so that file will
+disappear when the port is updated after the next wine release.
+(this one was MFC'd Nov 15 1999, so you only need it if you're running a
+system from the -stable branch older than that, like a 3.3-RELEASE.  If you
+happen to try to apply it when its already there patch(1) should complain
+`Reversed (or previously applied) patch detected!  Assume -R? [y]',
+just hit ^C then...)
+
 Apply as follows:
 
 	(cd /usr/src/sys && patch ) <patch-3.3-sys-ldtshare
 	(cd /usr/src/sys && patch ) <patch-3.3-sys-sigtrap
 
+And if you don't already have it:
+
+	(cd /usr/src/sys && patch ) <patch-3.3-sys-fsgs
+
 then build a new kernel. (don't forget to include the options USER_LDT,
 SYSVSHM, SYSVSEM, and SYSVMSG, wine needs these.)
 
+A note about local patches and ctm, cvsup and friends...
+(if you don't know what those are good for see for example
+http://www.freebsd.org/handbook/stable.html)
+ctm cannot deal with local patches (unless you use it to mirror
+the cvs tree of course, instead of the sources directly), with
+cvsup i'm not sure but in any case the workaround is simple:  use
+patch -R to un-apply any local patches before the update (feeding
+it the patches again as above on stdin), then when the update is
+finished apply them again.  Should they fail on the updated sources
+(and you cannot fix it yourself), look for new versions of the
+patches at the place where you got them, or in this case you
+can also look in my current wine port tree at
+http://www.jelal.kn-bremen.de/freebsd/ports/emulators/wine/files/
+
 -current users:
-someone of you :) needs to implement a runtime check in wine for the
-FreeBSD version and based on that use/set the sc_gs and sc_fs values
-in the sigcontext struct in signal handlers for versions >= 4.0.
-(see the `wine signal handlers lose %fs on FreeBSD' thread on the
-wine-devel list for details, can be read at
-http://www.integrita.com/cgi-local/lwgate.pl/WINE-DEVEL/archives/1999-09/Subject/article-15.html
-at least i ended up there when i searched it today.  yes you could also
-simply define FS_sig and GS_sig in wine's include/sig_context.h and be
-done with it but the resulting wine would only work on 4.0 and
-Alexandre (wine maintainer) didn't like that idea...)
-
-A LDT patch for -current is at http://www.freebsd.org/~luoqi
-(not included since i don't know if it still applies), the sigtrap
-patch looks like it could also apply to -current but i haven't tried.
-(and if not, i guess a similar fix will be committed soon anyway.)
+A LDT patch for -current is at http://www.freebsd.org/~luoqi/
+(well in a recent posting on the -current list,
+http://www.freebsd.org/cgi/mid.cgi?db=&id=199911150745.CAA27884@lor.watermarkgroup.com
+he said that version is outdated, seems you have to mail him to
+get a current one), the sigtrap patch looks like it could also
+apply to -current but i haven't tried.  And the fs/gs patch of course
+already is in -current.
Index: pkg/MESSAGE
===================================================================
RCS file: /home/cvs/cvs/ports/emulators/wine/pkg/MESSAGE,v
retrieving revision 1.1
diff -u -u -r1.1 MESSAGE
--- MESSAGE	1999/11/14 20:49:34	1.1
+++ MESSAGE	1999/11/21 02:11:59
@@ -2,3 +2,18 @@
 options USER_LDT, SYSVSHM, SYSVSEM, and SYSVMSG.  Before you do that,
 you may want to apply the patches in %%PREFIX%%/lib/wine to your
 kernel sources, see the README.patch there.
+
+(Note: if you already installed the patches from the 991031 version of
+this port and you're not tracking -stable or your -stable is older than
+Nov 15 1999:  there is a new patch you need, patch-3.3-sys-fsgs)
+
+And the port now also installs some of wine's doc files which
+describe additional things that are not in the manual pages, see
+%%PREFIX%%/lib/wine/documentation.  There are more in the source tree
+but the others are only useful in conjunction with the rest of the
+source tree, and then you can as well look at them there.  (If you
+just installed this as a package and don't know how to use the ports
+system to have it fetch and extract the source for you have a look at
+http://www.freebsd.org/handbook/ports.html .  In short:
+cd /usr/ports/emulators/wine && make configure )
+
Index: pkg/PLIST
===================================================================
RCS file: /home/cvs/cvs/ports/emulators/wine/pkg/PLIST,v
retrieving revision 1.4
diff -u -u -r1.4 PLIST
--- PLIST	1999/11/14 20:49:34	1.4
+++ PLIST	1999/11/20 16:01:06
@@ -1,10 +1,38 @@
 bin/wine
 bin/fnt2bdf
 bin/wineclipsrv
+bin/regapi
+bin/regSet.sh
 etc/wine.conf.sample
 etc/wine.sym
 lib/wine/README.patch
 lib/wine/patch-3.3-sys-ldtshare
 lib/wine/patch-3.3-sys-sigtrap
+lib/wine/patch-3.3-sys-fsgs
 lib/wine/winedefault.reg
+lib/wine/bug_report.pl
+lib/wine/reg/regFixer.pl
+lib/wine/reg/regRestorer.pl
+lib/wine/documentation/ANNOUNCE
+lib/wine/documentation/AUTHORS
+lib/wine/documentation/LICENSE
+lib/wine/documentation/WARRANTY
+lib/wine/documentation/README
+lib/wine/documentation/bugreports
+lib/wine/documentation/cdrom-labels
+lib/wine/documentation/config
+lib/wine/documentation/debugging
+lib/wine/documentation/dlls
+lib/wine/documentation/fonts
+lib/wine/documentation/ioport-trace-hints
+lib/wine/documentation/lables-and-serial-nubers
+lib/wine/documentation/no-windows
+lib/wine/documentation/printing
+lib/wine/documentation/psdriver
+lib/wine/documentation/psdrv.reg
+lib/wine/documentation/ttfserver
+lib/wine/documentation/README.debugger
+lib/wine/documentation/README.regapi
+@dirrm lib/wine/reg
+@dirrm lib/wine/documentation
 @dirrm lib/wine
--- /dev/null	Sun Nov 21 02:59:53 1999
+++ files/patch-3.3-sys-fsgs	Fri Nov 19 20:36:36 1999
@@ -0,0 +1,176 @@
+
+luoqi       1999/11/15 12:19:28 PST
+
+  Modified files:        (Branch: RELENG_3)
+    sys/i386/i386        genassym.c locore.s machdep.c 
+    sys/i386/include     cpufunc.h 
+  Log:
+  MFC: Save %fs and %gs in sigcontext when delivering signals and restore
+  them upon return.
+  
+  Revision  Changes    Path
+  1.62.2.3  +4 -1      src/sys/i386/i386/genassym.c
+  1.118.2.3 +11 -7     src/sys/i386/i386/locore.s
+  1.322.2.9 +5 -1      src/sys/i386/i386/machdep.c
+  1.85.2.2  +29 -1     src/sys/i386/include/cpufunc.h
+
+
+
+luoqi       1999/11/15 12:34:50 PST
+
+  Modified files:        (Branch: RELENG_3)
+    sys/pc98/i386        machdep.c 
+  Log:
+  MFC: Save %fs and %gs in sigcontext when delivering signals and restore
+  them upon return.
+  
+  Revision  Changes    Path
+  1.105.2.10 +5 -1      src/sys/pc98/i386/machdep.c
+
+
+
+Index: i386/i386/genassym.c
+===================================================================
+RCS file: /home/cvs/cvs/src/sys/i386/i386/genassym.c,v
+retrieving revision 1.62.2.2
+retrieving revision 1.62.2.3
+diff -p -u -r1.62.2.2 -r1.62.2.3
+--- src/sys/i386/i386/genassym.c	1999/08/29 16:05:40	1.62.2.2
++++ /home/cvs/cvs/src/sys/i386/i386/genassym.c	1999/11/15 20:19:23	1.62.2.3
+@@ -173,6 +173,9 @@ main()
+ 	printf("#define\tSIGF_SCP %#x\n", OS(sigframe, sf_scp));
+ 	printf("#define\tSIGF_HANDLER %#x\n", OS(sigframe, sf_handler));
+ 	printf("#define\tSIGF_SC %#x\n", OS(sigframe, sf_sc));
++	printf("#define\tSC_PS %#x\n", OS(sigcontext, sc_ps));
++	printf("#define\tSC_FS %#x\n", OS(sigcontext, sc_fs));
++	printf("#define\tSC_GS %#x\n", OS(sigcontext, sc_gs));
+ 
+ 	printf("#define\tB_READ %#x\n", B_READ);
+ 	printf("#define\tENOENT %d\n", ENOENT);
+Index: i386/i386/locore.s
+===================================================================
+RCS file: /home/cvs/cvs/src/sys/i386/i386/locore.s,v
+retrieving revision 1.118.2.2
+retrieving revision 1.118.2.3
+diff -p -u -r1.118.2.2 -r1.118.2.3
+--- src/sys/i386/i386/locore.s	1999/08/29 16:05:42	1.118.2.2
++++ /home/cvs/cvs/src/sys/i386/i386/locore.s	1999/11/15 20:19:24	1.118.2.3
+@@ -433,13 +433,17 @@ NON_GPROF_ENTRY(prepare_usermode)
+  */
+ NON_GPROF_ENTRY(sigcode)
+ 	call	SIGF_HANDLER(%esp)
+-	lea	SIGF_SC(%esp),%eax		/* scp (the call may have clobbered the */
+-						/* copy at 8(%esp)) */
+-	pushl	%eax
+-	pushl	%eax				/* junk to fake return address */
++	lea	SIGF_SC(%esp),%eax		/* scp (the copy at 8(%esp) */
++	pushl	%eax				/* may have been clobbered) */
++	testl	$PSL_VM,SC_PS(%eax)
++	jne	9f
++	movl	SC_FS(%eax),%fs			/* restore %fs */
++	movl	SC_GS(%eax),%gs			/* restore %gs */
++9:
++	pushl	%eax				/* junk to fake return addr */
+ 	movl	$SYS_sigreturn,%eax		/* sigreturn() */
+-	LCALL(0x7,0)				/* enter kernel with args on stack */
+-	hlt					/* never gets here */
++	LCALL(0x7,0)				/* enter kernel with args */
++0:	jmp	0b
+ 	ALIGN_TEXT
+ _esigcode:
+ 
+Index: i386/i386/machdep.c
+===================================================================
+RCS file: /home/cvs/cvs/src/sys/i386/i386/machdep.c,v
+retrieving revision 1.322.2.8
+retrieving revision 1.322.2.9
+diff -p -u -r1.322.2.8 -r1.322.2.9
+--- src/sys/i386/i386/machdep.c	1999/08/29 16:05:43	1.322.2.8
++++ /home/cvs/cvs/src/sys/i386/i386/machdep.c	1999/11/15 20:19:25	1.322.2.9
+@@ -579,6 +579,8 @@ sendsig(catcher, sig, mask, code)
+ 	sf.sf_sc.sc_ds = regs->tf_ds;
+ 	sf.sf_sc.sc_ss = regs->tf_ss;
+ 	sf.sf_sc.sc_es = regs->tf_es;
++	sf.sf_sc.sc_fs = rfs();
++	sf.sf_sc.sc_gs = rgs();
+ 	sf.sf_sc.sc_isp = regs->tf_isp;
+ 
+ 	/*
+@@ -643,6 +645,8 @@ sendsig(catcher, sig, mask, code)
+ 	regs->tf_cs = _ucodesel;
+ 	regs->tf_ds = _udatasel;
+ 	regs->tf_es = _udatasel;
++	load_fs(_udatasel);
++	load_gs(_udatasel);
+ 	regs->tf_ss = _udatasel;
+ }
+ 
+Index: i386/include/cpufunc.h
+===================================================================
+RCS file: /home/cvs/cvs/src/sys/i386/include/cpufunc.h,v
+retrieving revision 1.85.2.1
+retrieving revision 1.85.2.2
+diff -p -u -r1.85.2.1 -r1.85.2.2
+--- src/sys/i386/include/cpufunc.h	1999/08/29 16:06:26	1.85.2.1
++++ /home/cvs/cvs/src/sys/i386/include/cpufunc.h	1999/11/15 20:19:28	1.85.2.2
+@@ -424,6 +424,34 @@ static __inline void
+ wrmsr(u_int msr, u_int64_t newval)
+ {
+ 	__asm __volatile(".byte 0x0f, 0x30" : : "A" (newval), "c" (msr));
++}
++
++static __inline u_int
++rfs(void)
++{
++	u_int sel;
++	__asm __volatile("movl %%fs,%0" : "=rm" (sel));
++	return (sel);
++}
++
++static __inline u_int
++rgs(void)
++{
++	u_int sel;
++	__asm __volatile("movl %%gs,%0" : "=rm" (sel));
++	return (sel);
++}
++
++static __inline void
++load_fs(u_int sel)
++{
++	__asm __volatile("movl %0,%%fs" : : "rm" (sel));
++}
++
++static __inline void
++load_gs(u_int sel)
++{
++	__asm __volatile("movl %0,%%gs" : : "rm" (sel));
+ }
+ 
+ #else /* !__GNUC__ */
+Index: pc98/i386/machdep.c
+===================================================================
+RCS file: /home/cvs/cvs/src/sys/pc98/i386/machdep.c,v
+retrieving revision 1.105.2.9
+retrieving revision 1.105.2.10
+diff -p -u -r1.105.2.9 -r1.105.2.10
+--- src/sys/pc98/i386/machdep.c	1999/11/14 01:54:08	1.105.2.9
++++ /home/cvs/cvs/src/sys/pc98/i386/machdep.c	1999/11/15 20:34:48	1.105.2.10
+@@ -592,6 +592,8 @@ sendsig(catcher, sig, mask, code)
+ 	sf.sf_sc.sc_ds = regs->tf_ds;
+ 	sf.sf_sc.sc_ss = regs->tf_ss;
+ 	sf.sf_sc.sc_es = regs->tf_es;
++	sf.sf_sc.sc_fs = rfs();
++	sf.sf_sc.sc_gs = rgs();
+ 	sf.sf_sc.sc_isp = regs->tf_isp;
+ 
+ 	/*
+@@ -656,6 +658,8 @@ sendsig(catcher, sig, mask, code)
+ 	regs->tf_cs = _ucodesel;
+ 	regs->tf_ds = _udatasel;
+ 	regs->tf_es = _udatasel;
++	load_fs(_udatasel);
++	load_gs(_udatasel);
+ 	regs->tf_ss = _udatasel;
+ }
+ 
--- /dev/null	Sun Nov 21 03:01:19 1999
+++ patches/patch-af	Sun Nov 21 02:36:01 1999
@@ -0,0 +1,25 @@
+Index: dlls/ntdll/signal_i386.c
+@@ -183,10 +183,22 @@
+ #define ES_sig(context)      ((context)->sc_es)
+ #define SS_sig(context)      ((context)->sc_ss)
+                             
+-#ifdef linux
+ /* FS and GS are now in the sigcontext struct of FreeBSD, but not 
+  * saved by the exception handling. duh.
++ * Actually they are in -current (have been for a while), and that
++ * patch now finally has been MFC'd to -stable too (Nov 15 1999).
++ * If you're running a system from the -stable branch older than that,
++ * like a 3.3-RELEASE, grab the patch from the ports tree:
++ * ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/ports/emulators/wine/files/patch-3.3-sys-fsgs
++ * (If its not yet there when you look, go here:
++ * http://www.jelal.kn-bremen.de/freebsd/ports/emulators/wine/files/ )
+  */
++#ifdef __FreeBSD__
++#define FS_sig(context)      ((context)->sc_fs)
++#define GS_sig(context)      ((context)->sc_gs)
++#endif
++
++#ifdef linux
+ #define FS_sig(context)      ((context)->sc_fs)
+ #define GS_sig(context)      ((context)->sc_gs)
+ #define CR2_sig(context)     ((context)->cr2)
--- /dev/null	Sun Nov 21 03:01:26 1999
+++ patches/patch-au	Sat Nov 20 11:24:14 1999
@@ -0,0 +1,53 @@
+Index: server/ptrace.c
+@@ -36,6 +36,11 @@
+ #ifndef PTRACE_POKEDATA
+ #define PTRACE_POKEDATA PT_WRITE_D
+ #endif
++#ifdef __FreeBSD__
++#define PTRACE_KEEPIP 1
++#else
++#define PTRACE_KEEPIP 0
++#endif
+ 
+ static const int use_ptrace = 1;  /* set to 0 to disable ptrace */
+ 
+@@ -64,10 +69,10 @@
+             if (!thread)
+                 if (!(thread = get_thread_from_pid( pid ))) break;
+             if (!(thread->process->suspend + thread->suspend))
+-                ptrace( PTRACE_CONT, pid, 0, sig );
++                ptrace( PTRACE_CONT, pid, PTRACE_KEEPIP, sig );
+             break;
+         default:  /* ignore other signals for now */
+-            ptrace( PTRACE_CONT, pid, 0, sig );
++            ptrace( PTRACE_CONT, pid, PTRACE_KEEPIP, sig );
+             break;
+         }
+         if (signal && sig != signal) goto restart;
+@@ -97,7 +102,7 @@
+ static int attach_thread( struct thread *thread )
+ {
+     /* this may fail if the client is already being debugged */
+-    if (!use_ptrace || (ptrace( PTRACE_ATTACH, thread->unix_pid, 0, 0 ) == -1)) return 0;
++    if (!use_ptrace || (ptrace( PTRACE_ATTACH, thread->unix_pid, PTRACE_KEEPIP, 0 ) == -1)) return 0;
+     if (debug_level) fprintf( stderr, "ptrace: attached to pid %d\n", thread->unix_pid );
+     thread->attached = 1;
+     wait4_thread( thread, SIGSTOP );
+@@ -114,7 +119,7 @@
+     {
+         wait4_thread( thread, SIGTERM );
+         if (debug_level) fprintf( stderr, "ptrace: detaching from %d\n", thread->unix_pid );
+-        ptrace( PTRACE_DETACH, thread->unix_pid, 0, SIGTERM );
++        ptrace( PTRACE_DETACH, thread->unix_pid, PTRACE_KEEPIP, SIGTERM );
+         thread->attached = 0;
+     }
+ }
+@@ -137,7 +142,7 @@
+ {
+     if (!thread->unix_pid) return;
+     if (!thread->attached) kill( thread->unix_pid, SIGCONT );
+-    else ptrace( PTRACE_CONT, thread->unix_pid, 0, SIGSTOP );
++    else ptrace( PTRACE_CONT, thread->unix_pid, PTRACE_KEEPIP, SIGSTOP );
+ }
+ 
+ /* read an int from a thread address space */
--- /dev/null	Sun Nov 21 03:01:44 1999
+++ patches/patch-bc	Sun Nov 14 06:10:19 1999
@@ -0,0 +1,25 @@
+Index: programs/regapi/README
+@@ -60,7 +60,7 @@
+   regRestorer.pl  - Will convert "cleaned" diff file into 
+                     something "regapi-able"
+   
+-  regSet          - Will do the procedure explained herein 
++  regSet.sh       - Will do the procedure explained herein 
+                     for the added key only.
+ 
+   
+@@ -72,12 +72,12 @@
+   1 - Get a snapshot of your windows registry in before.reg, (regedit/export)
+   2 - Install you're application,
+   3 - Get a snapshot of your windows registry in after.reg.
+-  4 - Invoke ./regSet.sh before.reg after.reg
++  4 - Invoke regSet.sh before.reg after.reg
+ 
+ 
+   Adding key I have in a regedit export file (nothing to diff with...)
+   ------------------------------------------
+-  1 - Invoke ./regSet.sh /dev/null myRegistry.reg
++  1 - Invoke regSet.sh /dev/null myRegistry.reg
+ 
+   regapi help
+   -----------
--- /dev/null	Sun Nov 21 03:01:44 1999
+++ patches/patch-bd	Sun Nov 14 06:13:27 1999
@@ -0,0 +1,7 @@
+Index: winedefault.reg
+@@ -1,4 +1,5 @@
+ # These entries must apparently exist in any win95-compatible registry.
++# (feed this to `regapi setValue' to install)
+ 
+ # Shell Folders. The purpose of these are pretty self-evident.
+ # Primarily used by installation programs and the Explorer.
--- /dev/null	Sun Nov 21 03:02:10 1999
+++ patches/patch-be	Sat Nov 20 12:58:40 1999
@@ -0,0 +1,13 @@
+Index: documentation/fonts
+@@ -41,7 +41,10 @@
+ font tools that can convert them to the Type1 format but the 
+ quality of the resulting fonts is far from stellar. The other
+ way to use them is to get a font server capable of rendering 
+-TrueType (Caldera has one).
++TrueType (Caldera has one, there also is the free Xfstt in
++Linux/X11/fonts on sunsite and mirrors, if you're on FreeBSD you
++can use the port in /usr/ports/x11-servers/Xfstt.  And there is
++xfsft which uses the freetype library, see documentation/ttfserver).
+ 
+ However, there is a possibility of the native TrueType support 
+ via FreeType renderer in the future (hint, hint :-)
--- /dev/null	Sun Nov 21 03:14:28 1999
+++ patches/patch-ea	Sun Nov 21 03:04:44 1999
@@ -0,0 +1,88 @@
+From: mohr@elektron.ikp.physik.tu-darmstadt.de (Andreas Mohr)
+Newsgroups: local.list.wine.patches
+Subject: profile fix
+Date: 19 Nov 1999 11:47:40 +0100
+Organization: home
+Lines: 67
+Message-ID: <199911190815.JAA16531@hertz.ikp.physik.tu-darmstadt.de>
+Mime-Version: 1.0
+Content-Type: multipart/mixed; boundary=ELM942999323-16505-0_
+Content-Transfer-Encoding: 7bit
+X-Resent-Date: Fri, 19 Nov 1999 01:15:36 -0700
+X-To: wine-patches@winehq.com
+X-Mailer: ELM [version 2.4ME+ PL47 (25)]
+X-Resent-Message-ID: <gIikWB.A.V_.ocQN4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2148
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+--ELM942999323-16505-0_
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+
+Hi !
+
+OK, first Huw with the registry, now me with the profile handling :-\
+
+Fixed a gross bug in PROFILE_Open:
+Before making a newly opened file the current profile, not only
+the oldest profile should be flushed, but also the *old* current profile !!
+
+And nobody never ever found that bug. VERY strange...
+
+Andreas Mohr
+
+--ELM942999323-16505-0_
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: attachment; filename=diff.profile
+Content-Description: /home/mohr/diff.profile
+Content-Transfer-Encoding: 7bit
+
+Index: files/profile.c
+===================================================================
+RCS file: /home/wine/wine/files/profile.c,v
+retrieving revision 1.15
+diff -u -w -r1.15 profile.c
+--- files/profile.c	1999/10/31 17:32:57	1.15
++++ files/profile.c	1999/11/19 08:07:49
+@@ -373,6 +373,7 @@
+         return FALSE;
+     }
+ 
++	TRACE("Trying to flush %s. [%d]\n", CurProfile->dos_name, CurProfile->changed);
+     if (!CurProfile->changed || !CurProfile->dos_name) return TRUE;
+     if (!(unix_name = CurProfile->unix_name) || !(file = fopen(unix_name, "w")))
+     {
+@@ -494,8 +495,10 @@
+          }
+       }
+ 
+-    /* Rotate the oldest to the top to be replaced */
++	/* Flush the old current profile */
++	PROFILE_FlushFile();
+ 
++    /* Make the oldest profile the current one only in order to get rid of it */
+     if(i==N_CACHED_PROFILES)
+       {
+        tempProfile=MRUProfile[N_CACHED_PROFILES-1];
+@@ -503,11 +506,9 @@
+           MRUProfile[i]=MRUProfile[i-1];
+        CurProfile=tempProfile;
+       }
+-
+-    /* Flush the profile */
+-
+     if(CurProfile->filename) PROFILE_ReleaseFile();
+ 
++	/* OK, now that CurProfile is definitely free we assign it our new file */
+     newdos_name = HEAP_strdupA( SystemHeap, 0, full_name.short_name );
+     CurProfile->dos_name  = newdos_name;
+     CurProfile->filename  = HEAP_strdupA( SystemHeap, 0, filename );
+
+--ELM942999323-16505-0_--
+
+---
--- /dev/null	Sun Nov 21 03:14:42 1999
+++ patches/patch-eb	Sun Nov 21 03:05:34 1999
@@ -0,0 +1,57 @@
+From: weigand@informatik.uni-erlangen.de (Ulrich Weigand)
+Newsgroups: local.list.wine.patches
+Subject: Bugfix: GetThreadSelectorEntry() and read-write flag
+Date: 19 Nov 1999 00:37:52 +0100
+Organization: home
+Lines: 35
+Message-ID: <199911181807.TAA00875@faui11.informatik.uni-erlangen.de>
+MIME-Version: 1.0
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+X-Resent-Date: Thu, 18 Nov 1999 11:07:48 -0700
+X-To: wine-patches@winehq.com
+X-Mailer: ELM [version 2.4 PL24]
+X-Resent-Message-ID: <QXxWWB.A.n8C.zBEN4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2142
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+Hello,
+
+GetThreadSelectorEntry() reported read-only segments as read-write and
+vice versa.  This caused a bug in native OLE thunking code, affecting
+(at least) WinWord ...
+
+Bye,
+Ulrich
+
+ChangeLog:
+
+	* memory/selector.c
+	Bugfix: GetThreadSelectorEntry() sets read-write flag incorrectly.
+
+
+Index: memory/selector.c
+diff -ur wine-cvs/memory/selector.c wine-uw/memory/selector.c
+--- wine-cvs/memory/selector.c	Wed Nov 17 15:51:16 1999
++++ wine-uw/memory/selector.c	Wed Nov 17 16:43:21 1999
+@@ -621,7 +621,7 @@
+     ldtent->HighWord.Bits.Sys = 0;
+     ldtent->HighWord.Bits.Pres = 1;
+     ldtent->HighWord.Bits.Type = 0x10|(ldtentry.type << 2);
+-    if (ldtentry.read_only)
++    if (!ldtentry.read_only)
+     	ldtent->HighWord.Bits.Type|=0x2;
+     ldtent->HighWord.Bits.Granularity = ldtentry.limit_in_pages;
+     ldtent->HighWord.Bits.Default_Big = ldtentry.seg_32bit;
+
+-- 
+  Ulrich Weigand,
+  IMMD 1, Universitaet Erlangen-Nuernberg,
+  Martensstr. 3, D-91058 Erlangen, Phone: +49 9131 85-7688
+
+---
--- /dev/null	Sun Nov 21 03:14:45 1999
+++ patches/patch-ec	Sun Nov 21 03:06:04 1999
@@ -0,0 +1,124 @@
+From: mohr@elektron.ikp.physik.tu-darmstadt.de (Andreas Mohr)
+Newsgroups: local.list.wine.patches
+Subject: DISPLAY driver addition take 2
+Date: 16 Nov 1999 19:33:02 +0100
+Organization: home
+Lines: 103
+Message-ID: <199911161313.OAA13466@hertz.ikp.physik.tu-darmstadt.de>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary=ELM942758003-13460-0_
+Content-Transfer-Encoding: 7bit
+X-Resent-Date: Tue, 16 Nov 1999 06:13:37 -0700
+X-To: wine-patches@winehq.com
+X-Mailer: ELM [version 2.4ME+ PL47 (25)]
+X-Resent-Message-ID: <sYNqV.A.goD.BiVM4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2133
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+--ELM942758003-13460-0_
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+
+Hi,
+
+add some ordinals and GetDriverResourceID().                                    
+
+And of course I added the info Huw gave :)
+
+Andreas Mohr
+
+--ELM942758003-13460-0_
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: attachment; filename=diff.display
+Content-Description: /home/mohr/diff.display
+Content-Transfer-Encoding: 7bit
+
+Index: if1632/display.spec
+===================================================================
+RCS file: /home/wine/wine/if1632/display.spec,v
+retrieving revision 1.5
+diff -u -w -r1.5 display.spec
+--- if1632/display.spec	1999/05/23 09:18:30	1.5
++++ if1632/display.spec	1999/11/16 14:03:35
+@@ -22,6 +22,24 @@
+ 19  stub DeviceBitmapBits
+ 20  stub CreateBitmap
+ 21  stub DIBScreenBlt
++
++# ATI driver exports
++22 stub SetPalette
++23 stub GetPalette
++24 stub SetPaletteTranslate
++25 stub GetPaletteTranslate
++26 stub UpdateColors
++27 stub StretchBlt
++28 stub StrechDIBits
++29 stub SelectBitmap
++30 stub BitmapBits
++31 stub ReEnable
++# these conflict with ordinals 19-21, thus relocated to 39-41 !
++39 stub DIBBlt
++40 stub CreateDIBitmap
++41 stub DIBToDevice
++# ATI driver end
++
+ 90  stub Do_Polylines
+ 91  stub Do_Scanlines
+ 92  stub SaveScreenBitmap
+@@ -29,7 +47,14 @@
+ 102 pascal16 SetCursor(ptr) DISPLAY_SetCursor
+ 103 pascal16 MoveCursor(word word) DISPLAY_MoveCursor
+ 104 pascal16 CheckCursor() DISPLAY_CheckCursor
++400 stub PExtTextOut
++401 stub PStrBlt
++402 stub RExtTextOut
++403 stub RStrBlt
++450 pascal GetDriverResourceID(word str) DISPLAY_GetDriverResourceID
+ 500 pascal16 UserRepaintDisable(word) UserRepaintDisable16
++501 stub ORDINAL_ONLY1
++502 stub ORDINAL_ONLY2
+ 600 stub InkReady
+ 601 stub GetLPDevice
+ 
+Index: windows/display.c
+===================================================================
+RCS file: /home/wine/wine/windows/display.c,v
+retrieving revision 1.16
+diff -u -w -r1.16 display.c
+--- windows/display.c	1999/07/04 16:09:20	1.16
++++ windows/display.c	1999/11/16 14:03:35
+@@ -50,6 +50,25 @@
+ }
+ 
+ /***********************************************************************
++ *           DISPLAY_GetDriverResourceID                  (DISPLAY.450)
++ *
++ * Used by USER to check if driver contains better version of a builtin
++ * resource than USER.
++ * wQueriedResID is the ID USER asks about.
++ * lpsResName might often contain "OEMBIN".
++ * For now we just let USER use its own resource.
++ */
++DWORD WINAPI DISPLAY_GetDriverResourceID( WORD wQueriedResID, LPSTR lpsResName )
++{
++    FIXME("Return the display resource ID\n" );
++
++	if (wQueriedResID == 3)
++		return (DWORD)wQueriedResID/*FIXME resourceID*/;
++
++	return (DWORD)wQueriedResID;
++}
++
++/***********************************************************************
+  *           UserRepaintDisable			(DISPLAY.500)
+  */
+ VOID WINAPI UserRepaintDisable16( BOOL16 disable )
+
+--ELM942758003-13460-0_--
+
+---
--- /dev/null	Sun Nov 21 03:14:45 1999
+++ patches/patch-ed	Sun Nov 21 03:06:29 1999
@@ -0,0 +1,75 @@
+From: mohr@elektron.ikp.physik.tu-darmstadt.de (Andreas Mohr)
+Newsgroups: local.list.wine.patches
+Subject: shlmenu fix
+Date: 16 Nov 1999 19:32:35 +0100
+Organization: home
+Lines: 54
+Message-ID: <199911161303.OAA13412@hertz.ikp.physik.tu-darmstadt.de>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary=ELM942757435-13379-0_
+Content-Transfer-Encoding: 7bit
+X-Resent-Date: Tue, 16 Nov 1999 06:04:08 -0700
+X-To: wine-patches@winehq.com
+X-Mailer: ELM [version 2.4ME+ PL47 (25)]
+X-Resent-Message-ID: <JN9fkD.A.GjD.IZVM4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2132
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+--ELM942757435-13379-0_
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7bit
+
+Hi,
+
+SHFind_InitMenuPopup is supposed to return a pointer.
+Makes my Explorer version happy again.
+
+Andreas Mohr
+
+--ELM942757435-13379-0_
+Content-Type: text/plain; charset=iso-8859-1
+Content-Disposition: attachment; filename=diff.shlmenu
+Content-Description: /home/mohr/diff.shlmenu
+Content-Transfer-Encoding: 7bit
+
+Index: dlls/shell32/shlmenu.c
+===================================================================
+RCS file: /home/wine/wine/dlls/shell32/shlmenu.c,v
+retrieving revision 1.7
+diff -u -w -r1.7 shlmenu.c
+--- dlls/shell32/shlmenu.c	1999/10/13 12:28:25	1.7
++++ dlls/shell32/shlmenu.c	1999/11/16 13:55:36
+@@ -764,15 +764,19 @@
+  *
+  *
+  * PARAMETERS
+- *  hMenu		[in] handel of menu previously created
++ *  hMenu		[in] handle of menu previously created
+  *  hWndParent	[in] parent window
+- *  w			[in] no pointer
+- *  x			[in] no pointer
++ *  w			[in] no pointer (0x209 over here) perhaps menu IDs ???
++ *  x			[in] no pointer (0x226 over here)
++ *
++ * RETURNS
++ *  LPXXXXX			 pointer to struct containing a func addr at offset 8
++ *					 or NULL at failure.
+  */
+-HRESULT WINAPI SHFind_InitMenuPopup (HMENU hMenu, HWND hWndParent, DWORD w, DWORD x)
++LPVOID WINAPI SHFind_InitMenuPopup (HMENU hMenu, HWND hWndParent, DWORD w, DWORD x)
+ {	FIXME("hmenu=0x%08x hwnd=0x%08x 0x%08lx 0x%08lx stub\n",
+ 		hMenu,hWndParent,w,x);
+-	return TRUE;
++	return NULL; /* this is supposed to be a pointer */
+ }
+ 
+ /*************************************************************************
+
+--ELM942757435-13379-0_--
+
+---
--- /dev/null	Sun Nov 21 03:14:53 1999
+++ patches/patch-ee	Sun Nov 21 03:06:59 1999
@@ -0,0 +1,258 @@
+From: rklazes@casema.net (Rein Klazes)
+Newsgroups: local.list.wine.patches
+Subject: 16 bits dialog patch.
+Date: 16 Nov 1999 19:31:16 +0100
+Organization: -++-
+Lines: 232
+Message-ID: <199911161137.EAA11876@ursula.gmcl.com>
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="--=_6UExOKVVL1eFPpiMs=Y5SwSVvDwS.MFSBCHJLHS"
+X-Resent-Date: Tue, 16 Nov 1999 04:37:34 -0700
+X-To: wine-patches@winehq.com
+X-Mailer: Forte Agent 1.6/32.525
+X-Resent-Message-ID: <ELvLED.A.u5C.-HUM4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2131
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+----=_6UExOKVVL1eFPpiMs=Y5SwSVvDwS.MFSBCHJLHS
+Content-Type: text/plain; charset=us-ascii
+Content-Transfer-Encoding: 7bit
+
+Hi,
+
+I have an application here that has stopped working since the
+introduction of 32 bit message queues.
+
+The application breaks when it posts a WM_COMMAND message using
+PostMessage16. 
+
+The message is received by a  GetMessage and dispatched by
+DispatchMessageA in DIALOG_DoDialogBox(). However these are win32
+functions and when calling the 16 bit dialogproc, a message
+translation 32->16 bits is done which messes up the parameters.
+
+The patch corrects this in a trivial way by adding a parameter to
+DIALOG_DoDialogBox() that flags whether 16 bits functions should be
+used. 
+
+If there is a better way do fix this problem then let me know.
+
+Files:
+./include/dialog.h
+./windows/dialog.c
+./dlls/commdlg/colordlg.c
+./dlls/commdlg/filedlg.c
+./dlls/commdlg/fontdlg.c
+./dlls/commdlg/printdlg.c
+
+Changelog:
+Correct handling of 16 bits messages in DIALOG_DoDialogBox()
+
+Rein.
+-- 
+Rein Klazes
+rklazes@casema.net
+
+----=_6UExOKVVL1eFPpiMs=Y5SwSVvDwS.MFSBCHJLHS
+Content-Type: text/plain; charset=us-ascii; name=dlg16.diff
+Content-Transfer-Encoding: 7bit
+Content-Disposition: attachment; filename=dlg16.diff
+
+Index: include/dialog.h
+--- ./wine/./include/dialog.h	Sun Apr 25 14:36:53 1999
++++ ./mywine/./include/dialog.h	Tue Nov 16 11:49:40 1999
+@@ -43,6 +43,6 @@
+                                      BOOL win32Template, HWND owner,
+                                      DLGPROC16 dlgProc, LPARAM param,
+                                      WINDOWPROCTYPE procType );
+-extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner );
++extern INT DIALOG_DoDialogBox( HWND hwnd, HWND owner, BOOL iswin16);
+ 
+ #endif  /* __WINE_DIALOG_H */
+Index: windows/dialog.c
+--- ./wine/./windows/dialog.c	Sun Nov  7 22:02:17 1999
++++ ./mywine/./windows/dialog.c	Tue Nov 16 11:50:43 1999
+@@ -22,6 +22,7 @@
+ #include "winproc.h"
+ #include "message.h"
+ #include "debugtools.h"
++#include "struct32.h"
+ 
+ DEFAULT_DEBUG_CHANNEL(dialog)
+ 
+@@ -929,7 +930,7 @@
+ /***********************************************************************
+  *           DIALOG_DoDialogBox
+  */
+-INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
++INT DIALOG_DoDialogBox( HWND hwnd, HWND owner, BOOL iswin16 )
+ {
+     WND * wndPtr;
+     DIALOGINFO * dlgInfo;
+@@ -948,11 +949,24 @@
+         while (MSG_InternalGetMessage(&msg, hwnd, owner, MSGF_DIALOGBOX, 
+                                       PM_REMOVE, !(wndPtr->dwStyle & DS_NOIDLEMSG), NULL ))
+         {
+-            if (!IsDialogMessageA( hwnd, &msg))
++            if(iswin16)
+             {
+-                TranslateMessage( &msg );
+-                DispatchMessageA( &msg );
++                MSG16 msg16;
++                
++                STRUCT32_MSG32to16( &msg, &msg16 );
++
++                if (!IsDialogMessage16( hwnd, &msg16))
++                {
++                    TranslateMessage16( &msg16 );
++                    DispatchMessage16( &msg16 );
++                }
+             }
++            else
++                if (!IsDialogMessageA( hwnd, &msg))
++                {
++                    TranslateMessage( &msg );
++                    DispatchMessageA( &msg );
++                }
+             if (dlgInfo->flags & DF_END) break;
+         }
+         EnableWindow( owner, TRUE );
+@@ -981,7 +995,7 @@
+                                HWND16 owner, DLGPROC16 dlgProc, LPARAM param )
+ {
+     HWND16 hwnd = CreateDialogParam16( hInst, template, owner, dlgProc, param);
+-    if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner, TRUE );
+     return -1;
+ }
+ 
+@@ -993,7 +1007,7 @@
+                                 HWND owner, DLGPROC dlgProc, LPARAM param )
+ {
+     HWND hwnd = CreateDialogParamA( hInst, name, owner, dlgProc, param );
+-    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner , FALSE);
+     return -1;
+ }
+ 
+@@ -1005,7 +1019,7 @@
+                                 HWND owner, DLGPROC dlgProc, LPARAM param )
+ {
+     HWND hwnd = CreateDialogParamW( hInst, name, owner, dlgProc, param );
+-    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner, FALSE);
+     return -1;
+ }
+ 
+@@ -1033,7 +1047,7 @@
+     if (!(ptr = GlobalLock16( dlgTemplate ))) return -1;
+     hwnd = CreateDialogIndirectParam16( hInst, ptr, owner, dlgProc, param );
+     GlobalUnlock16( dlgTemplate );
+-    if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return (INT16)DIALOG_DoDialogBox( hwnd, owner, TRUE );
+     return -1;
+ }
+ 
+@@ -1047,7 +1061,7 @@
+ {
+     HWND hwnd = CreateDialogIndirectParamA( hInstance, template,
+                                                 owner, dlgProc, param );
+-    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner, FALSE );
+     return -1;
+ }
+ 
+@@ -1061,7 +1075,7 @@
+ {
+     HWND hwnd = CreateDialogIndirectParamW( hInstance, template,
+                                                 owner, dlgProc, param );
+-    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner );
++    if (hwnd) return DIALOG_DoDialogBox( hwnd, owner, FALSE );
+     return -1;
+ }
+ 
+Index: dlls/commdlg/colordlg.c
+--- ./wine/./dlls/commdlg/colordlg.c	Sat Jul 24 12:27:58 1999
++++ ./mywine/./dlls/commdlg/colordlg.c	Tue Nov 16 10:18:12 1999
+@@ -108,7 +108,8 @@
+                                         lpChCol->hwndOwner,
+                                         (DLGPROC16)ColorDlgProc,
+                                         (DWORD)lpChCol, WIN_PROC_32A );
+-    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpChCol->hwndOwner);
++    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpChCol->hwndOwner,
++            TRUE);
+     if (hDlgTmpl) FreeResource16( hDlgTmpl );
+ 
+     return bRet;
+Index: dlls/commdlg/filedlg.c
+--- ./wine/./dlls/commdlg/filedlg.c	Wed Oct 13 15:51:57 1999
++++ ./mywine/./dlls/commdlg/filedlg.c	Tue Nov 16 10:21:52 1999
+@@ -251,7 +251,7 @@
+                                         lpofn->hwndOwner,
+                                         (DLGPROC16)FileOpenDlgProc,
+                                         ofn, WIN_PROC_32A );
+-    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner );
++    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner, TRUE );
+ 
+     if (str1)
+       {
+@@ -413,7 +413,7 @@
+                                         lpofn->hwndOwner,
+                                         (DLGPROC16)FileSaveDlgProc,
+                                         ofn, WIN_PROC_32A );
+-    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner );
++    if (hwndDialog) bRet = DIALOG_DoDialogBox( hwndDialog, lpofn->hwndOwner, TRUE );
+ 
+     if (str1)
+       {
+Index: dlls/commdlg/fontdlg.c
+--- ./wine/./dlls/commdlg/fontdlg.c	Sat Jul 24 12:27:58 1999
++++ ./mywine/./dlls/commdlg/fontdlg.c	Tue Nov 16 10:23:04 1999
+@@ -124,7 +124,7 @@
+                                         lpChFont->hwndOwner,
+                                         (DLGPROC16)FormatCharDlgProcA,
+                                         (DWORD)lpChFont, WIN_PROC_32A );
+-    if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner);
++    if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner, TRUE);
+     if (hDlgTmpl) FreeResource16( hDlgTmpl );
+     lpChFont->lpTemplateName=lpTemplateName;
+     FONT_LogFont32ATo16(cf32a.lpLogFont, 
+@@ -160,7 +160,7 @@
+     CF_ENABLETEMPLATEHANDLE)) FIXME(": unimplemented flag (ignored)\n");
+   hwndDialog = DIALOG_CreateIndirect(hInst, template, TRUE, lpChFont->hwndOwner,
+             (DLGPROC16)FormatCharDlgProcA, (LPARAM)lpChFont, WIN_PROC_32A );
+-  if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner);  
++  if (hwndDialog) bRet = DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner, TRUE);  
+   return bRet;
+ }
+ 
+@@ -199,7 +199,7 @@
+   lpChFont->lpTemplateName=(LPWSTR)&cf32a;
+   hwndDialog=DIALOG_CreateIndirect(hInst, template, TRUE, lpChFont->hwndOwner,
+             (DLGPROC16)FormatCharDlgProcW, (LPARAM)lpChFont, WIN_PROC_32W );
+-  if (hwndDialog)bRet=DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner);  
++  if (hwndDialog)bRet=DIALOG_DoDialogBox(hwndDialog, lpChFont->hwndOwner, TRUE);  
+   HeapFree(GetProcessHeap(), 0, cf32a.lpszStyle);
+   lpChFont->lpTemplateName=(LPWSTR)cf32a.lpTemplateName;
+   memcpy(lpChFont->lpLogFont, &lf32a, sizeof(CHOOSEFONTA));
+Index: dlls/commdlg/printdlg.c
+--- ./wine/./dlls/commdlg/printdlg.c	Sun Nov 14 08:08:30 1999
++++ ./mywine/./dlls/commdlg/printdlg.c	Tue Nov 16 10:23:35 1999
+@@ -288,7 +288,7 @@
+             (DLGPROC16)PrintDlgProcA, (LPARAM)&PrintStructures, WIN_PROC_32A );
+         }
+     if (hwndDialog) 
+-        bRet = DIALOG_DoDialogBox(hwndDialog, lppd->hwndOwner);  
++        bRet = DIALOG_DoDialogBox(hwndDialog, lppd->hwndOwner, TRUE);  
+      
+     /* free memory & resources
+      */   
+
+----=_6UExOKVVL1eFPpiMs=Y5SwSVvDwS.MFSBCHJLHS--
+
+---
--- /dev/null	Sun Nov 21 03:14:53 1999
+++ patches/patch-ef	Sun Nov 21 03:07:36 1999
@@ -0,0 +1,139 @@
+From: juergen.schmied@debitel.net ("Juergen Schmied")
+Newsgroups: local.list.wine.patches
+Subject: some bugs in filedlg
+Date: 15 Nov 1999 21:36:25 +0100
+Organization: at home
+Lines: 118
+Message-ID: <19991115194143.22977.qmail@psmtp1.dnsg.net>
+Mime-Version: 1.0
+Content-Type: Multipart/Mixed; boundary=Message-Boundary-2348
+X-Resent-Date: Mon, 15 Nov 1999 12:41:54 -0700
+X-To: wine-patches@winehq.com
+X-Reply-to: juergen.schmied@debitel.net
+X-Priority: normal
+X-Mailer: Pegasus Mail for Win32 (v3.11)
+X-Resent-Message-ID: <4zm7fB.A.roD.CIGM4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2128
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+--Message-Boundary-2348
+Content-type: text/plain; charset=US-ASCII
+Content-transfer-encoding: 7BIT
+Content-description: Mail message body
+
+[dlls/commdlg/filedlg95.c]
+- the fodInfos were used before initialized
+- lpTemplateName can be a resource id
+- if lpTemplateName is a string don't free the original one
+
+---
+the first one caused a chrash accessing a low memory address, 
+the second one a heap error while MemFree and a possible chrash 
+when using the unicode version, the third one could possibly cause 
+a crash in the app later ...
+
+Happy crashing..... ;-))))
+
+PS: now the "Message Save" of Agent dialog works but look 
+strange due to wrong control positions...
+
+juergen
+ 
+
+---
+juergen.schmied@debitel.net
+
+... from sunny Berlin
+
+
+--Message-Boundary-2348
+Content-type: text/plain; charset=US-ASCII
+Content-transfer-encoding: 7BIT
+Content-description: Text from file '991115.dif'
+
+Index: dlls/commdlg/filedlg95.c
+===================================================================
+RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
+retrieving revision 1.18
+diff -u -r1.18 filedlg95.c
+--- wine/dlls/commdlg/filedlg95.c	1999/11/14 21:29:24	1.18
++++ wine/dlls/commdlg/filedlg95.c	1999/11/15 20:10:51
+@@ -281,8 +281,14 @@
+   fodInfos->ofnInfos.lCustData = ofn->lCustData;
+   fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
+ 
+-  if (ofn->lpTemplateName)
++  if HIWORD(ofn->lpTemplateName)
+   {
++      fodInfos->ofnInfos.lpTemplateName = MemAlloc(strlen(ofn->lpTemplateName)+1);
++      strcpy ((LPSTR)fodInfos->ofnInfos.lpTemplateName, ofn->lpTemplateName);
++  }
++  else
++  {
++      /* resource id */
+       fodInfos->ofnInfos.lpTemplateName = ofn->lpTemplateName;
+   }
+ 
+@@ -321,7 +327,7 @@
+ 
+   if (fodInfos->ofnInfos.lpstrFilter)
+       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter));
+-  if (fodInfos->ofnInfos.lpTemplateName)
++  if  HIWORD(fodInfos->ofnInfos.lpTemplateName)
+       MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
+   if (fodInfos->ofnInfos.lpstrDefExt)
+       MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt));
+@@ -441,11 +447,17 @@
+   }
+   fodInfos->ofnInfos.lCustData = ofn->lCustData;
+   fodInfos->ofnInfos.lpfnHook = (LPOFNHOOKPROC)ofn->lpfnHook;
+-  if (ofn->lpTemplateName) 
++
++  if HIWORD(ofn->lpTemplateName) 
+   { 
+     fodInfos->ofnInfos.lpTemplateName = (LPSTR)MemAlloc(lstrlenW(ofn->lpTemplateName)+1);
+     lstrcpyWtoA((LPSTR)fodInfos->ofnInfos.lpTemplateName,ofn->lpTemplateName);
+   }
++  else
++  {
++      /* resource id */
++      fodInfos->ofnInfos.lpTemplateName = (LPSTR)ofn->lpTemplateName;
++  }
+   /* Initialise the dialog property */
+   fodInfos->DlgInfos.dwDlgProp = 0;
+   
+@@ -816,10 +828,14 @@
+  */
+ HRESULT WINAPI FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+ {
+-
+   switch(uMsg)
+   {
+     case WM_INITDIALOG :
++
++         /* Adds the FileOpenDlgInfos in the property list of the dialog 
++            so it will be easily accessible through a GetPropA(...) */
++      	 SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) lParam);
++
+       	 ((FileOpenDlgInfos *)lParam)->DlgInfos.hwndCustomDlg = 
+      	CreateTemplateDialog((FileOpenDlgInfos *)lParam,hwnd);
+       	 FILEDLG95_OnWMInitDialog(hwnd, wParam, lParam);
+@@ -862,10 +878,6 @@
+   FileOpenDlgInfos *fodInfos = (FileOpenDlgInfos *) lParam;
+ 
+   TRACE("\n");
+-
+-  /* Adds the FileOpenDlgInfos in the property list of the dialog 
+-     so it will be easily accessible through a GetPropA(...) */
+-  SetPropA(hwnd, FileOpenDlgInfosStr, (HANDLE) fodInfos);
+ 
+   /* Make sure the common control DLL is loaded */      
+   InitCommonControls();
+
+--Message-Boundary-2348--
+
+---
--- /dev/null	Sun Nov 21 03:14:53 1999
+++ patches/patch-eg	Sun Nov 21 03:08:08 1999
@@ -0,0 +1,60 @@
+From: juergen.schmied@debitel.net ("Juergen Schmied")
+Newsgroups: local.list.wine.patches
+Subject: filedlg - one more
+Date: 16 Nov 1999 00:11:58 +0100
+Organization: at home
+Lines: 27
+Message-ID: <19991115215001.16292.qmail@psmtp2.dnsg.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=US-ASCII
+Content-Transfer-Encoding: 7BIT
+NNTP-Posting-Date: 15 Nov 1999 23:12:03 GMT
+X-Resent-Date: Mon, 15 Nov 1999 14:50:22 -0700
+X-To: wine-patches@winehq.com
+X-Reply-to: juergen.schmied@debitel.net
+X-Priority: normal
+X-Mailer: Pegasus Mail for Win32 (v3.11)
+X-Resent-Message-ID: <9rUtNC.A.eLF.eAIM4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2129
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+I forgot one place:
+
+can you pls. change in 
+
+dlls/commdlg/filedlg95.c
+
+function  GetFileDialog95W()
+
+from
+
+  if (fodInfos->ofnInfos.lpTemplateName)
+    MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
+to
+
+  if HIWORD (fodInfos->ofnInfos.lpTemplateName)
+    MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
+
+Bye
+
+juergen
+
+---
+juergen.schmied@debitel.net
+
+... from sunny Berlin
+
+---
+Index: dlls/commdlg/filedlg95.c
+@@ -486,7 +486,7 @@
+ 
+   if (fodInfos->ofnInfos.lpstrFilter)
+     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrFilter));
+-  if (fodInfos->ofnInfos.lpTemplateName)
++  if (HIWORD(fodInfos->ofnInfos.lpTemplateName))
+     MemFree((LPVOID)(fodInfos->ofnInfos.lpTemplateName));
+   if (fodInfos->ofnInfos.lpstrDefExt)
+     MemFree((LPVOID)(fodInfos->ofnInfos.lpstrDefExt));
--- /dev/null	Sun Nov 21 03:15:03 1999
+++ patches/patch-eh	Sun Nov 21 03:08:41 1999
@@ -0,0 +1,367 @@
+From: tomasek@etf.cuni.cz (Petr Tomasek)
+Newsgroups: local.list.wine.patches
+Subject: Auto reading of labels & serial numbers. (fwd)
+Date: 15 Nov 1999 21:22:36 +0100
+Organization: home
+Lines: 295
+Message-ID: <Pine.LNX.4.04.9911151313350.2292-200000@ebed.etf.cuni.cz>
+Mime-Version: 1.0
+Content-Type: MULTIPART/MIXED; BOUNDARY="1908605701-2102248834-942667042=:1411"
+Content-ID: <Pine.LNX.4.04.9911151313351.2292@ebed.etf.cuni.cz>
+X-Resent-Date: Mon, 15 Nov 1999 05:16:28 -0700
+X-To: wine-patches@winehq.com
+X-Resent-Message-ID: <z4vwk.A.na.cm_L4@ursula.gmcl.com>
+X-Resent-From: wine-patches@winehq.com
+X-Reply-To: wine-devel@winehq.com
+X-Mailing-List: <wine-patches@winehq.com> archive/latest/2126
+X-Loop: wine-patches@winehq.com
+X-Precedence: list
+X-Resent-Sender: wine-patches-request@winehq.com
+
+
+Hello!
+
+I've made a patch, that allows wine to read labels and
+serial numbers directly from the device (no more having to
+be specified in the wine.conf file).
+
+For doc see Documentation/labels-and-serial-numbers.
+
+One more issue: I had to create procedure named
+'PROFILE_ExistWineString' (in profile.c), that checks,
+whether certain entry exists in the wine.conf. You may want
+to change its name to something better....
+
+Best Wishes
+
+Petr Tomasek
+
+BTW, could I be informed, whether the patch was accepted to
+the CVS /Wine release? Thanks!
+
+
+--
+Petr Tomasek, http://www.etf.cuni.cz/~tomasek/
+
+Index: documentation/cdrom-labels
+diff -ruN wine-991031/documentation/cdrom-labels wine-991031-new/documentation/cdrom-labels
+--- wine-991031/documentation/cdrom-labels	Sun Jun  6 19:28:20 1999
++++ wine-991031-new/documentation/cdrom-labels	Sun Nov 14 14:41:08 1999
+@@ -1,3 +1,7 @@
+++-----------------------------------------------------------------------------+
++| This doc is obsolate now. See 'labels-and-serial-nubmers' for current info. |
+++-----------------------------------------------------------------------------+
++
+ *** VOLUME LABEL
+ 
+ If a program depends on the correct label and/or serial number for the
+Index: documentation/lables-and-serial-nubers
+diff -ruN wine-991031/documentation/lables-and-serial-nubers wine-991031-new/documentation/lables-and-serial-nubers
+--- documentation/lables-and-serial-nubers	Thu Jan  1 01:00:00 1970
++++ documentation/lables-and-serial-nubers	Sun Nov 14 16:12:01 1999
+@@ -0,0 +1,88 @@
++[FIXME - can someone translate this into (real) english? :)) ]
++[FIXME - update the 'Documentation/config' accordingly]
++
++
++		Drive Labels and Serial Numbers with wine.
++		-----------------------------------------
++
++	Until now, You had to specify drive labels and serial numbers in wine 
++config file manually. For now, wine can read them directly from the device.
++	This may be usefull mainly for programs distributed on CD-Roms, that
++check for volume label at the setup or when accesing the disc.  
++
++WHAT'S SUPPORTED ?
++
++    *	FAT systems (types 'hd' and 'floppy'): reads labels and serial num's.
++    * 	Iso9660 ('cdrom'):                     reads labels only.
++
++HOW TO SET UP ?
++
++	There are two ways: You can either set 'ReadLabelFromDevice=' and
++'ReadSerialFromDevice=' in [Drive X] section in Your wine.conf (~/.winerc) 
++to 'true' or 'false', if want to disable/enable reading label/serial number
++from the device for this drive. Note, that you have to have specified 'Device' 
++and appropriate 'Type' entries!
++
++	If 'ReadLabelFromDevice' and/or 'ReadSerialFromDevice' unspecified, wine
++tries to find out, whether to read labels/serial num's from device by itself.
++It will read them when 'Device' and 'Type' entries specified correctly and 
++appropriate 'Label'/'Serial' section is NOT specified. (In other words 
++specifying 'Label'/'Serial' will cause wine to use specified value rather, 
++than reading it from the device).
++
++
++EXAMPLES
++
++*** Simple example of cdrom and floppy; labels will be read from the device on 
++both, cdrom and floppy; serial numbers on floppy only:
++
++[Drive A]
++Path=/mnt/floppy
++Type=floppy
++Device=/dev/fd0
++Filesystem=msdos
++
++[Drive R]
++Path=/mnt/cdrom
++Type=cdrom
++Device=/dev/hda1
++Filesystem=win95
++
++*** Cdrom. We want to override the label:
++
++[Drive J]
++Path=/mnt/cdrom
++Type=cdrom
++Label=X234GCDSE
++Device=/dev/cdrom
++Filesystem=msdos
++
++*** This is a bit tricky example. It will read label and serial number from the 
++ZIP disk; if this fails (no ZIP disk in drive/ acces denied to the device /
++the disk is not formatted as FAT), it will fall back to the specified values.
++
++[Drive D]
++Path=/mnt/zip
++Type=hd
++Label=*Unknown*
++ReadLabelFromDevice=true
++Serial=00000000
++ReadSerialFromDevice=true
++Device=/dev/hdc4
++Filesystem=msdos
++
++
++TODO / OPEN ISSUES
++
++ - The cdrom-label can be read only if the data track of the disk resides in 
++the first track and the cdrom is iso9660.
++ - Better checking for FAT superblock (it now check's only one byte).
++ - Support for labels/serial num's WRITING.
++ - Can the label be longer than 11 chars? (iso9660 has 32 chars).
++ - What about reading ext2 volume label? ....
++
++
++					Petr Tomasek
++					<tomasek@etf.cuni.cz>
++					Nov 14 1999
++
+Index: files/drive.c
+diff -ruN wine-991031/files/drive.c wine-991031-new/files/drive.c
+--- wine-991031/files/drive.c	Wed Oct 13 15:57:38 1999
++++ wine-991031-new/files/drive.c	Sun Nov 14 16:42:45 1999
+@@ -3,6 +3,10 @@
+  *
+  * Copyright 1993 Erik Bos
+  * Copyright 1996 Alexandre Julliard
++ *
++ * Label & Serial-number read support. 
++ *  (c) 1999 Petr Tomasek <tomasek@etf.cuni.cz> 
++ *
+  */
+ 
+ #include "config.h"
+@@ -59,6 +63,8 @@
+     UINT    flags;     /* drive flags */
+     dev_t     dev;       /* unix device number */
+     ino_t     ino;       /* unix inode number */
++    int       read_label;   /* should disk label be read from device ? */
++    int	      read_serial;  /* should serial number be read ? */
+ } DOSDRIVE;
+ 
+ 
+@@ -187,6 +193,25 @@
+                                       buffer, sizeof(buffer) );
+             drive->serial = strtoul( buffer, NULL, 16 );
+ 
++	    /* Should the label be read directly from the device ? */
++            drive->read_label=
++	       ((drive->type==TYPE_FLOPPY) ||
++                 (drive->type==TYPE_HD) ||
++                 (drive->type==TYPE_CDROM)) &&
++		(PROFILE_ExistWineString(  name, "Device")) &&
++	          (PROFILE_ExistWineString(name, "ReadLabelFromDevice") ?
++                  PROFILE_GetWineIniBool(name, "ReadLabelFromDevice", 1) : 
++    	            (!PROFILE_ExistWineString(  name, "Label")));
++
++	    /* Should the serial number be read from the device ? */
++            drive->read_serial=
++	       ((drive->type==TYPE_FLOPPY) ||
++                 (drive->type==TYPE_HD)) &&
++		(PROFILE_ExistWineString( name, "Device")) &&
++	          (PROFILE_ExistWineString(name, "ReadSerialFromDevice") ?
++                  PROFILE_GetWineIniBool(name, "ReadSerialFromDevice", 1) : 
++                    (!PROFILE_ExistWineString( name, "Serial")));
++
+             /* Get the filesystem type */
+             PROFILE_GetWineIniString( name, "Filesystem", "win95",
+                                       buffer, sizeof(buffer) );
+@@ -207,6 +232,8 @@
+                            name, path, DRIVE_Types[drive->type],
+                            drive->label, drive->serial, drive->flags,
+                            (int)drive->dev, (int)drive->ino );
++	    TRACE_(dosfs)("%s: label ? %d , serial ? %d\n",name,
++			   drive->read_label, drive->read_serial);
+         }
+         else WARN_(dosfs)("%s: not defined\n", name );
+     }
+@@ -395,11 +422,80 @@
+ 
+ 
+ /***********************************************************************
++ *           DRIVE_ReadFatSuperblock
++ *
++ * Used in DRIVE_GetLabel and DRIVE_GetSerial
++ */
++int DRIVE_ReadFatSuperblock (char * dev, char * buff) 
++{
++int fd;
++#define DRIVE_SUPER 96  /* Number of bytes read from the superblock */
++
++if (memset(buff,0,DRIVE_SUPER)!=buff) return -1;
++if ((fd=open(dev,O_RDONLY))==-1) return -1;
++if (read(fd,buff,DRIVE_SUPER)!=DRIVE_SUPER) return -2;
++if (buff[0x26]!=0x29)  return -3;   /* Check for FAT present */ 
++return close (fd);
++}
++
++
++/***********************************************************************
++ *           DRIVE_ReadIso9660Superblock
++ *
++ * Used in DRIVE_GetLabel
++ */
++int DRIVE_ReadIso9660Superblock (char * dev, char * buff) 
++{
++int block=0;   
++/* FIXME: Maybe we should search for the first data track on the CD,
++    not just assume, that it is the first track. */
++int fd;
++off_t offset;
++offset=(off_t)2048*(16+block);
++
++if (memset(buff,0,DRIVE_SUPER)!=buff) return -1;
++if ((fd=open(dev,O_RDONLY))==-1) return -1;
++if (lseek(fd,offset,SEEK_SET)!=offset) return -4;
++if (read(fd,buff,DRIVE_SUPER)!=DRIVE_SUPER) return -2;
++if (strncmp(&buff[1],"CD001",5)) return -3;   /* Check for iso9660 present */
++return close (fd);
++
++}
++
++
++
++/***********************************************************************
+  *           DRIVE_GetLabel
+  */
+ const char * DRIVE_GetLabel( int drive )
+ {
++char buff[DRIVE_SUPER];
++
+     if (!DRIVE_IsValid( drive )) return NULL;
++    if (DOSDrives[drive].read_label) {
++      if ((DOSDrives[drive].type == TYPE_FLOPPY) ||
++          (DOSDrives[drive].type == TYPE_HD)) {
++	if (DRIVE_ReadFatSuperblock(DOSDrives[drive].device,(char *) buff))
++           
++	  MESSAGE("Invalid or unreadable superblock on %s (%c:)."
++             " Maybe not FAT?\n" ,DOSDrives[drive].device,(char)(drive+'A'));
++	else {
++		memcpy(DOSDrives[drive].label,buff+0x2b,11);
++		DOSDrives[drive].label[11]='\0';
++	 }
++       }
++      if (DOSDrives[drive].type == TYPE_CDROM) {
++	if (DRIVE_ReadIso9660Superblock(DOSDrives[drive].device,(char *) buff))
++           
++	  MESSAGE("Invalid or unreadable superblock on %s (%c:)."
++           " Maybe not Iso9660?\n" ,DOSDrives[drive].device,(char)(drive+'A'));
++	else {
++/* FIXME: Iso9660 uses 32-bytes long label. Should we do also? */
++		memcpy(DOSDrives[drive].label,buff+40,11);
++		DOSDrives[drive].label[11]='\0';
++	 }
++       }
++     }
+     return DOSDrives[drive].label;
+ }
+ 
+@@ -409,7 +505,19 @@
+  */
+ DWORD DRIVE_GetSerialNumber( int drive )
+ {
++char buff[DRIVE_SUPER];
++
+     if (!DRIVE_IsValid( drive )) return 0;
++    if (DOSDrives[drive].read_serial)
++      if ((DOSDrives[drive].type == TYPE_FLOPPY) ||
++          (DOSDrives[drive].type == TYPE_HD)) {
++	if (DRIVE_ReadFatSuperblock(DOSDrives[drive].device,(char *) buff))
++           
++	  MESSAGE("Invalid or unreadable superblock on %s (%c:)."
++             " Maybe not FAT?\n" ,DOSDrives[drive].device,(char)(drive+'A'));
++	else 
++	DOSDrives[drive].serial=*((DWORD*)(buff+0x27));
++       }
+     return DOSDrives[drive].serial;
+ }
+ 
+Index: files/profile.c
+diff -ruN wine-991031/files/profile.c wine-991031-new/files/profile.c
+--- wine-991031/files/profile.c	Sun Oct 31 18:32:57 1999
++++ wine-991031-new/files/profile.c	Sat Nov 13 20:37:29 1999
+@@ -708,6 +708,27 @@
+ 
+ 
+ /***********************************************************************
++ *           PROFILE_ExistWineString
++ *
++ * Tests for tags in the wine.ini file. 
++ */
++int PROFILE_ExistWineString ( const char *section, const char *key_name)
++{
++
++    int	ret;
++
++    EnterCriticalSection( &PROFILE_CritSect );
++
++ret=(PROFILE_Find(&PROFILE_WineProfile, section, key_name, FALSE)!=NULL);
++
++    LeaveCriticalSection( &PROFILE_CritSect );
++
++    return ret;
++}
++
++
++
++/***********************************************************************
+  *           PROFILE_GetWineIniString
+  *
+  * Get a config string from the wine.ini file.
+Index: include/options.h
+diff -ruN wine-991031/include/options.h wine-991031-new/include/options.h
+--- wine-991031/include/options.h	Fri Jul 23 21:19:56 1999
++++ wine-991031-new/include/options.h	Sat Nov 13 20:38:31 1999
+@@ -83,6 +83,7 @@
+ 
+ /* Profile functions */
+ 
++extern int PROFILE_ExistWineString( const char *section ,const char *key_name);
+ extern int PROFILE_LoadWineIni(void);
+ extern void PROFILE_UsageWineIni(void);
+ extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
+Index: libtest/volinfo.c
+diff -ruN wine-991031/libtest/volinfo.c wine-991031-new/libtest/volinfo.c
+--- wine-991031/libtest/volinfo.c	Sat Apr  3 15:52:04 1999
++++ wine-991031-new/libtest/volinfo.c	Sun Nov 14 05:59:18 1999
+@@ -13,7 +13,7 @@
+ 
+     printf("Drive Serial     Flags      Filename-Length "
+            "Label                 Fsname\n");
+-    for (drive = 'C'; drive <= 'Z'; drive++)
++    for (drive = 'A'; drive <= 'Z'; drive++)
+     {
+         root[0] = drive;
+         if (GetVolumeInformation(root,label,labellen,&serial,

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911271744.SAA54798>