Bug 925599 - Replace GetVersionEx() in toolkit/. r=bsmedberg

This commit is contained in:
Masatoshi Kimura 2013-11-22 12:35:40 +09:00
Родитель 94e32908ff
Коммит ad49423ee9
2 изменённых файлов: 8 добавлений и 22 удалений

Просмотреть файл

@ -7,6 +7,9 @@
#include <delayimp.h>
#include "nsToolkit.h"
#include "mozilla/Assertions.h"
#include "mozilla/WindowsVersion.h"
using mozilla::IsWin8OrLater;
#if defined(__GNUC__)
// If DllMain gets name mangled, it won't be seen.
@ -63,22 +66,6 @@ BOOL APIENTRY DllMain(
* way. __abi_FailFast is called by exception handling code generated by the
* compiler for delegate events.
*/
static bool IsWin8OrHigher()
{
static int32_t version = 0;
if (version) {
return (version >= 0x602);
}
// Match Win8 or Win8 Server or higher
OSVERSIONINFOEX osInfo;
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
::GetVersionEx((OSVERSIONINFO*)&osInfo);
version =
(osInfo.dwMajorVersion & 0xff) << 8 | (osInfo.dwMinorVersion & 0xff);
return (version >= 0x602);
}
const char* kvccorlib = "vccorlib";
const char* kwinrtprelim = "api-ms-win-core-winrt";
@ -86,13 +73,13 @@ const char* kfailfast = "?__abi_FailFast";
static bool IsWinRTDLLNotPresent(PDelayLoadInfo pdli, const char* aLibToken)
{
return (!IsWin8OrHigher() && pdli->szDll &&
return (!IsWin8OrLater() && pdli->szDll &&
!strnicmp(pdli->szDll, aLibToken, strlen(aLibToken)));
}
static bool IsWinRTDLLPresent(PDelayLoadInfo pdli, const char* aLibToken)
{
return (IsWin8OrHigher() && pdli->szDll &&
return (IsWin8OrLater() && pdli->szDll &&
!strnicmp(pdli->szDll, aLibToken, strlen(aLibToken)));
}

Просмотреть файл

@ -99,6 +99,7 @@
#include "nsIWinAppHelper.h"
#include <windows.h>
#include "cairo/cairo-features.h"
#include "mozilla/WindowsVersion.h"
#ifdef MOZ_METRO
#include <roapi.h>
#endif
@ -2867,10 +2868,8 @@ XREMain::XRE_mainInit(bool* aExitFlag)
// manual font file I/O on _all_ system fonts. To avoid this, load the
// dwrite library and create a factory as early as possible so that the
// FntCache service is ready by the time it's needed.
OSVERSIONINFO vinfo;
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
if (GetVersionEx(&vinfo) && vinfo.dwMajorVersion >= 6) {
if (IsVistaOrLater()) {
CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG,
nullptr, 0, nullptr);
}