mingw and unicode definition fix cleaned up logbacktrace_win.cpp gcc asm currenly missing
message(STATUS "Not enabling KDE4 integration")
endif(WITH_KDE)
+# needed to compile with mingw without kde
+if(MINGW AND NOT HAVE_KDE)
+ add_definitions(-D_WIN32_WINNT=0x0500)
+ message(STATUS "Added _WIN32_WINNT=0x0500 definition for MinGW")
+endif(MINGW AND NOT HAVE_KDE)
+
# Setup Phonon support - we only need this if we don't have or want KDE4
if(NOT HAVE_KDE)
if(WITH_PHONON)
init();
}
+#ifdef Q_WS_WIN
+#ifdef UNICODE
+QString tcharToQString(TCHAR *tchar){
+ return QString::fromUtf16( reinterpret_cast<ushort*>(tchar));
+}
+#else
+QString tcharToQString(TCHAR *tchar){
+ return QString::fromLocal8Bit(tchar);
+}
+#endif
+
+#endif
void Identity::init() {
setObjectName(QString::number(id().toInt()));
setAllowClientUpdates(true);
DWORD bufCharCount = 128;
//if(GetUserNameEx(/* NameSamCompatible */ 1, infoBuf, &bufCharCount))
if(GetUserNameEx(NameSamCompatible, infoBuf, &bufCharCount)) {
- QString nickName(infoBuf);
+ QString nickName(tcharToQString(infoBuf));
int lastBs = nickName.lastIndexOf('\\');
if(lastBs != -1) {
nickName = nickName.mid(lastBs + 1);
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
if(GetUserName(infoBuf, &bufCharCount))
- return QString(infoBuf);
+ return tcharToQString(infoBuf);
else
return generalDefault;
#else
EnumModulesContext(HANDLE hProcess, QTextStream &stream) : hProcess(hProcess), stream(stream) {}
};
-BOOL CALLBACK EnumModulesCB(PCTSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
+BOOL CALLBACK EnumModulesCB(LPCSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
IMAGEHLP_MODULE64 mod;
EnumModulesContext *context = (EnumModulesContext *)UserContext;
mod.SizeOfStruct = sizeof(IMAGEHLP_MODULE64);
return TRUE;
}
-// we don't use the ModuleName anyways so we can easily "convert" this
-inline BOOL CALLBACK EnumModulesCB(PSTR ModuleName, DWORD64 BaseOfDll, PVOID UserContext) {
- return EnumModulesCB(PCTSTR(0), BaseOfDll, UserContext);
-}
-#ifdef _M_IX86
+
+#if defined( _M_IX86 ) && defined(Q_CC_MSVC)
// Disable global optimization and ignore /GS waning caused by
// inline assembly.
+ // not needed with mingw cause we can tell mingw which registers we use
#pragma optimize("g", off)
#pragma warning(push)
#pragma warning(disable : 4748)
#ifdef _M_IX86
ZeroMemory(&Context, sizeof(CONTEXT));
Context.ContextFlags = CONTEXT_CONTROL;
- __asm {
+
+// TODO: port asssembler to mingw32
+#ifdef __MINGW32__
+// asm("Label:\n\t"
+// "movl %%ebp,%0;\n\t"
+// "movl %%esp,%1;\n\t"
+// "movl $Label,%%eax;\n\t"
+// "movl %%eax,;\n\t"
+// :"=r"(Content.Epb),"=r"(Context.Esp),"=r"(Context.Eip)
+// ://no input
+// :"ebp","esp","eax");
+#else
+ _asm {
Label:
mov [Context.Ebp], ebp;
mov [Context.Esp], esp;
mov eax, [Label];
mov [Context.Eip], eax;
}
+#endif
#else
RtlCaptureContext(&Context);
#endif
logFile.close();
}
-#ifdef _M_IX86
+#if defined(_M_IX86) && defined(Q_CC_MSVC)
#pragma warning(pop)
#pragma optimize("g", on)
#endif
#define SYNCABLE_OBJECT static const int _classNameOffset__;
#define INIT_SYNCABLE_OBJECT(x) const int x ::_classNameOffset__ = QByteArray(staticMetaObject.className()).length() + 2;
-#ifdef Q_WS_WIN
+#ifdef Q_CC_MSVC
# define SYNC(...) sync_call__(SignalProxy::Server, (__FUNCTION__ + _classNameOffset__), __VA_ARGS__);
# define REQUEST(...) sync_call__(SignalProxy::Client, (__FUNCTION__ + _classNameOffset__) , __VA_ARGS__);
#else
# define SYNC(...) sync_call__(SignalProxy::Server, __func__, __VA_ARGS__);
# define REQUEST(...) sync_call__(SignalProxy::Client, __func__, __VA_ARGS__);
-#endif //Q_WS_WIN
+#endif //Q_CC_MSVC
#define SYNC_OTHER(x, ...) sync_call__(SignalProxy::Server, #x, __VA_ARGS__);
#define REQUEST_OTHER(x, ...) sync_call__(SignalProxy::Client, #x, __VA_ARGS__);