</ItemGroup>
<ItemGroup>
<ClCompile Include="src\CPUFeatures_Win32.cpp" />
+ <ClCompile Include="src\DLLMain.cpp" />
<ClCompile Include="src\Global.cpp" />
<ClCompile Include="src\KeccakHash.cpp" />
<ClCompile Include="src\OSSupport_Win32.cpp" />
<ClCompile Include="src\CPUFeatures_Win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\DLLMain.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\CriticalSection_Win32.h">
catch(const std::exception &error) \
{ \
MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nException error:\n%s\n", error.what()); \
- MUtils::OS::fatal_exit("Unhandeled C++ exception error, application will exit!"); \
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
} \
catch(...) \
{ \
MUTILS_PRINT_ERROR("\nGURU MEDITATION !!!\n\nUnknown exception error!\n"); \
- MUtils::OS::fatal_exit("Unhandeled C++ exception error, application will exit!"); \
+ MUtils::OS::fatal_exit(L"Unhandeled C++ exception error, application will exit!"); \
} \
} \
while(0)
MUTILS_API int network_status(void);
//Error handling
- MUTILS_API void fatal_exit(const char* const errorMessage);
+ MUTILS_API void fatal_exit(const wchar_t* const errorMessage);
}
}
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// MuldeR's Utilities for Qt
+// Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+//
+// http://www.gnu.org/licenses/lgpl-2.1.txt
+//////////////////////////////////////////////////////////////////////////////////
+
+#ifdef _MSC_VER
+#ifndef MUTILS_STATIC_LIB
+
+//Win32 API
+#define WIN32_LEAN_AND_MEAN 1
+#include <Windows.h>
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}
+
+#endif //MUTILS_STATIC_LIB
+#endif //_MSC_VER
// SYSTEM MESSAGE
///////////////////////////////////////////////////////////////////////////////
+static const UINT g_msgBoxFlags = MB_TOPMOST | MB_TASKMODAL | MB_SETFOREGROUND;
+
void MUtils::OS::system_message_nfo(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONINFORMATION);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONINFORMATION);
}
void MUtils::OS::system_message_wrn(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONWARNING);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONWARNING);
}
void MUtils::OS::system_message_err(const wchar_t *const title, const wchar_t *const text)
{
- MessageBoxW(NULL, text, title, MB_TOPMOST | MB_TASKMODAL | MB_ICONERROR);
+ MessageBoxW(NULL, text, title, g_msgBoxFlags | MB_ICONERROR);
}
///////////////////////////////////////////////////////////////////////////////
static DWORD WINAPI fatal_exit_helper(LPVOID lpParameter)
{
- MessageBoxA(NULL, ((LPCSTR) lpParameter), "GURU MEDITATION", MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_TOPMOST | MB_SETFOREGROUND);
+ MUtils::OS::system_message_err((LPWSTR) lpParameter, L"GURU MEDITATION");
return 0;
}
-void MUtils::OS::fatal_exit(const char* const errorMessage)
+void MUtils::OS::fatal_exit(const wchar_t* const errorMessage)
{
g_fatal_exit_lock.enter();