Sign in to follow this  
Diventurer

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

Recommended Posts

[size="4"][b]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 :)
[/b][/size]
____________________
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)
[img]http://i.imgur.com/DoRR5.png[/img]
Thanks in advance, :)

Share this post


Link to post
Share on other sites
[url="http://answers.microsoft.com/en-us/windows/forum/windows_xp-hardware/winsockdll-is-not-a-valid-windows-image-please/f27a48d9-ca0e-496c-abd7-71d6d4811b03"]http://answers.micro...d7-71d6d4811b03[/url]



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.

Share this post


Link to post
Share on other sites
[quote name='Segun24' timestamp='1317995068' post='4870119']
[size="4"][b]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 :)
[size=3][/quote][/size]
[/b][/size]
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[quote]
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 [u]copy[/u] 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 [u]use[/u] 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.

Share this post


Link to post
Share on other sites
[quote name='Segun24' timestamp='1318254522' post='4871065']
Are you saying that I can't have DLLs from the Windows directory in my projects?
[/quote]

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.

Share this post


Link to post
Share on other sites
Try the solutions here with full details
[url="http://support.microsoft.com/kb/298436/"]http://support.micro....com/kb/298436/[/url] [url="http://www.articlewritingclicks.com/errors/dll3.php"]256[/url]

Share this post


Link to post
Share on other sites
I appreciate you replied rahat... But didn't you get a hint when the beginning of this topic title is [solved] ?
Not trying to be rude, but I get the feeling that you are on reputation hunting ._.

If you are just trying to give me more information on it, then sure... But still... [quote]I get the feeling that you are on reputation hunting ._.[/quote]

:)

Share this post


Link to post
Share on other sites
You do not own the thread. The thread will naturally outlast your interest in it, as you will solve your problem but in the future others may find the thread when searching for similar problems.

This is why other commenters are free at any time to chip in with useful or interesting material related to the topic. The forum software does not allow you to "close" a thread. You are free to ignore further responses if you have solved your problem and aren't interested in better solutions or different views on the topic.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this