diff options
author | damitha | 2010-06-29 08:57:05 +0000 |
---|---|---|
committer | damitha | 2010-06-29 08:57:05 +0000 |
commit | c35e1616e67de2d5852dae647c2db6d811f451bd (patch) | |
tree | 00333633e1410647421457733ffa827efb1db0f2 /util/src/platforms/windows | |
parent | b16ecb885592c2a78dc9d69e1eb2ea7432ef4173 (diff) | |
download | axis2c-c35e1616e67de2d5852dae647c2db6d811f451bd.tar.gz axis2c-c35e1616e67de2d5852dae647c2db6d811f451bd.tar.bz2 |
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
Diffstat (limited to 'util/src/platforms/windows')
-rw-r--r-- | util/src/platforms/windows/axutil_windows.c | 186 |
1 files changed, 93 insertions, 93 deletions
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 <windows/axutil_windows.h>
-#include <stdio.h>
-
-
-/*
-
-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 <windows/axutil_windows.h> +#include <stdio.h> + + +/* + +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); +} |