From c35e1616e67de2d5852dae647c2db6d811f451bd Mon Sep 17 00:00:00 2001 From: damitha Date: Tue, 29 Jun 2010 08:57:05 +0000 Subject: Partial fix of AXIS2C-1440 git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@958884 13f79535-47bb-0310-9956-ffa450edef68 --- util/src/platforms/windows/axutil_windows.c | 186 ++++++++++++++-------------- 1 file changed, 93 insertions(+), 93 deletions(-) (limited to 'util/src/platforms/windows') diff --git a/util/src/platforms/windows/axutil_windows.c b/util/src/platforms/windows/axutil_windows.c index e2abb5d..5e37abb 100644 --- a/util/src/platforms/windows/axutil_windows.c +++ b/util/src/platforms/windows/axutil_windows.c @@ -1,93 +1,93 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - - -/* - -std::string* getPlatformErrorMessage(long errorNumber) -{ - std::string* returningString = new std::string(); - LPVOID lpMsgBuf; - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - errorNumber, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, NULL ); - - returningString->append((LPTSTR)lpMsgBuf); - LocalFree(lpMsgBuf); - - return returningString; -} - */ -AXIS2_EXTERN HMODULE AXIS2_CALL -callLoadLib( - char *lib) -{ - /* Disable display of the critical-error-handler message box */ - SetErrorMode(SEM_FAILCRITICALERRORS); - return LoadLibraryEx(lib, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); -} - -AXIS2_EXTERN struct tm *AXIS2_CALL -axis2_win_gmtime( - const time_t * timep, - struct tm *result) -{ - return gmtime(timep); -} - -AXIS2_EXTERN void AXIS2_CALL -axutil_win32_get_last_error( - axis2_char_t *buf, - unsigned int buf_size) -{ - LPVOID lpMsgBuf; - int rc = GetLastError(); - sprintf(buf, "DLL Load Error %d: ", rc); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, rc, 0, - (LPTSTR) & lpMsgBuf, 0, NULL); - if(lpMsgBuf) - { - strncat(buf, (char*)lpMsgBuf, buf_size - strlen(buf) - 1); - } - LocalFree(lpMsgBuf); -} - -AXIS2_EXTERN void AXIS2_CALL -axutil_win32_get_last_wsa_error( - axis2_char_t *buf, - unsigned int buf_size) -{ - LPVOID lpMsgBuf; - int rc = WSAGetLastError(); - sprintf(buf, "Winsock error %d: ", rc); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, rc, 0, - (LPTSTR) & lpMsgBuf, 0, NULL); - if(lpMsgBuf) - { - strncat(buf, (char*)lpMsgBuf, buf_size - strlen(buf) - 1); - } - LocalFree(lpMsgBuf); -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + + +/* + +std::string* getPlatformErrorMessage(long errorNumber) +{ + std::string* returningString = new std::string(); + LPVOID lpMsgBuf; + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + errorNumber, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + returningString->append((LPTSTR)lpMsgBuf); + LocalFree(lpMsgBuf); + + return returningString; +} + */ +AXIS2_EXTERN HMODULE AXIS2_CALL +callLoadLib( + char *lib) +{ + /* Disable display of the critical-error-handler message box */ + SetErrorMode(SEM_FAILCRITICALERRORS); + return LoadLibraryEx(lib, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); +} + +AXIS2_EXTERN struct tm *AXIS2_CALL +axis2_win_gmtime( + const time_t * timep, + struct tm *result) +{ + return gmtime(timep); +} + +AXIS2_EXTERN void AXIS2_CALL +axutil_win32_get_last_error( + axis2_char_t *buf, + unsigned int buf_size) +{ + LPVOID lpMsgBuf; + int rc = GetLastError(); + sprintf(buf, "DLL Load Error %d: ", rc); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, rc, 0, + (LPTSTR) & lpMsgBuf, 0, NULL); + if(lpMsgBuf) + { + strncat(buf, (char*)lpMsgBuf, buf_size - strlen(buf) - 1); + } + LocalFree(lpMsgBuf); +} + +AXIS2_EXTERN void AXIS2_CALL +axutil_win32_get_last_wsa_error( + axis2_char_t *buf, + unsigned int buf_size) +{ + LPVOID lpMsgBuf; + int rc = WSAGetLastError(); + sprintf(buf, "Winsock error %d: ", rc); + FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, rc, 0, + (LPTSTR) & lpMsgBuf, 0, NULL); + if(lpMsgBuf) + { + strncat(buf, (char*)lpMsgBuf, buf_size - strlen(buf) - 1); + } + LocalFree(lpMsgBuf); +} -- cgit v1.1-32-gdbae