Visual C

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDesktop ProgrammingVisual C

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old September 22nd, 2010, 01:17 PM
mdavidjohnson mdavidjohnson is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Sep 2010
Posts: 1 mdavidjohnson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 39 sec
Reputation Power: 0
Corrupt MSWSOCK.dll

In trying to learn Winsock2 programming with Visual C++ 2005 Pro on Windows XP Pro SP3, I've run into a problem with an apparently corrupt MSWSOCK.dll.

Here's what I've tried so far:

// This is my second attempt at Winsock2 programming
// A console program built from the code given at
// www_dot_tenouk_dot_com/Winsock/visualstudio2008ncnwinsock2_dot_html
// MDJ 2010/09/22

// Run on Windows XP Pro machine, version 2002, SP 2
// C++ from Visual Studio 2008 Pro Edition
#include <stdio.h>
#include <winsock2.h>

// MDJ added the include below to further implement Winsock2

// Also added WS2_32.LIB and MSWSOCK.DLL under
// Project|Windock2Test002 Properties|
// Configuration Properties|Linker|Input|
// Additional Dependencies

// Also set Project|Windock2Test002 Properties|
// Configuration Properties|C/C++|Advanced|Compile As
// to Compile as C Code (/TC).

// Got error message:
// 1>LINK : fatal error LNK1104: cannot open file 'MSWSOCK.DLL'
// Therefore: commented out the following include and
// removed the MSWSOCK.DLL from the Additional
// Dependencies list.

// [Build] succeded.
// [Debug|Start Without Debugging] worked.

// Searched system to find MSWSOCK.DLL - 2/6/2010 at:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL.
// Added complete path to Additional Dependencies list.
// Uncommented the following include. Got:
// 1>C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2A8
// Tried earlier 8/4/2004 version at:
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Got same result. Tried 2/6/2010 version at:
// C:\WINDOWS\$NtServicePackUninstall$\MSWSOCK.DLL.
// Got same result.

// Renamed MSWSOCK.DLL to MSWSOCKOld.DLL at:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL and at:
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Downloaded new MSWSOCK.dll from:
// www_dot_dll-files_dot_com/dllindex/dll-files_dot_shtml?mswsock
// to C:\downloadsHold\DLLs\mswsock then unzipped.
// Version 11/18/2004 - copied to:
// C:\WINDOWS\ServicePackFiles\i386\MSWSOCK.DLL and
// C:\WINDOWS\system32\MSWSOCK.DLL.
// Changed Additional Dependencies list to:
// C:\WINDOWS\system32\MSWSOCK.DLL. Got:
// 1>C:\WINDOWS\system32\MSWSOCK.DLL : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2A8

#include <mswsock.h>

int main()
{
WORD wVersionRequested;
WSADATA wsaData;
int wsaerr;

// Using MAKEWORD macro, Winsock version request 2.2
wVersionRequested = MAKEWORD(2, 2);
wsaerr = WSAStartup(wVersionRequested, &wsaData);

if (wsaerr != 0)
{
/* Tell the user that we could not find a usable */
/* WinSock DLL.*/
printf("The Winsock dll not found!\n");
return 0;
}
else
{
printf("The Winsock dll found!\n");
printf("The status: %s.\n", wsaData.szSystemStatus);
}

/* Confirm that the WinSock DLL supports 2.2. */
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */

if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2 )
{
/* Tell the user that we could not find a usable */
/* WinSock DLL.*/
printf("The dll do not support the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion)) ;
WSACleanup();
return 0;
}
else
{
printf("The dll supports the Winsock version %u.%u!\n", LOBYTE(wsaData.wVersion),HIBYTE(wsaData.wVersion)) ;
printf("The highest version this dll can support: %u.%u\n", LOBYTE(wsaData.wHighVersion), HIBYTE(wsaData.wHighVersion));
}

/* More task... */
return 0;
}

I've also searched the forum here and at computerhope.com and at codeguru_dot_com and at bytes_dot_com and at GeekPolice and at the SocialMSDNVisualC++Forum and found no help on this issue.

Any suggestions would be appreciated.

M. David Johnson

Reply With Quote
Reply

Viewing: Tutorialized ForumsDesktop ProgrammingVisual C > Corrupt MSWSOCK.dll


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap