From 6355a5b28df41725c0c77116f6d5a93ae576a192 Mon Sep 17 00:00:00 2001 From: Roland Schwarz Date: Fri, 22 Dec 2006 09:40:17 +0000 Subject: [PATCH] Changes for WINCE [SVN r36484] --- src/exceptions.cpp | 41 ++++++++++++++++++++++++++++++----------- src/mutex.inl | 2 +- src/tss_dll.cpp | 2 ++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/exceptions.cpp b/src/exceptions.cpp index cc635101..45575e3c 100644 --- a/src/exceptions.cpp +++ b/src/exceptions.cpp @@ -24,6 +24,10 @@ namespace std { using ::strerror; } # endif # if defined( BOOST_WINDOWS ) +# ifdef BOOST_NO_ANSI_APIS +# include +# include // for USES_CONVERSION and A2CW +# endif # include "windows.h" # else # include // for POSIX error codes @@ -37,17 +41,32 @@ std::string system_message(int sys_err_code) std::string str; # ifdef BOOST_WINDOWS LPVOID lpMsgBuf; - ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - sys_err_code, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPSTR)&lpMsgBuf, - 0, - NULL); - str += static_cast(lpMsgBuf); - ::LocalFree(lpMsgBuf); // free the buffer +# ifndef BOOST_NO_ANSI_APIS + ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + sys_err_code, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPSTR)&lpMsgBuf, + 0, + NULL); + str += static_cast(lpMsgBuf); + ::LocalFree(lpMsgBuf); // free the buffer +# else + ::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + sys_err_code, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language + (LPWSTR)&lpMsgBuf, + 0, + NULL); + USES_CONVERSION; + str += static_cast(lpMsgBuf); + : :LocalFree(lpMsgBuf); // free the buffer +# endif while (str.size() && (str[str.size()-1] == '\n' || str[str.size()-1] == '\r')) { diff --git a/src/mutex.inl b/src/mutex.inl index 257556c8..7540e3ed 100644 --- a/src/mutex.inl +++ b/src/mutex.inl @@ -24,7 +24,7 @@ void init_TryEnterCriticalSection() version_info.dwMajorVersion >= 4) { if (HMODULE kernel_module = GetModuleHandle(TEXT("KERNEL32.DLL"))) - g_TryEnterCriticalSection = reinterpret_cast(GetProcAddress(kernel_module, "TryEnterCriticalSection")); + g_TryEnterCriticalSection = reinterpret_cast(GetProcAddress(kernel_module, TEXT("TryEnterCriticalSection"))); } } diff --git a/src/tss_dll.cpp b/src/tss_dll.cpp index f7229ae3..0522a123 100644 --- a/src/tss_dll.cpp +++ b/src/tss_dll.cpp @@ -14,6 +14,8 @@ #if defined(__BORLANDC__) extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) + #elif defined(_WIN32_WCE) + extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) #else extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/) #endif