http://bugs.winehq.org/show_bug.cgi?id=11965
Summary: WSAStartup() is not required to do networking Product: Wine Version: 0.9.49. Platform: PC-x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: enhancement Priority: P1 Component: winsock AssignedTo: wine-bugs@winehq.org ReportedBy: mark@ookoo.org
On Windows (tested at least on Xp, and this is also according to MSDN doc), when calling any network function, you absolutely have to call WSAStartup() before.
If you didn't call WSAStartup(), any ws2_32 function will fail, with error WSANOTINITIALISED (10093).
I'm writing cross-compilable programs on linux that should also run on Win32, and I do all my tests on wine. It took me a while to find out why people trying to use this program on real windows boxes had troubles accessing network.
The expected behaviour for Winsock2 functions is to fail, unless WSAStartup() was called. For each time you call WSAStartup(), you have to call WSACleanup() once.
http://bugs.winehq.org/show_bug.cgi?id=11965
Mark Karpeles mark@ookoo.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|0.9.49. |0.9.56.
--- Comment #1 from Mark Karpeles mark@ookoo.org 2008-03-10 13:42:51 --- Tested on 0.9.56 and got similar unwanted result.
http://bugs.winehq.org/show_bug.cgi?id=11965
James Hawkins truiken@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Version|0.9.56. |0.9.49.
--- Comment #2 from James Hawkins truiken@gmail.com 2008-03-10 13:44:41 --- Don't change the original reported version.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #3 from Austin English austinenglish@gmail.com 2008-10-23 15:25:36 --- Is this still an issue in current (1.1.6 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=11965
Kai Blin kai.blin@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #4 from Kai Blin kai.blin@gmail.com 2008-10-23 23:02:02 --- Yes, this hasn't been fixed so far. It's not going to break any programs, and the only scenario where I can imagine this being a problem is the one described right now.
As people developing and testing Windows software on Wine is a scenario we eventually want to support, we should certainly fix it at some point, it's just that there's lots of more urgent things to do.
Patches certainly very welcome.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #5 from Mark Karpeles mark@ookoo.org 2008-10-23 23:02:43 --- Hi, I built a little testcase and ran it on wine 1.1.6.
It's available via SVN:
http://ookoo.org/svn/snip/wine-bug11965/
And the output from the testcase:
magicaltux@Memol ~/projects/snip/wine-bug11965 $ wine --version wine-1.1.6 magicaltux@Memol ~/projects/snip/wine-bug11965 $ wine test.exe Resolve #1 success (should have failed with error 10093) Resolve #2 success (that was excpected)
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #6 from Mark Karpeles mark@ookoo.org 2008-10-23 23:03:33 --- Created an attachment (id=16844) --> (http://bugs.winehq.org/attachment.cgi?id=16844) The same testcase on windows XP
http://bugs.winehq.org/show_bug.cgi?id=11965
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |testcase
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #7 from Austin English austinenglish@gmail.com 2008-10-24 01:41:30 --- Would you mind porting that testcase to our conformance test suite? It should be pretty easy to add to dlls/ws2_32/tests:
http://wiki.winehq.org/ConformanceTests
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #8 from Mark Karpeles mark@ookoo.org 2008-10-24 02:27:45 --- I ported code and inspired myself from other files in dlls/ws2_32/tests
Here's the result:
http://ookoo.org/svn/snip/wine-bug11965/wsastartup.c
I don't know if it's OK to have conditions on calling ok() as it's the first time I write a wine test.
Any suggestion/patch/improvement on this testcase are welcome.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #9 from Juan Lang juan_lang@yahoo.com 2008-10-24 13:08:48 --- (In reply to comment #8)
I don't know if it's OK to have conditions on calling ok() as it's the first time I write a wine test.
Yes, that's fine.
Any suggestion/patch/improvement on this testcase are welcome.
You'll get more feedback if you send it as a patch to wine-patches or wine-devel.
ok(ptr == NULL, "gethostbyname() succeeded unexpectedly: %d\n", WSAGetLastError()); Since this currently fails on Wine, you'll need a todo_wine before the ok.
res = WSAStartup( version, &data );
ok(res != 0, "WSAStartup() failed unexpectedly: %d\n", res); if (res != 0) return; // test can't continue
This is preferred style for the if (res != 0) block: if (res != 0) { skip("WSAStartup failed\n"); return; } Don't use C++-style (//) comments.
Also, this test could probably be part of an existing .c file, it doesn't really need its own.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #10 from Austin English austinenglish@gmail.com 2009-04-28 15:35:38 --- Created an attachment (id=20793) --> (http://bugs.winehq.org/attachment.cgi?id=20793) rediff'ed patch
Rediffed, tested on 2K/Wine.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #11 from Austin English austinenglish@gmail.com 2009-04-28 15:39:22 --- Patch sent: http://www.winehq.org/pipermail/wine-patches/2009-April/072408.html
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #12 from Austin English austinenglish@gmail.com 2009-10-29 13:59:32 --- Testcase is in git: http://source.winehq.org/git/wine.git/?a=commitdiff;h=3cf5eb6d967f1454688c1a...
And it's still present: http://source.winehq.org/git/wine.git/?a=blob;f=dlls/ws2_32/tests/sock.c#l85...
http://bugs.winehq.org/show_bug.cgi?id=11965
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
http://bugs.winehq.org/show_bug.cgi?id=11965
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #13 from Austin English austinenglish@gmail.com 2011-02-23 13:16:45 CST --- Fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=778757ba7434162edf3539...
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #14 from Andrew Nguyen arethusa26@gmail.com 2011-02-23 13:29:31 CST --- (In reply to comment #13)
Fixed by http://source.winehq.org/git/wine.git/?a=commitdiff;h=778757ba7434162edf3539...
Is this really fixed? I imagine gethostbyname isn't the only function that requires Winsock to be initialized.
http://bugs.winehq.org/show_bug.cgi?id=11965
--- Comment #15 from Juan Lang juan_lang@yahoo.com 2011-02-23 16:42:54 CST --- (In reply to comment #14)
Is this really fixed? I imagine gethostbyname isn't the only function that requires Winsock to be initialized.
Perhaps more to the point, is this really a bug? The only app that seemed to have suffered from this was the test case. Personally, I'm content to see this closed until another app that has troubles arises.
http://bugs.winehq.org/show_bug.cgi?id=11965
Andrew Nguyen arethusa26@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|WSAStartup() is not |gethostbyname requires a |required to do networking |successful WSAStartup | |invocation before | |performing an operation
--- Comment #16 from Andrew Nguyen arethusa26@gmail.com 2011-02-24 05:06:36 CST --- (In reply to comment #15)
(In reply to comment #14)
Is this really fixed? I imagine gethostbyname isn't the only function that requires Winsock to be initialized.
Perhaps more to the point, is this really a bug? The only app that seemed to have suffered from this was the test case. Personally, I'm content to see this closed until another app that has troubles arises.
I probably read too much into the bug description, which reads like a metabug. I have no problem with creating individual bug reports for particular WSAStartup issues an application may encounter, so I won't object to leaving the status of this bug as-is.
http://bugs.winehq.org/show_bug.cgi?id=11965
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #17 from Alexandre Julliard julliard@winehq.org 2011-03-04 12:35:42 CST --- Closing bugs fixed in 1.3.15.