[solved]WinSock - WSOCK32.DLL is not a valid Windows image.

Started by
13 comments, last by irbaboon 12 years, 5 months ago
[size="4"]FIXED:
I got told by someone that I should take the DLL from SysWOW64 instead of System32, so 32-bit users can use the DLL also :)

____________________
Hey, so I've been learning WinSock lately, and my stuff runs perfectly fine on my Windows 7 64-bit desktop computer and laptop. It also runs fine on a friend of mine's desktop PC which also runs Windows 7 64-Bit.
But when someone with either Windows Vista 32-bit or Windows XP 32-bit, they seem to get an error saying something along the lines of "WSOCK32.DLL isn't a valid Windows image. Please check against your installation diskette" and "WSOCK32.DLL is not for use in Windows OS. etc..."

What I'm not sure of yet is if this only happens on computers without Windows 7, or if it happens only for computers with 32-bit OS.

EDIT:
Got a picture (Windows XP 32-bit)
DoRR5.png
Thanks in advance, :)
Advertisement
http://answers.micro...d7-71d6d4811b03



But try this solution provided in the link above:


"[...] I found that at HKLM\System\CurrentControlSet\Services\WinSock2\Parameters\NameSpace_Catalog5\Catalog_Entries\000000000001\LibraryPath, it was 'winsock.dll' when it SHOULD have been '%SystemRoot%\System32\mswsock.dll' [...]" See if that works.
With me, it says "%SystemRoot%\system32\NLAapi.dll" ... Guess that's because I'm on Windows 7..

A WinXP user just told me the LibraryPath was %SystemRoot%\System32\mswsock.dll with him...
So it seems that's not it.

[size="4"]FIXED:
I got told by someone that I should take the DLL from SysWOW64 instead of System32, so 32-bit users can use the DLL also :)



You shouldn't "take" *any* DLLs. You should link against the appropriate LIB link libraries when you build your program, and then the user of your program will already have the right DLL for their OS installed on their system. The only DLL you generally need to install with your program is the Visual C++ Runtime DLLs, if you use DLL standard libraries. The Visual Studio product comes with a re-distributable installer for this library that you should be using as well -- again, no "taking" or "copying" of DLLs at all.
enum Bool { True, False, FileNotFound };
Oh, I see, thank you :)
Note that anything you didn't write yourself is under copyright - or at least you should assume as much. Unless you get a license, or the work has been explicitly released into the public domain, you could not legally distribute such DLLs. Third party libraries and the MSVC runtime will have licenses that allow you to copy the software for this purpose.
I...don't think I'm entirely following what you're saying.

Are you saying that I can't have DLLs from the Windows directory in my projects?

Are you saying that I can't have DLLs from the Windows directory in my projects?
[/quote]
Distribution is separate from use.

They are belong to Microsoft. You cannot legally copy them without permission. You cannot distribute them without copying them. For the details, you would need to read the Windows EULA you got with your system. Maybe this license allows you to copy them, but I doubt it.

You can use these libraries by dynamically linking to them. The various parts you statically link to are under different licenses. For the details, see the licenses you got with MSVC++.

Think about it this way, imagine you are Microsoft. You want me to write cool software for Windows - it increases the perceived value of your platform. So you give me reasonably liberal licences for development. However, you don't want me copying critical system libraries (which won't be covered by Windows update, which might be installed onto a system with an older Windows version, among many other reasons) onto arbitrary machines. I expect that you would license these files far more restrictively.
I see, thank you for your response :)

Are you saying that I can't have DLLs from the Windows directory in my projects?


Correct. You should not copy any .DLL files out of Windows.
However, your compiler comes with .LIB files that lets you link against the Win32 API, which is how those DLLs can be used.
If you want to use functions out of USER32.DLL, then you link against USER32.LIB.
When Windows loads the finished program, it will then know to go look for USER32.DLL from the user's Windows directory to implement the Win32 API that you are using.
This means that users always will have the "right" version of the DLL for the version of Windows they are using, and you can write a program that works on Windows XP, Windows Vista, Windows Server and Windows 7 without change.
Which .LIB library you need to link with, and which .H file you need to include, is documented on the MSDN page for the function you want to use.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement