updated for winsock II
This commit is contained in:
@@ -38,6 +38,8 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "epicsVersion.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This source is specific to WIN32
|
||||
#endif
|
||||
@@ -56,20 +58,35 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
/* for gui applications, setup console for error messages */
|
||||
if (AllocConsole())
|
||||
{
|
||||
SetConsoleTitle("Channel Access Status");
|
||||
SetConsoleTitle(BASE_VERSION_STRING);
|
||||
freopen( "CONOUT$", "a", stderr );
|
||||
fprintf(stderr, "Process attached to Com.dll version %s\n", EPICS_VERSION_STRING);
|
||||
}
|
||||
#endif
|
||||
if (init_osi_time ())
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* for use of select() by the fd managers
|
||||
*/
|
||||
if (WSAStartup(MAKEWORD(2,0), &WsaData) != 0) {
|
||||
WSACleanup();
|
||||
fprintf(stderr,"libCom unable to init winsock\n");
|
||||
return FALSE;
|
||||
if (WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData) != 0) {
|
||||
/*
|
||||
* The winsock I & II doc indicate that these steps are not required,
|
||||
* but experience at some sites proves otherwise. Perhaps some vendors
|
||||
* do not follow the protocol described in the doc.
|
||||
*/
|
||||
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/1), &WsaData) != 0) {
|
||||
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/0), &WsaData) != 0) {
|
||||
WSACleanup();
|
||||
fprintf(stderr,"Unable to attach to winsock version 2.2 or lower\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if _DEBUG
|
||||
fprintf(stderr, "EPICS Com.dll attached to winsock version %s\n", WsaData.szDescription);
|
||||
#endif
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
exit_osi_time ();
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "epicsVersion.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This source is specific to WIN32
|
||||
#endif
|
||||
@@ -56,20 +58,35 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
/* for gui applications, setup console for error messages */
|
||||
if (AllocConsole())
|
||||
{
|
||||
SetConsoleTitle("Channel Access Status");
|
||||
SetConsoleTitle(BASE_VERSION_STRING);
|
||||
freopen( "CONOUT$", "a", stderr );
|
||||
fprintf(stderr, "Process attached to Com.dll version %s\n", EPICS_VERSION_STRING);
|
||||
}
|
||||
#endif
|
||||
if (init_osi_time ())
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
* for use of select() by the fd managers
|
||||
*/
|
||||
if (WSAStartup(MAKEWORD(2,0), &WsaData) != 0) {
|
||||
WSACleanup();
|
||||
fprintf(stderr,"libCom unable to init winsock\n");
|
||||
return FALSE;
|
||||
if (WSAStartup(MAKEWORD(/*major*/2,/*minor*/2), &WsaData) != 0) {
|
||||
/*
|
||||
* The winsock I & II doc indicate that these steps are not required,
|
||||
* but experience at some sites proves otherwise. Perhaps some vendors
|
||||
* do not follow the protocol described in the doc.
|
||||
*/
|
||||
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/1), &WsaData) != 0) {
|
||||
if (WSAStartup(MAKEWORD(/*major*/1,/*minor*/0), &WsaData) != 0) {
|
||||
WSACleanup();
|
||||
fprintf(stderr,"Unable to attach to winsock version 2.2 or lower\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if _DEBUG
|
||||
fprintf(stderr, "EPICS Com.dll attached to winsock version %s\n", WsaData.szDescription);
|
||||
#endif
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
exit_osi_time ();
|
||||
|
||||
Reference in New Issue
Block a user