<kc version="0.1.0">

<title>Wine Traffic</title>

<author contact="mailto:vinn@theshell.com">Brian Vincent</author>

<issue num="108" date="10 Nov 2001 23:00:00 -0800" />

<intro>
<p>
This is the 108th release of the Wine's kernel cousin publication. It's main 
goal is to distribute widely what's going on around Wine (the Un*x windows 
emulator). </p>
<p>So last week <a href="http://www.transgaming.com">Transgaming</a> 
had the news.  This week it's <a href="http://www.codeweavers.com">
CodeWeavers</a>.  You can now download a demo of their CrossOver
Plug-in (v.1.0.1).  As they describe on their website:</p>
<quote who="codeweavers"><p>
  CrossOver Plugin lets you use many Windows plugins directly 
  from your Linux browser. In particular CrossOver fully supports: 
</p><p><ul>
		<li>QuickTime 		</li>
		<li>ShockWave Director 	</li>
		<li>Word Viewer 	</li>
		<li>Excel Viewer 	</li>
		<li>PowerPoint Viewer 	</li>
		<li>and more...		</li></ul></p><p>
 
CrossOver works on any Linux distribution and will integrate with 
most browsers including Netscape 4.x, Netscape 6.x, Konqueror, 
Mozilla, Galeon, Skipstone and Opera. CrossOver also integrates 
with Gnome and KDE to let you transparently open any Word, Excel 
or PowerPoint file. But even better, you can open this type of 
attachments directly from any mail client.</p></quote>

<p>Of course, you can also <a href="http://store.codeweavers.com">
download</a> the product for $19.95 or $29.95 to get it on CD.  And what
kind of description would be complete without a 
<a href="http://www.codeweavers.com/products/crossover/images/quicktime.jpg">
screenshot</a> or 
<a href="http://www.codeweavers.com/products/crossover/images/2001_08_27_154448_shot.jpg">
two</a> (or 
<a href="http://www.codeweavers.com/products/crossover/images/2001_08_27_154145_shot.jpg">
three</a>..)?  Oh, and did I mention there's a 
<a href="http://www.codeweavers.com/support/crossover/downloads.php">
patch</a> to upgrade a 1.0 installation to 1.0.1?  Among the new features
are bug fixes, support for PowerPoint Viewer 97/2000, and the ability to 
start the QuickTimePlayer from a commandline. Of course one of the
things that $19.95 will get you is support - and judging from the
support mailing lists, Francois Gouget and Jeremy White are doing a
fantastic job resolving a lot of questions.</p>
 
<p>Oh yeah, an update on the Mandrake Gaming Edition that includes
The Sims - you can 
<a href="http://www.mandrakestore.com/en/storemdkinc-81gaming.php?LANG=en">
order it</a> now.</p>

<p>We also saw yet another escapee from the CVS tree - Wine-20011108.  
>From the announcement we have these changes:
<ul>
	<li> Shared windows support starts doing something useful.</li>
	<li> Overlapped I/O improvements.</li>
	<li> Support for running files from removable media.</li>
	<li> Many shlwapi improvements.</li>
	<li> Quartz dll keeps growing.</li>
	<li> Lots of bug fixes.</li>
</ul></p>

<p>All the Quartz stuff is quietly coming from Hidenori Takeshima.  He
has contributed a ton of code and is busy fleshing out a lot of stubbed
functions.</p>

</intro>

<stats posts="92" size="291" contrib="33" multiples="17" lastweek="16">

<person posts="10" size="23" who="Alexandre Julliard &lt;julliard@winehq.com&gt;" />
<person posts="9" size="29" who="Eric Pouech &lt;eric.pouech@wanadoo.fr&gt;" />
<person posts="2" size="27" who="Francois Gouget &lt;fgouget@free.fr&gt;" />
<person posts="6" size="36" who="Martin Wilck &lt;Martin.Wilck@fujitsu-siemens.com&gt;" />
<person posts="5" size="23" who="Roger Fujii &lt;rmf@lookhere.com&gt;" />
<person posts="5" size="13" who="Lawson Whitney &lt;lawson_whitney@juno.com&gt;" />
<person posts="5" size="10" who="Simon Britnell &lt;ughbash@yahoo.com&gt;" />
<person posts="4" size="15" who="Mike McCormack  &lt;mike_mccormack@start.com.au&gt;" />
<person posts="4" size="11" who="Andriy Palamarchuk &lt;apa3a@yahoo.com&gt;" />
<person posts="4" size="10" who="Andreas Mohr &lt;andi@rhlx01.fht-esslingen.de&gt;" />
<person posts="5" size="7" who="Bill Medland &lt;medbi01_1@accpac.com&gt;" />
<person posts="3" size="7" who="Guy L. Albertelli &lt;galberte@neo.lrun.com&gt;" />
<person posts="2" size="11" who="Marco Bizzarri &lt;m.bizzarri@icube.it&gt;" />
<person posts="2" size="6" who="Gerard Patel &lt;gerard.patel@nerim.net&gt;" />
<person posts="2" size="5" who="Chris Dawson &lt;cdawson@webiphany.com&gt;" />
<person posts="2" size="4" who="Per Wigren &lt;poebblo@tjohoo.se&gt;" />
<person posts="1" size="9" who="mdew &lt;rpbrown@xtra.co.nz&gt;" />
<person posts="1" size="4" who="Robert Lunnon &lt;bob@yarrabee.net.au&gt;" />
<person posts="1" size="4" who="Paul Millar &lt;paulm@astro.gla.ac.uk&gt;" />
<person posts="1" size="2" who="Dominik Strasser &lt;dominik.strasser@mchp.siemens.de&gt;" />
<person posts="1" size="2" who="Uwe Bonnes &lt;bon@elektron.ikp.physik.tu-darmstadt.de&gt;" />
<person posts="1" size="2" who="Ori Pessach &lt;ori_pessach_blah@yahoo.com&gt;" />
<person posts="1" size="2" who="KiLMoR Zombie &lt;tjmichielsen@yahoo.com&gt;" />
<person posts="1" size="2" who="Ove K&#229;ven &lt;ovehk@ping.uio.no&gt;" />
<person posts="1" size="2" who="Rein Klazes &lt;rklazes@xs4all.nl&gt;" />
<person posts="1" size="2" who="Gavriel State &lt;gav@transgaming.com&gt;" />
<person posts="1" size="2" who="J.M. Maurer &lt;j.m.maurer@student.utwente.nl&gt;" />
<person posts="1" size="2" who="Dmitry Timoshkov &lt;dmitry@baikal.ru&gt;" />
<person posts="1" size="1" who="Charles Wyble &lt;jackshck@yahoo.com&gt;" />
<person posts="1" size="1" who="Johan Gill &lt;johane@lysator.liu.se&gt;" />

</stats>




 

<section
  title="Winsock2"
  subject="[EXPERIMENTAL PATCH]: Winsock2"
  archive="http://www.winehq.com/hypermail/wine-devel/2001/11/0044.html"
  posts="4"
  startdate="06 Nov 2001 23:00:00 -0800"
  enddate="06 Nov 2001 23:00:00 -0800"
>
<mention>Andreas Mohr</mention>
<mention></mention>

<p>Once in a while people ask if Winsock2 has been implemented in Wine
and the answer has been no.  Winsock2 is the set of network API's that
shipped with Windows 98 (and available as a patch for Windows 95).  
This API is different than the one originally that originally shipped
with Windows 95.  Martin Wilck wrote in and announced some new code 
that has the beginnings of Winsock2 support:</p>
<quote who="Martin Wilck"><p>
	this patch tries to implement a small part of the extended
	Winsock 2 functionality in Wine. It is very experimental,
	I have only made sure everything compiles.
	It is _NOT_ intended for people to try and run.
</p><p>
	I am submitting this patch because I am pretty new to Wine hacking
	and I'd appreciate some Wine gurus to audit this for obvious stupidity,
	style incompatiblities, etc.
</p><p>
	Features implemented:<ul>
  		<li> WSAAccept(), including callback functionality.</li>
  		<li> WSASocket(): support for dwFlags parameter.</li>
	</ul>
</p><p>
	The real difficult stuff will follow when I start looking into
	WSARecv(), WSASend(), and WSAGetOverlappedResults().
</p><p>
	Thus it'd be nice if someone pointed out my misconceptions before
	I put real work into the latter.
</p></quote><p>
Francois Gouget replied with the following:</p>
<quote who="Francois Gouget"><p>
   I will leave it to someone else to comment on the meat of the matter
 but still, here are a couple of comments:
</p><p>
 * To answer your question:<br /><code>
    /* Code copied largely from WSOCK32_accept() */<br />
    /* FIXME: Can we simply call WSOCK32_accept() instead ? */<br />
    /* I wasn't sure because of the AsyncSelect stuff at the end,<br />
       which presumably should only be called if the connection is accepted */
</code></p><p>
   Winsock2 should not call the wsock32 library. It should be the
opposite. One of the things on my todo list (but whether I will have
time to actually do it is another matter) is to reorganize the winsock
libraries so that wsock32 and winsock are together in dlls/wsock32. The
reason is that they both implement the winsock1 API except one is 16bit
and the other 32bits. Then in dlls/winsock we would be left with just
ws2_32 which implements the winsock2 API. So having ws2_32 call to
wsock32 is not going in the right direction :-)
</p><p><ul><li>
  I am currently working on a big reorganization of the winsock headers
(I'm a bit late in resubmitting my patches but I will resubmit them) so
there is going to be a clash with 'winsock2.h'. But don't worry about it
too much. I will try to integrate all the changes in your current patch
in my version before submitting it. Then you will only have to take care
of any later additions.</li>

 <li> Also, to give you a heads up, the prefix for all functions will
switch from 'WSOCK32_' to 'WS_'. Well, it's not that hard to deal with.
 </li>
 <li> I don't think you need to specify which structures/fields are
unsupported in the header file. After all they could be unsupported in
one function and supported in another. I see that you also put this info
in the relevant functions so it should be enough.</li></ul>
</p><p>
   Looks good to me.
   Welcome to the Wine project. It's always good to have some new blood.
</p></quote><p>
Andreas Mohr didn't quite understand why Francois would want to
reorganize the code in such a fashion.  Francois explained there
were two main reasons.  First, all of the 16-bit aspects in the
Winsock2 code need to be removed and then have the two libraries dealing 
with the first version of the API be implemented as a DLL pair.  
The next step is to have version 1 use the code in version 2 whenever
possible to avoid code duplication.</p>

<p>Robert Lunnon also had some suggestions, <quote who="Robert Lunnon">
Whoever is playing with Winsock can you please ensure that the solutions you 
come up with are not linux centric. There is a lot of code in there that does 
not run on solaris because it grubs around in PROC getting TCP structures. I 
have made a bit of a start in cleaning this up, Here it is, absolutely 
untested non working code, but a start nevertheless, I put this into a 
separate file  and link it with winsock and  wsock32  from a common source, 
these functions replace the helper functions of similar name in the two dll 
subdirectories.</quote></p>




</section>  








<section
  title="Overlapped I/O"
  subject="Winsock2 &amp; Overlapped IO"
  archive="http://www.winehq.com/hypermail/wine-devel/2001/11/0020.html"
  posts="10"
  startdate="04 Nov 2001 23:00:00 -0800"
  enddate="08 Nov 2001 23:00:00 -0800"
>
<mention></mention>
<mention>Ove K&#229;ven</mention>

<p>
Along those same lines, Martin Wilck needs to have some changes
made to facilitate Winsock2 support.  As Martin first described
it, <quote who="Martin Wilck">
  I have started porting a software product of our company from 
  NT to Linux using Wine. Part of this software is an agent which
  implements a proprietary protocol implemented with Winsock 2.
  In particular, it uses the Winsock 2 feature of "Overlapped IO"
  on sockets, with user-supplied callbacks that are called when
  data is received on a socket etc.</quote></p>

<p>Mike McCormack wrote back and gave a description of how
overlapped I/O works in Wine:</p>
<quote who="Mike McCormack">
<p>
  i don't know much about Winsock, but i can tell you how overlapped I/O
  is supposed to work in Wine.
</p><p>
 The bulk of the implementation is in <code>files/file.c</code> and
 <code>scheduler/synchro.c</code>. When ReadFile is called on a handle, the
 following happens:
<ol>
   <li> check that the handle is valid and was opened with
  	<code>FILE_FLAG_OVERLAPPED.</code></li>
   <li> attempt to read any data that is available immediately, and perhaps
 	return if we read enough already.</li>
   <li> queue the operation onto <code>CurrentTeb()->pending_list</code></li>
</ol></p><p>
 When the thread waits upon any server object, all (unix) fds with
 pending overlapped operations are polled on. This is a minor problem
 in the design; if the thread never waits upon an object the overlapped
 can never complete, however the thread must wait upon the overlapped's
 hEvent to check whether it has completed...
</p><p>
 The only part of the serial comms overlapped implementation the lives
 in the wineserver is the calculation of overlapped timeouts.
</p><p>
 So to get winsock to do overlapped, you may have to modify the winsock
 code to work like that... but the winsock code uses the service thread
 to wait upon sockets. The task is definitely not impossible, but it
 might take a bit of work :-)
</p><p>
 Maybe Ove K. can give you some advice?
</p></quote><p>
In response to the last part, Ove K&#229;ven felt the service thread
wouldn't really come into play:</p>
<quote who="Ove Kaaven"><p>
 Not really, the wineserver does the grunt work. The service thread is only
 used to implement WSAAsyncSelect, to post messages when the wineserver
 says that it should. Winsock2 code is unlikely to use WSAAsyncSelect,
 they'd rather do either WSAEventSelect (which doesn't use the service
 thread, but is 100% wineserver-based), *or* overlapped I/O.
</p><p>
 The challenges for winsock2 should be pretty much the same as those for
 implementing something like ReadFileEx (which you've probably already
 done) and the above-mentioned overlapped ConnectNamedPipe.
</p></quote>
<br/>

<p>Martin started working on bits and pieces here and there and
posted some patches.  Then he ran into a stumbling block because 
buffers are read and wrote in the opposite order in which they
were submitted.  He posted a lengthy email outlining a possible
solution:</p>
<quote who="Martin Wilck">
<p>
 I see a severe problem with the current overlapped I/O implementation,
 especially wrt extending it to Winsock2 overlapped I/O.
</p><p>
 The problem I see is with buffer ordering.
</p><p>
 For normal files, the file position from which to read is on the
 OVERLAPPED struct. This was not in the Wine implementation, the patch in
 my last email fixes it.
</p><p>
 For sockets and other FIFOs, this makes no sense. In this case Windows
 specifies that buffers are read / written **in the same order they were
 submitted**. This matters only if users spawn several asynchronous I/O
 requests at the same time, but this is allowed and actually beneficial
 for application performance (at least on Windows).
</p><p>
 Unless I oversee something essential, the current wine implementation
 does not guarantee such behaviour. Actually, since new requests are
 inserted at the head of the NtCurrentTeb() list, they will be considered
 first in subsequent asynchronous reads - i.e. the order will be reversed.
 If I/O requests don't complete in a single read() or write() call, the
 ordering will be basically random.
</p><p>
 IMO this implies that for sockets, asynchronous reads and writes must
 be scheduled such that only one request for a given socket is actually
 reading at a time, and all others are blocked until this request is
 finished. Again, this holds only for FIFO-type files.
</p><p>
 With the current structure, it seems to be very complex to sort this out.
 One could recheck the fd list in check_async and remove duplicate fds.
 One could also try to "lock" the fd somehow. Still it would be necessary 
 to ascertain that the correct request gets the lock first.
</p><p>
 With this min mind, it seems more natural for me to organize the
 asynchronous requests in the "file" data structure itself. One would
 have a reader's and a writers's list there, and make sure that for FIFOS
 only the first list element can actually issue a read(), write(), send(),
 or recv() system call. For normal files all elements in the lists could be
 doing IO at the same time, question is if that makes sense or not.
</p><p>
 As I see it, this would mean both the readers and writers lists must
 be stored in the file data structure in the wine server.
 This would of course strongly affect the current implementation.
</p><p>
 Note that with Winsock2 overlapped I/O in place, it must
 be possible to use also ReadFile(), ReadFileEx() etc. on
 overlapped sockets, and get correct behaviour.
 Thus the ReadFile() etc. code must be able to deal with both sockets
 and ordinary files, and it makes no sense to intriduce a different
 approach for sockets only.
</p>
</quote>
<br/>

<p>Mike McCormack wrote back:</p>
<quote who="Mike McCormack">
	<p>
	 You're right, i never considered multiple overlapped requests at the
	 same time...
	</p>
	<p>
	 To fix the problem correctly, you will need to move (some of) the
	 overlapped code back to the wineserver, so that requests from
	 different processes can be handled correctly. (i moved it out of the
	 wineserver about a year ago for efficiency reasons.)
	</p>
	<p>
	 Have a look at rev 1.7 of server/async.c to see how this worked.
	</p>
	<p>
	 <a href="http://cvs.winehq.com/cvsweb/wine/server/async.c?rev=1.7">
	 http://cvs.winehq.com/cvsweb/wine/server/async.c?rev=1.7</a>
	</p>
	<p>
	 The current overlapped code (with the above exception) is similar to
	 what win 9x supports, so it does not support overlapped on normal
	 files, and file offsets in OVERLAPPED structures. If that could be
	 implemented too, it would be good.
	</p>
	<p>
	 i guess there is choice now... implement overlapped sockets with the
	 existing structure, or make a rather large change to the wine
	 architecture, which might take a while.
	</p>
	<p>
	 Maybe a good first step is to back out my change which put overlapped
	 operations into the client side code... Alexandre thought this could
	 be done using POLLIO instead...
	</p>
</quote>

<p>We'll see how this shakes out, there may be some architectural changes
happening. </p>

</section>  







<section
  title="Linking in .lib Files"
  subject="linking in .lib files"
  archive="http://www.winehq.com/hypermail/wine-devel/2001/11/0056.html"
  posts="5"
  startdate="06 Nov 2001 23:00:00 -0800"
  enddate="06 Nov 2001 23:00:00 -0800"
>
<mention></mention>
<mention>codeweavers</mention>

<p>
Chris Dawson wanted to know how to go about using a .lib file from
Windows to compile his application, <quote who="Chris Dawson">
 Is it possible to link in .lib files using winelib and winemaker?  If
 possible, what switch do I give winemaker?  My application when compiled
 under Windows linked in a .lib file and I would rather not modify the source
 code.  I've tried using the -l switch, but this is obviously only for *nix
 libraries even when compiling with winelib.  Or, other suggestions to
 resolve all the undefined reference errors?</quote></p>

<p>Francois Gouget provided a detailed explanation of what was going on:</p>
<quote who="Francois Gouget"><p>
   You cannot use .lib files directly with Winelib. The reason is that
 winebuild does not support reading .lib files. Support for '.lib' files
 (or possibly even '.dll' files) could be added in but it is not there
 currently.
</p><p> 
   Exactly how you deal with that depends on what your situation:
<ol>
 <li> if you have the sources of the library you want to link with, then
  the best solution is to compile it with Winelib too.</li>
 <li> if you don't have the sources for this library (and it's not one of
 the standard Wine libraries), then you will have to write a stub library
 that you will use for just the purpose of linking your application.</li>
</ol></p><p>
    In both cases you will need to create a '.spec' file containing a
 list of the functions (with parameters) exported by that library. See
 the following URL for a documentation of the exact format of .spec
 files:
</p><p>
<a href="http://wine.codeweavers.com/docs/winelib-user/spec-file.shtml">
http://wine.codeweavers.com/docs/winelib-user/spec-file.shtml</a>
</p><p>
Case 1:<br /><ul>
   The '.spec' files generated by Winemaker are mostly useful for
 compiling applications that just import libraries. When Winemaker
 generates the build environment for a library it will not declare the
 exported functions in the '.spec' file because it has no knowledge of
 which functions are exported. Winemaker could potentially be extended to
 generate a list of exported functions when the '.dll' is available by
 interfacing it with winedump.<br />&#160;&#160;
   So if your library only exports a few functions, the easiest solution
 is to just declare them manually in the '.spec' file. Otherwise you
 should use winedump much as described in case 2, and then copy the .spec
 file over to where you compile your library.
</ul></p><p>
Case 2:<br /><ul>
   Generating a stub library: the best way to do so is to use winedump.
 For that I recommend that you read '<code>tools/winedump/README</code>' and
 especially the section 'Generating stub DLLS'.<br />&#160;&#160;
   Once you have linked your application with the stub library, it can
 run with just the native dll... unless we are talking about a C++
 library.<br />&#160;&#160;
   C++ libraries are troublesome because g++ does not use the same name
 mangling as Visual C++ (although maybe g++ 3.0 changed that). So you
 will need the stub library to do the bridging. But I am not sure whether
 winedump can handle this sort of bridging.
</ul></p><p>
   There is another roadblock that you may hit in both cases: winebuild
 does not support importing a variable from another library (because of
 ELF limitations). Importing functions is ok, but not variables. This
 means that if you are dealing with a C++ library you will need to link
 with it in the Unix sense. If we are talking about C code, then there
 are ways around it that require only relatively simple code changes. It
 is also another reason why you will never be able to use a native C++
 library directly (because the virtual table pointers are handled as
 variables).
</p><p>
   One last note: specmaker has been folded into winedump recently. So
 if you hear/read things about specmaker you know that you have to look
 for winedump.
</p></quote><br/>


</section>  







<section
  title="Problem With VirtualDub (con't)"
  subject="queries on internals..."
  archive="http://www.winehq.com/hypermail/wine-devel/2001/11/0031.html"
  posts="10"
  startdate="05 Nov 2001 23:00:00 -0800"
  enddate="08 Nov 2001 23:00:00 -0800"
>
<mention></mention>
<mention>Eric Pouech</mention>

<p>Roger Fujii continued to work on getting VirtualDub running.
He posted a list of questions about the problems he was having:</p>
<quote who="Roger Fujii"><p>
 ok...  getting reasonable output, but now I have some
 questions.
</p><p>
 First, it seems like wine can't find the audio codecs,
 though it seems to find the video ones.  Is this a
 to-be-implemented or a bug and any clues on where to look?
</p></quote>

<p>Roger went on to ask several questions related to portability
and Solaris.  Most of the thread however was centered around
getting VirtualDub to recognize audio codecs.  Roger and
Eric Pouech went back and forth quite a bit.  Eric suggested
making sure they were listed in the <code>[drivers32]</code>
of the system.ini file.  Roger assured him they were.  Travis
Michielsen replied, <quote who="Travis Michielsen">
 Hmm, I noticed that when using VirtualDub, I had the same problem with ACM 
 codecs.  I did some detective work and found the problem to be a mistake in 
 <code>dlls/msacm/driver.c</code>.  Included is a patch to fix this error.  However, I 
 noticed that with this patch, the codecs are found, but for some reason are 
 listed many times for each codec!?</quote>.</p>

<p>Roger posted a note that Avery Lee, the author of VirtualDub, had
sent him:</p>
<quote who="Avery Lee"><p>
  Please feel free to forward this on to other developers or onto the
  Wine list.
</p><p>
  I read the discussion about VirtualDub crashing the Wine loader with
  great interest today.  (It's a bit weird that the only way I heard
  about a problem with my Win32 program was via a Unix-oriented mailing
  list.)  Yes, the exports header points to garbage, and yes, it was
  caused by UPX -- UPX left the export header RVA and size in the PE32
  optional header exactly was it was in the unpacked image.  You can
  safely hex edit the bytes at 180-187 to null to kill the bogus export
  directory, since it turns out I exported those functions by mistake in
  some hasty cut-and-paste and they aren't used.
</p><p>
  As for other compatibility problems with Wine, I have gotten
  VirtualDub to run in the past under Linux, although I ran into severe
  problems with the handling of custom templates in GetOpenFileName()
  and slow updates in the trackbar common control.  The last time I
  tried I had to remove two calls to SetUnhandledExceptionFilter() to
  get it to run.
</p><p>
  One more thing:  There is an undocumented Wine compatibility switch /w
  that you can specify on the command line to force VirtualDub to use
  StretchDIBits() to blit to the screen instead of a DIB section.  It
  was a workaround for an old problem where Wine wouldn't mark a GDI DIB
  section dirty if it was written to through an aliased, memory-mapped
  section.</p></quote>

</section>  


</kc>
