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
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-02-15 11:24:58 +00:00
|
|
|
#include "platform/win/wrapper_windows_h.h"
|
2019-02-07 16:36:30 +00:00
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
#include <shlobj.h>
|
|
|
|
#include <roapi.h>
|
2018-07-25 12:04:01 +00:00
|
|
|
#include <dwmapi.h>
|
2018-07-26 20:36:28 +00:00
|
|
|
#include <RestartManager.h>
|
2018-11-12 07:50:40 +00:00
|
|
|
#include <psapi.h>
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
namespace Platform {
|
|
|
|
namespace Dlls {
|
|
|
|
|
2016-08-14 18:55:59 +00:00
|
|
|
void init();
|
|
|
|
|
|
|
|
// KERNEL32.DLL
|
2018-07-25 12:04:01 +00:00
|
|
|
using f_SetDllDirectory = BOOL(FAR STDAPICALLTYPE*)(LPCWSTR lpPathName);
|
2016-08-14 18:55:59 +00:00
|
|
|
extern f_SetDllDirectory SetDllDirectory;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
void start();
|
|
|
|
|
|
|
|
template <typename Function>
|
|
|
|
bool load(HINSTANCE library, LPCSTR name, Function &func) {
|
|
|
|
if (!library) return false;
|
|
|
|
|
|
|
|
func = reinterpret_cast<Function>(GetProcAddress(library, name));
|
|
|
|
return (func != nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// UXTHEME.DLL
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SetWindowTheme = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
HWND hWnd,
|
|
|
|
LPCWSTR pszSubAppName,
|
|
|
|
LPCWSTR pszSubIdList);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SetWindowTheme SetWindowTheme;
|
|
|
|
|
|
|
|
// SHELL32.DLL
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SHAssocEnumHandlers = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
PCWSTR pszExtra,
|
|
|
|
ASSOC_FILTER afFilter,
|
|
|
|
IEnumAssocHandlers **ppEnumHandler);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SHAssocEnumHandlers SHAssocEnumHandlers;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SHCreateItemFromParsingName = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
PCWSTR pszPath,
|
|
|
|
IBindCtx *pbc,
|
|
|
|
REFIID riid,
|
|
|
|
void **ppv);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SHCreateItemFromParsingName SHCreateItemFromParsingName;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SHOpenWithDialog = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
HWND hwndParent,
|
|
|
|
const OPENASINFO *poainfo);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SHOpenWithDialog SHOpenWithDialog;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_OpenAs_RunDLL = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
HWND hWnd,
|
|
|
|
HINSTANCE hInstance,
|
|
|
|
LPCWSTR lpszCmdLine,
|
|
|
|
int nCmdShow);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_OpenAs_RunDLL OpenAs_RunDLL;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SHQueryUserNotificationState = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
QUERY_USER_NOTIFICATION_STATE *pquns);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SHQueryUserNotificationState SHQueryUserNotificationState;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SHChangeNotify = void(FAR STDAPICALLTYPE*)(
|
|
|
|
LONG wEventId,
|
|
|
|
UINT uFlags,
|
|
|
|
__in_opt LPCVOID dwItem1,
|
|
|
|
__in_opt LPCVOID dwItem2);
|
2016-12-19 16:51:29 +00:00
|
|
|
extern f_SHChangeNotify SHChangeNotify;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_SetCurrentProcessExplicitAppUserModelID
|
|
|
|
= HRESULT(FAR STDAPICALLTYPE*)(__in PCWSTR AppID);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_SetCurrentProcessExplicitAppUserModelID SetCurrentProcessExplicitAppUserModelID;
|
|
|
|
|
|
|
|
// WTSAPI32.DLL
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_WTSRegisterSessionNotification = BOOL(FAR STDAPICALLTYPE*)(
|
|
|
|
HWND hWnd,
|
|
|
|
DWORD dwFlags);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_WTSRegisterSessionNotification WTSRegisterSessionNotification;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_WTSUnRegisterSessionNotification = BOOL(FAR STDAPICALLTYPE*)(
|
|
|
|
HWND hWnd);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_WTSUnRegisterSessionNotification WTSUnRegisterSessionNotification;
|
|
|
|
|
|
|
|
// PROPSYS.DLL
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_PropVariantToString = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ REFPROPVARIANT propvar,
|
|
|
|
_Out_writes_(cch) PWSTR psz,
|
|
|
|
_In_ UINT cch);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_PropVariantToString PropVariantToString;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_PSStringFromPropertyKey = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ REFPROPERTYKEY pkey,
|
|
|
|
_Out_writes_(cch) LPWSTR psz,
|
|
|
|
_In_ UINT cch);
|
2017-02-01 10:12:52 +00:00
|
|
|
extern f_PSStringFromPropertyKey PSStringFromPropertyKey;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
// COMBASE.DLL
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_RoGetActivationFactory = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ HSTRING activatableClassId,
|
|
|
|
_In_ REFIID iid,
|
|
|
|
_COM_Outptr_ void ** factory);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_RoGetActivationFactory RoGetActivationFactory;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_WindowsCreateStringReference = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_reads_opt_(length + 1) PCWSTR sourceString,
|
|
|
|
UINT32 length,
|
|
|
|
_Out_ HSTRING_HEADER * hstringHeader,
|
|
|
|
_Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_WindowsCreateStringReference WindowsCreateStringReference;
|
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_WindowsDeleteString = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_opt_ HSTRING string);
|
2016-06-16 12:59:54 +00:00
|
|
|
extern f_WindowsDeleteString WindowsDeleteString;
|
|
|
|
|
2018-07-25 12:04:01 +00:00
|
|
|
// DWMAPI.DLL
|
2017-02-01 10:12:52 +00:00
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
using f_DwmIsCompositionEnabled = HRESULT(FAR STDAPICALLTYPE*)(
|
|
|
|
_Out_ BOOL* pfEnabled);
|
2018-07-25 12:04:01 +00:00
|
|
|
extern f_DwmIsCompositionEnabled DwmIsCompositionEnabled;
|
2017-02-01 10:12:52 +00:00
|
|
|
|
2018-07-26 20:36:28 +00:00
|
|
|
// RSTRTMGR.DLL
|
|
|
|
|
|
|
|
using f_RmStartSession = DWORD(FAR STDAPICALLTYPE*)(
|
|
|
|
_Out_ DWORD *pSessionHandle,
|
|
|
|
_Reserved_ DWORD dwSessionFlags,
|
|
|
|
_Out_writes_(CCH_RM_SESSION_KEY + 1) WCHAR strSessionKey[]);
|
|
|
|
extern f_RmStartSession RmStartSession;
|
|
|
|
|
|
|
|
using f_RmRegisterResources = DWORD(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ DWORD dwSessionHandle,
|
|
|
|
_In_ UINT nFiles,
|
|
|
|
_In_reads_opt_(nFiles) LPCWSTR rgsFileNames[],
|
|
|
|
_In_ UINT nApplications,
|
|
|
|
_In_reads_opt_(nApplications) RM_UNIQUE_PROCESS rgApplications[],
|
|
|
|
_In_ UINT nServices,
|
|
|
|
_In_reads_opt_(nServices) LPCWSTR rgsServiceNames[]);
|
|
|
|
extern f_RmRegisterResources RmRegisterResources;
|
|
|
|
|
|
|
|
using f_RmGetList = DWORD(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ DWORD dwSessionHandle,
|
|
|
|
_Out_ UINT *pnProcInfoNeeded,
|
|
|
|
_Inout_ UINT *pnProcInfo,
|
|
|
|
_Inout_updates_opt_(*pnProcInfo) RM_PROCESS_INFO rgAffectedApps[],
|
|
|
|
_Out_ LPDWORD lpdwRebootReasons);
|
|
|
|
extern f_RmGetList RmGetList;
|
|
|
|
|
|
|
|
using f_RmShutdown = DWORD(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ DWORD dwSessionHandle,
|
|
|
|
_In_ ULONG lActionFlags,
|
|
|
|
_In_opt_ RM_WRITE_STATUS_CALLBACK fnStatus);
|
|
|
|
extern f_RmShutdown RmShutdown;
|
|
|
|
|
|
|
|
using f_RmEndSession = DWORD(FAR STDAPICALLTYPE*)(
|
|
|
|
_In_ DWORD dwSessionHandle);
|
|
|
|
extern f_RmEndSession RmEndSession;
|
|
|
|
|
2018-11-12 07:50:40 +00:00
|
|
|
// PSAPI.DLL
|
|
|
|
|
|
|
|
using f_GetProcessMemoryInfo = BOOL(FAR STDAPICALLTYPE*)(
|
|
|
|
HANDLE Process,
|
|
|
|
PPROCESS_MEMORY_COUNTERS ppsmemCounters,
|
|
|
|
DWORD cb);
|
|
|
|
extern f_GetProcessMemoryInfo GetProcessMemoryInfo;
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
} // namespace Dlls
|
|
|
|
} // namespace Platform
|