2016-06-16 12:59:54 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-06-16 12:59:54 +00:00
|
|
|
*/
|
|
|
|
#include "platform/win/windows_dlls.h"
|
|
|
|
|
2020-07-02 17:01:25 +00:00
|
|
|
#include "base/platform/win/base_windows_safe_library.h"
|
|
|
|
|
2019-06-03 10:48:36 +00:00
|
|
|
#include <VersionHelpers.h>
|
2018-07-28 10:50:28 +00:00
|
|
|
#include <QtCore/QSysInfo>
|
|
|
|
|
2021-05-10 14:27:23 +00:00
|
|
|
#define LOAD_SYMBOL(lib, name) ::base::Platform::LoadMethod(lib, #name, name)
|
2021-04-19 15:41:14 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
namespace Platform {
|
|
|
|
namespace Dlls {
|
2021-06-30 21:15:56 +00:00
|
|
|
namespace {
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
struct SafeIniter {
|
|
|
|
SafeIniter();
|
|
|
|
};
|
2016-08-14 18:55:59 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
SafeIniter::SafeIniter() {
|
|
|
|
base::Platform::InitDynamicLibraries();
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibShell32 = LoadLibrary(L"shell32.dll");
|
2021-05-10 14:27:23 +00:00
|
|
|
LOAD_SYMBOL(LibShell32, SHAssocEnumHandlers);
|
|
|
|
LOAD_SYMBOL(LibShell32, SHCreateItemFromParsingName);
|
|
|
|
LOAD_SYMBOL(LibShell32, SHOpenWithDialog);
|
|
|
|
LOAD_SYMBOL(LibShell32, OpenAs_RunDLL);
|
|
|
|
LOAD_SYMBOL(LibShell32, SHQueryUserNotificationState);
|
|
|
|
LOAD_SYMBOL(LibShell32, SHChangeNotify);
|
|
|
|
LOAD_SYMBOL(LibShell32, SetCurrentProcessExplicitAppUserModelID);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibUxTheme = LoadLibrary(L"uxtheme.dll");
|
2021-05-10 14:27:23 +00:00
|
|
|
LOAD_SYMBOL(LibUxTheme, SetWindowTheme);
|
2020-07-24 12:15:32 +00:00
|
|
|
//if (IsWindows10OrGreater()) {
|
|
|
|
// static const auto kSystemVersion = QOperatingSystemVersion::current();
|
|
|
|
// static const auto kMinor = kSystemVersion.minorVersion();
|
|
|
|
// static const auto kBuild = kSystemVersion.microVersion();
|
|
|
|
// if (kMinor > 0 || (kMinor == 0 && kBuild >= 17763)) {
|
|
|
|
// if (kBuild < 18362) {
|
2021-05-10 14:27:23 +00:00
|
|
|
// LOAD_SYMBOL(LibUxTheme, AllowDarkModeForApp, 135);
|
2020-07-24 12:15:32 +00:00
|
|
|
// } else {
|
2021-05-10 14:27:23 +00:00
|
|
|
// LOAD_SYMBOL(LibUxTheme, SetPreferredAppMode, 135);
|
2020-07-24 12:15:32 +00:00
|
|
|
// }
|
2021-05-10 14:27:23 +00:00
|
|
|
// LOAD_SYMBOL(LibUxTheme, AllowDarkModeForWindow, 133);
|
|
|
|
// LOAD_SYMBOL(LibUxTheme, RefreshImmersiveColorPolicyState, 104);
|
|
|
|
// LOAD_SYMBOL(LibUxTheme, FlushMenuThemes, 136);
|
2020-07-24 12:15:32 +00:00
|
|
|
// }
|
|
|
|
//}
|
2016-08-14 22:53:47 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibWtsApi32 = LoadLibrary(L"wtsapi32.dll");
|
2021-06-30 15:20:49 +00:00
|
|
|
LOAD_SYMBOL(LibWtsApi32, WTSRegisterSessionNotification);
|
|
|
|
LOAD_SYMBOL(LibWtsApi32, WTSUnRegisterSessionNotification);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibPropSys = LoadLibrary(L"propsys.dll");
|
2021-06-30 15:20:49 +00:00
|
|
|
LOAD_SYMBOL(LibPropSys, PropVariantToString);
|
|
|
|
LOAD_SYMBOL(LibPropSys, PSStringFromPropertyKey);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibDwmApi = LoadLibrary(L"dwmapi.dll");
|
2021-06-30 15:20:49 +00:00
|
|
|
LOAD_SYMBOL(LibDwmApi, DwmIsCompositionEnabled);
|
|
|
|
LOAD_SYMBOL(LibDwmApi, DwmSetWindowAttribute);
|
2018-11-12 07:50:40 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibPsApi = LoadLibrary(L"psapi.dll");
|
2021-05-10 14:27:23 +00:00
|
|
|
LOAD_SYMBOL(LibPsApi, GetProcessMemoryInfo);
|
2020-07-24 12:15:32 +00:00
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
const auto LibUser32 = LoadLibrary(L"user32.dll");
|
2021-05-10 14:27:23 +00:00
|
|
|
LOAD_SYMBOL(LibUser32, SetWindowCompositionAttribute);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
2021-06-30 21:15:56 +00:00
|
|
|
SafeIniter kSafeIniter;
|
|
|
|
|
|
|
|
} // namespace
|
2016-06-16 12:59:54 +00:00
|
|
|
} // namespace Dlls
|
|
|
|
} // namespace Platform
|