mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-27 02:37:16 +00:00
Add Wine version to user agent string in case that we're running Aseprite from Wine
This commit is contained in:
parent
3cd6fa2f08
commit
bf649df9f2
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -16,6 +17,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
extern "C" BOOL IsWow64();
|
||||
extern "C" const char* WineVersion();
|
||||
|
||||
#elif __APPLE__ // Mac OS X
|
||||
|
||||
@ -77,6 +79,9 @@ std::string getUserAgent()
|
||||
if (IsWow64())
|
||||
userAgent << "; WOW64";
|
||||
|
||||
if (const char* wineVer = WineVersion())
|
||||
userAgent << "; Wine " << wineVer;
|
||||
|
||||
#elif __APPLE__
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2019 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -10,19 +11,35 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
|
||||
typedef BOOL (WINAPI* LPFN_ISWOW64PROCESS)(HANDLE, PBOOL);
|
||||
typedef const char* (CDECL* LPFN_WINE_GET_VERSION)(void);
|
||||
|
||||
static LPFN_ISWOW64PROCESS fnIsWow64Process = NULL;
|
||||
static LPFN_WINE_GET_VERSION fnWineGetVersion = NULL;
|
||||
|
||||
BOOL IsWow64()
|
||||
{
|
||||
if (!fnIsWow64Process) {
|
||||
fnIsWow64Process = (LPFN_ISWOW64PROCESS)
|
||||
GetProcAddress(GetModuleHandle(L"kernel32"),
|
||||
"IsWow64Process");
|
||||
}
|
||||
|
||||
BOOL isWow64 = FALSE;
|
||||
|
||||
fnIsWow64Process = (LPFN_ISWOW64PROCESS)
|
||||
GetProcAddress(GetModuleHandle(L"kernel32"),
|
||||
"IsWow64Process");
|
||||
if (fnIsWow64Process != NULL)
|
||||
if (fnIsWow64Process)
|
||||
fnIsWow64Process(GetCurrentProcess(), &isWow64);
|
||||
|
||||
return isWow64;
|
||||
}
|
||||
|
||||
const char* WineVersion()
|
||||
{
|
||||
if (!fnWineGetVersion) {
|
||||
fnWineGetVersion = (LPFN_WINE_GET_VERSION)
|
||||
GetProcAddress(GetModuleHandle(L"ntdll.dll"),
|
||||
"wine_get_version");
|
||||
}
|
||||
if (fnWineGetVersion)
|
||||
return fnWineGetVersion();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user