Merge branch 'master' into jgrpp-beta
# Conflicts: # .github/workflows/ci-build.yml # CMakeLists.txt # src/lang/finnish.txt # src/lang/french.txt # src/lang/korean.txt # src/lang/norwegian_bokmal.txt # src/lang/russian.txt # src/lang/spanish.txt # src/misc_gui.cpp # src/newgrf.cpp
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include <signal.h>
|
||||
#include <psapi.h>
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
@@ -248,25 +249,19 @@ static char *PrintModuleInfo(char *output, const char *last, HMODULE mod)
|
||||
/* virtual */ char *CrashLogWindows::LogModules(char *output, const char *last) const
|
||||
{
|
||||
MakeCRCTable(AllocaM(uint32, 256));
|
||||
BOOL (WINAPI *EnumProcessModules)(HANDLE, HMODULE*, DWORD, LPDWORD);
|
||||
|
||||
output += seprintf(output, last, "Module information:\n");
|
||||
|
||||
if (LoadLibraryList((Function*)&EnumProcessModules, "psapi.dll\0EnumProcessModules\0\0")) {
|
||||
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
|
||||
if (proc != nullptr) {
|
||||
HMODULE modules[100];
|
||||
DWORD needed;
|
||||
BOOL res;
|
||||
BOOL res = EnumProcessModules(proc, modules, sizeof(modules), &needed);
|
||||
CloseHandle(proc);
|
||||
if (res) {
|
||||
size_t count = std::min<DWORD>(needed / sizeof(HMODULE), lengthof(modules));
|
||||
|
||||
HANDLE proc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId());
|
||||
if (proc != nullptr) {
|
||||
res = EnumProcessModules(proc, modules, sizeof(modules), &needed);
|
||||
CloseHandle(proc);
|
||||
if (res) {
|
||||
size_t count = std::min<DWORD>(needed / sizeof(HMODULE), lengthof(modules));
|
||||
|
||||
for (size_t i = 0; i != count; i++) output = PrintModuleInfo(output, last, modules[i]);
|
||||
return output + seprintf(output, last, "\n");
|
||||
}
|
||||
for (size_t i = 0; i != count; i++) output = PrintModuleInfo(output, last, modules[i]);
|
||||
return output + seprintf(output, last, "\n");
|
||||
}
|
||||
}
|
||||
output = PrintModuleInfo(output, last, nullptr);
|
||||
@@ -746,7 +741,7 @@ static void CDECL CustomAbort(int signal)
|
||||
mov safe_esp, esp
|
||||
}
|
||||
# else
|
||||
asm("movl %%esp, %0" : "=rm" ( safe_esp ));
|
||||
asm("movl %%esp, %0" : "=rm" (safe_esp));
|
||||
# endif
|
||||
_safe_esp = safe_esp;
|
||||
#endif
|
||||
|
@@ -144,7 +144,7 @@ void UniscribeResetScriptCache(FontSize size)
|
||||
/** Load the matching native Windows font. */
|
||||
static HFONT HFontFromFont(Font *font)
|
||||
{
|
||||
if (font->fc->GetOSHandle() != nullptr) return CreateFontIndirect((const PLOGFONT)font->fc->GetOSHandle());
|
||||
if (font->fc->GetOSHandle() != nullptr) return CreateFontIndirect(reinterpret_cast<PLOGFONT>(const_cast<void *>(font->fc->GetOSHandle())));
|
||||
|
||||
LOGFONT logfont;
|
||||
ZeroMemory(&logfont, sizeof(LOGFONT));
|
||||
|
@@ -40,6 +40,10 @@
|
||||
|
||||
#include "../../safeguards.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
static bool _has_console;
|
||||
static bool _cursor_disable = true;
|
||||
static bool _cursor_visible = true;
|
||||
@@ -781,38 +785,6 @@ int GetCurrentThreadName(char *str, const char *last)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the current Windows version Vista or later?
|
||||
* @return True if the current Windows is Vista or later.
|
||||
*/
|
||||
bool IsWindowsVistaOrGreater()
|
||||
{
|
||||
typedef BOOL (WINAPI * LPVERIFYVERSIONINFO)(LPOSVERSIONINFOEX, DWORD, DWORDLONG);
|
||||
typedef ULONGLONG (NTAPI * LPVERSETCONDITIONMASK)(ULONGLONG, DWORD, BYTE);
|
||||
#ifdef UNICODE
|
||||
static LPVERIFYVERSIONINFO _VerifyVersionInfo = (LPVERIFYVERSIONINFO)GetProcAddress(GetModuleHandle(_T("Kernel32")), "VerifyVersionInfoW");
|
||||
#else
|
||||
static LPVERIFYVERSIONINFO _VerifyVersionInfo = (LPVERIFYVERSIONINFO)GetProcAddress(GetModuleHandle(_T("Kernel32")), "VerifyVersionInfoA");
|
||||
#endif
|
||||
static LPVERSETCONDITIONMASK _VerSetConditionMask = (LPVERSETCONDITIONMASK)GetProcAddress(GetModuleHandle(_T("Kernel32")), "VerSetConditionMask");
|
||||
|
||||
if (_VerifyVersionInfo != nullptr && _VerSetConditionMask != nullptr) {
|
||||
OSVERSIONINFOEX osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 };
|
||||
DWORDLONG dwlConditionMask = 0;
|
||||
dwlConditionMask = _VerSetConditionMask(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
dwlConditionMask = _VerSetConditionMask(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
dwlConditionMask = _VerSetConditionMask(dwlConditionMask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
|
||||
osvi.dwMajorVersion = 6;
|
||||
osvi.dwMinorVersion = 0;
|
||||
osvi.wServicePackMajor = 0;
|
||||
|
||||
return _VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE;
|
||||
} else {
|
||||
return LOBYTE(GetVersion()) >= 6;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* Based on code from MSDN: https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx */
|
||||
const DWORD MS_VC_EXCEPTION = 0x406D1388;
|
||||
|
@@ -25,6 +25,5 @@ wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
|
||||
|
||||
void Win32SetCurrentLocaleName(const char *iso_code);
|
||||
int OTTDStringCompare(const char *s1, const char *s2);
|
||||
bool IsWindowsVistaOrGreater();
|
||||
|
||||
#endif /* WIN32_H */
|
||||
|
Reference in New Issue
Block a user