From e0944b7e3997e94cdcb426bd107194ab21d4d88d Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Fri, 10 Apr 1998 23:00:57 +0000 Subject: [PATCH] link with user32 lib under WIN32 --- src/ca/Makefile.Host | 2 +- src/ca/service.c | 8 ++++-- src/ca/windows_depen.c | 61 +++++++++++++++++++++++++++++++++++++++--- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/src/ca/Makefile.Host b/src/ca/Makefile.Host index 81a776e4c..dce047b91 100644 --- a/src/ca/Makefile.Host +++ b/src/ca/Makefile.Host @@ -47,7 +47,7 @@ PROD := caRepeater # libs needed to build [TEST]PRODUCT PROD_LIBS := ca Com -SYS_PROD_LIBS_WIN32 := ws2_32 winmm +SYS_PROD_LIBS_WIN32 := ws2_32 winmm user32 TESTPROD := catime acctst diff --git a/src/ca/service.c b/src/ca/service.c index d3e362b65..873ed585e 100644 --- a/src/ca/service.c +++ b/src/ca/service.c @@ -832,12 +832,16 @@ const struct in_addr *pnet_addr ina.sin_family = AF_INET; if (CA_V48 (CA_PROTOCOL_VERSION,minorVersion)) { if (piiu->curMsg.m_cid != INADDR_BROADCAST) { - ina.sin_addr.s_addr = htonl(piiu->curMsg.m_cid); + /* + * Leave address in network byte order (m_cid has not been + * converted to the local byte order) + */ + ina.sin_addr.s_addr = piiu->curMsg.m_cid; } else { ina.sin_addr = *pnet_addr; } - ina.sin_port = htons(piiu->curMsg.m_type); + ina.sin_port = htons (piiu->curMsg.m_type); } else if (CA_V45 (CA_PROTOCOL_VERSION,minorVersion)) { ina.sin_port = htons(piiu->curMsg.m_type); diff --git a/src/ca/windows_depen.c b/src/ca/windows_depen.c index 3f926d39a..f05b1477d 100644 --- a/src/ca/windows_depen.c +++ b/src/ca/windows_depen.c @@ -32,6 +32,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.34 1998/03/24 20:55:06 jhill + * fixed console title/correct repeater spawn/correct winsock II URL + * * Revision 1.33 1998/03/12 20:39:11 jhill * fixed problem where 3.13.beta11 unable to connect to 3.11 with correct native type * @@ -55,6 +58,9 @@ * * Revision 1.19 1995/11/29 19:15:42 jhill * added $Log$ + * added Revision 1.34 1998/03/24 20:55:06 jhill + * added fixed console title/correct repeater spawn/correct winsock II URL + * added * added Revision 1.33 1998/03/12 20:39:11 jhill * added fixed problem where 3.13.beta11 unable to connect to 3.11 with correct native type * added @@ -277,10 +283,57 @@ void ca_spawn_repeater() &processInfo // pointer to PROCESS_INFORMATION ); if (!status) { - ca_printf ("!!WARNING!!\n"); - ca_printf ("Unable to locate the EPICS executable \"%s\".\n", - pImageName); - ca_printf ("You may need to modify your environment.\n"); + DWORD W32status; + LPVOID errStrMsgBuf; + LPVOID complteMsgBuf; + + W32status = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + GetLastError (), + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &errStrMsgBuf, + 0, + NULL + ); + + if (W32status) { + char *pFmtArgs[] = { + "Failed to start the EPICS CA Repeater -", + pImageName, + errStrMsgBuf, + "Changes may be required in your \"path\" environement variable."}; + + W32status = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | + FORMAT_MESSAGE_ARGUMENT_ARRAY | 80, + "%1 \"%2\". %3 %4", + 0, + MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPTSTR) &complteMsgBuf, + 0, + pFmtArgs + ); + if (W32status) { + // Display the string. + MessageBox (NULL, complteMsgBuf, "EPICS Channel Access Configuration Problem", + MB_OK|MB_ICONINFORMATION); + LocalFree (complteMsgBuf); + } + else { + // Display the string. + MessageBox (NULL, errStrMsgBuf, "Failed to start EPICS caRepeater.exe", + MB_OK|MB_ICONINFORMATION); + } + + // Free the buffer. + LocalFree (errStrMsgBuf); + } + else { + ca_printf ("!!WARNING!!\n"); + ca_printf ("Unable to locate the EPICS executable \"%s\".\n", pImageName); + ca_printf ("You may need to modify your environment.\n"); + } } //