summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2025-06-28 13:16:21 +0300
committerGeorge Hazan <george.hazan@gmail.com>2025-06-28 13:16:21 +0300
commit603e8738b37583473102f0964c826678d790d764 (patch)
treed54b3e4473de5607fb9901b331e8d55ba7ee50c3 /src/mir_core
parentd73824121408b3386f990246c9e06682b711492a (diff)
Wine fix for menu icons
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/Windows/miranda.cpp2
-rw-r--r--src/mir_core/src/Windows/threads.cpp2
-rw-r--r--src/mir_core/src/Windows/winver.cpp17
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/miranda.h2
6 files changed, 15 insertions, 10 deletions
diff --git a/src/mir_core/src/Windows/miranda.cpp b/src/mir_core/src/Windows/miranda.cpp
index dc867b89fe..0e4bd9d344 100644
--- a/src/mir_core/src/Windows/miranda.cpp
+++ b/src/mir_core/src/Windows/miranda.cpp
@@ -39,7 +39,7 @@ void InitHyperlink();
void InitTimeZones();
void InitWinver();
-HINSTANCE g_hInst = nullptr;
+HINSTANCE g_hInst = nullptr, g_hNtdll = GetModuleHandleA("ntdll.dll");
HCURSOR g_hCursorNS, g_hCursorWE;
HANDLE hThreadQueueEmpty;
diff --git a/src/mir_core/src/Windows/threads.cpp b/src/mir_core/src/Windows/threads.cpp
index 1685d8c31a..898c6c0455 100644
--- a/src/mir_core/src/Windows/threads.cpp
+++ b/src/mir_core/src/Windows/threads.cpp
@@ -305,7 +305,7 @@ typedef LONG (WINAPI *pNtQIT)(HANDLE, LONG, PVOID, ULONG, PULONG);
static void* GetCurrentThreadEntryPoint()
{
- pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(GetModuleHandle(L"ntdll.dll"), "NtQueryInformationThread");
+ pNtQIT NtQueryInformationThread = (pNtQIT)GetProcAddress(g_hNtdll, "NtQueryInformationThread");
if (NtQueryInformationThread == nullptr)
return nullptr;
diff --git a/src/mir_core/src/Windows/winver.cpp b/src/mir_core/src/Windows/winver.cpp
index 704464d5f3..b3fadf2043 100644
--- a/src/mir_core/src/Windows/winver.cpp
+++ b/src/mir_core/src/Windows/winver.cpp
@@ -30,11 +30,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
static int dwWinVer;
+static bool bIsWine = false;
void InitWinver()
{
uint32_t dwVer = LOWORD(GetVersion());
dwWinVer = MAKEWORD(HIBYTE(dwVer), LOBYTE(dwVer));
+ bIsWine = GetProcAddress(g_hNtdll, "wine_get_version") != 0;
}
MIR_CORE_DLL(BOOL) IsWinVerVistaPlus()
@@ -62,17 +64,21 @@ MIR_CORE_DLL(BOOL) IsWinVer10Plus()
return dwWinVer >= _WIN32_WINNT_WIN10;
}
-MIR_CORE_DLL(BOOL) IsFullScreen()
+MIR_CORE_DLL(BOOL) IsWine()
{
- RECT rcScreen = { 0 };
+ return bIsWine;
+}
+MIR_CORE_DLL(BOOL) IsFullScreen()
+{
+ RECT rcScreen = {};
rcScreen.right = GetSystemMetrics(SM_CXSCREEN);
rcScreen.bottom = GetSystemMetrics(SM_CYSCREEN);
HMONITOR hMon = MonitorFromWindow(GetForegroundWindow(), MONITOR_DEFAULTTONEAREST);
MONITORINFO mi;
mi.cbSize = sizeof(mi);
- if (GetMonitorInfo(hMon, &mi))
+ if (GetMonitorInfoW(hMon, &mi))
rcScreen = mi.rcMonitor;
HWND hWndDesktop = GetDesktopWindow();
@@ -362,11 +368,8 @@ MIR_CORE_DLL(BOOL) OS_GetDisplayString(char *buf, size_t bufSize)
ret.AppendFormat(" (build %d)", osvi.dwBuildNumber);
- HMODULE hNtDll = GetModuleHandleA("ntdll.dll");
- if (WGV wine_get_version = (WGV)GetProcAddress(hNtDll, "wine_get_version"))
- {
+ if (WGV wine_get_version = (WGV)GetProcAddress(g_hNtdll, "wine_get_version"))
ret.AppendFormat(" (Wine %s)", wine_get_version());
- }
mir_strncpy(buf, ret, bufSize);
return true;
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 2c91438bee..f0ce0a70db 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1589,3 +1589,4 @@ _db_event_delivered@8 @1806 NONAME
??6MBinBuffer@@QAEAAV0@_K@Z @1814 NONAME
_Utils_IsoToUnixTime@4 @1815 NONAME
?db_event_setJson@@YGHIPBD@Z @1816 NONAME
+_IsWine@0 @1817 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 2f83d9c0b0..935c5d83cb 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1589,3 +1589,4 @@ db_event_delivered @1806 NONAME
??6MBinBuffer@@QEAAAEAV0@_K@Z @1814 NONAME
Utils_IsoToUnixTime @1815 NONAME
?db_event_setJson@@YAHIPEBD@Z @1816 NONAME
+IsWine @1817 NONAME
diff --git a/src/mir_core/src/miranda.h b/src/mir_core/src/miranda.h
index c76d55c2c6..cedf24e528 100644
--- a/src/mir_core/src/miranda.h
+++ b/src/mir_core/src/miranda.h
@@ -31,7 +31,7 @@ void DestroyModularEngine(void);
int InitPathUtils(void);
-extern HINSTANCE g_hInst;
+extern HINSTANCE g_hInst, g_hNtdll;
extern HWND hAPCWindow;
extern HANDLE hThreadQueueEmpty;
extern HCURSOR g_hCursorNS, g_hCursorWE;