1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-27 17:00:59 +01:00

Implemented weather taskbar widget

This commit is contained in:
Valentin Radu 2022-01-27 04:35:27 +02:00
parent 677b19663d
commit 5d4466147d
39 changed files with 4335 additions and 89 deletions

View File

@ -79,6 +79,13 @@ jobs:
C:\msys64\usr\bin\unix2dos.exe SimpleWindowSwitcher/sws_def.h
exit /b 0
- name: Setup NuGet
uses: nuget/setup-nuget@v1
- name: Restore NuGet packages
run: |
nuget restore ExplorerPatcher.sln
- name: Build funchook
shell: powershell
run: |

View File

@ -2,6 +2,14 @@
This document includes the same release notes as in the [Releases](https://github.com/valinet/ExplorerPatcher/releases) section on GitHub.
## 22000.469.42
Tested on OS build 22000.434.
#### New features
* Implemented Weather widget for the classic taskbar, similar to what is available in the more recent updates to Windows 10. Read more about it [here](https://github.com/valinet/ExplorerPatcher/wiki/Weather).
## 22000.469.41
Tested on OS build 22000.434.

View File

@ -4,6 +4,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExplorerPatcher", "ExplorerPatcher\ExplorerPatcher.vcxproj", "{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}"
ProjectSection(ProjectDependencies) = postProject
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE} = {AF02ABAC-EAEB-471C-9957-73D430B8B4DE}
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E} = {314A50C1-F0A0-4D0C-89E1-AD8F3951043E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_generate_release_description", "ep_generate_release_description\ep_generate_release_description.vcxproj", "{C362CFBE-7C6B-4457-8D01-839818D42ECB}"
EndProject
@ -13,6 +17,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup", "ep_setup\ep_set
ProjectSection(ProjectDependencies) = postProject
{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9} = {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87} = {1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E} = {314A50C1-F0A0-4D0C-89E1-AD8F3951043E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup_patch", "ep_setup_patch\ep_setup_patch.vcxproj", "{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}"
@ -22,6 +27,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_setup_patch", "ep_setup_
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_dwm", "ep_dwm\ep_dwm\ep_dwm.vcxproj", "{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_weather_host", "ep_weather_host\ep_weather_host.vcxproj", "{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}"
ProjectSection(ProjectDependencies) = postProject
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE} = {AF02ABAC-EAEB-471C-9957-73D430B8B4DE}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_weather_host_stub", "ep_weather_host_stub\ep_weather_host_stub.vcxproj", "{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|amd64 = Debug|amd64
@ -64,10 +76,22 @@ Global
{0C13E5F3-106B-4836-A7C2-8E5808A6ED78}.Release|IA-32.ActiveCfg = Release|Win32
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.ActiveCfg = Debug|x64
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|amd64.Build.0 = Debug|x64
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|IA-32.ActiveCfg = Debug|x64
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Debug|IA-32.ActiveCfg = Debug|Win32
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.ActiveCfg = Release|x64
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|amd64.Build.0 = Release|x64
{1ECCAB38-61B6-4C85-BBB5-2E2232DA3A87}.Release|IA-32.ActiveCfg = Release|Win32
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|amd64.ActiveCfg = Debug|x64
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|amd64.Build.0 = Debug|x64
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Debug|IA-32.ActiveCfg = Debug|Win32
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|amd64.ActiveCfg = Release|x64
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|amd64.Build.0 = Release|x64
{314A50C1-F0A0-4D0C-89E1-AD8F3951043E}.Release|IA-32.ActiveCfg = Release|Win32
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|amd64.ActiveCfg = Debug|x64
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|amd64.Build.0 = Debug|x64
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Debug|IA-32.ActiveCfg = Debug|Win32
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|amd64.ActiveCfg = Release|x64
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|amd64.Build.0 = Release|x64
{AF02ABAC-EAEB-471C-9957-73D430B8B4DE}.Release|IA-32.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -623,10 +623,18 @@ LSTATUS GUI_RegQueryValueExW(
LPDWORD lpcbData
)
{
DWORD dwSize = lpcbData ? *(DWORD*)lpcbData : sizeof(DWORD);
LSTATUS lRes = GUI_Internal_RegQueryValueExW(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
if (AuditFile)
{
fwprintf(AuditFile, L"%s\"%s\"=dword:%08x\n", (lpValueName && wcsncmp(lpValueName, L"Virtualized_" _T(EP_CLSID), 50)) ? L"" : L";", lpValueName, *(DWORD*)lpData);
if (dwSize != sizeof(DWORD))
{
fwprintf(AuditFile, L"%s\"%s\"=\"%s\"\n", (lpValueName && wcsncmp(lpValueName, L"Virtualized_" _T(EP_CLSID), 50)) ? L"" : L";", lpValueName, lpData);
}
else
{
fwprintf(AuditFile, L"%s\"%s\"=dword:%08x\n", (lpValueName && wcsncmp(lpValueName, L"Virtualized_" _T(EP_CLSID), 50)) ? L"" : L";", lpValueName, *(DWORD*)lpData);
}
}
return lRes;
}
@ -1831,6 +1839,13 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
wprintf(L"%s %d\n", wszName, dwVal);
GUI_RegSetValueExW(NULL, wszName, 0, RRF_RT_DWORD, &dwVal, sizeof(DWORD));
}
else
{
WCHAR* wszTitle = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
wchar_t* x = wcschr(ddd + 2, L'"');
x[0] = 0;
//wprintf(L">>> %s\n", ddd + 2);
}
}
}
free(line2);
@ -1840,6 +1855,10 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
}
}
else if (!strncmp(line + 1, "update_weather", 14))
{
PostMessageW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), EP_WEATHER_WM_FETCH_DATA, 0, 0);
}
}
}
dwMaxHeight += dwLineHeight * dy;
@ -1848,7 +1867,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
tabOrder++;
}
}
else if (!strncmp(line, ";l ", 3) || !strncmp(line, ";y ", 3) || !strncmp(line, ";c ", 3) || !strncmp(line, ";z ", 3) || !strncmp(line, ";b ", 3) || !strncmp(line, ";i ", 3) || !strncmp(line, ";d ", 3) || !strncmp(line, ";v ", 3))
else if (!strncmp(line, ";l ", 3) || !strncmp(line, ";y ", 3) || !strncmp(line, ";c ", 3) || !strncmp(line, ";w ", 3) || !strncmp(line, ";z ", 3) || !strncmp(line, ";b ", 3) || !strncmp(line, ";i ", 3) || !strncmp(line, ";d ", 3) || !strncmp(line, ";v ", 3))
{
ZeroMemory(text, (MAX_LINE_LENGTH + 3) * sizeof(wchar_t));
text[0] = L'\u2795';
@ -1867,9 +1886,14 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
if (x) *x = 0;
x = wcschr(text, L'\r');
if (x) *x = 0;
if (!strncmp(line, ";c ", 3) || !strncmp(line, ";z ", 3) || !strncmp(line, ";b ", 3) || !strncmp(line, ";i ", 3) || !strncmp(line, ";d ", 3) || !strncmp(line, ";v ", 3))
if (!strncmp(line, ";w ", 3) || !strncmp(line, ";c ", 3) || !strncmp(line, ";z ", 3) || !strncmp(line, ";b ", 3) || !strncmp(line, ";i ", 3) || !strncmp(line, ";d ", 3) || !strncmp(line, ";v ", 3))
{
WCHAR* wszTitle = NULL;
WCHAR* wszPrompt = NULL;
WCHAR* wszDefault = NULL;
WCHAR* wszFallbackDefault = NULL;
HMENU hMenu = NULL;
BOOL bInput = !strncmp(line, ";w ", 3);
BOOL bChoice = !strncmp(line, ";c ", 3);
BOOL bChoiceLefted = !strncmp(line, ";z ", 3);
BOOL bInvert = !strncmp(line, ";i ", 3);
@ -1930,6 +1954,43 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
free(miText);
}
}
else if (bInput)
{
wszTitle = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
wszPrompt = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
wszDefault = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
wszFallbackDefault = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
char* l = malloc(MAX_LINE_LENGTH * sizeof(char));
numChRd = getline(&l, &bufsiz, f);
char* p = l;
p = strchr(p + 1, '\r');
if (p) *p = 0;
p = strchr(p + 1, '\n');
if (p) *p = 0;
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
l + 1,
numChRd - 1,
wszPrompt,
MAX_LINE_LENGTH
);
numChRd = getline(&l, &bufsiz, f);
p = l;
p = strchr(p + 1, '\r');
if (p) *p = 0;
p = strchr(p + 1, '\n');
if (p) *p = 0;
MultiByteToWideChar(
CP_UTF8,
MB_PRECOMPOSED,
l + 1,
numChRd - 1,
wszFallbackDefault,
MAX_LINE_LENGTH
);
free(l);
}
numChRd = getline(&line, &bufsiz, f);
if (!strncmp(line, ";\"Virtualized_" EP_CLSID, 52))
{
@ -2011,14 +2072,47 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
DWORD value = FALSE;
//wprintf(L"%s %s %s\n", section, name, d + 1);
if (!wcsncmp(d + 1, L"dword:", 6))
if (!bInput && !wcsncmp(d + 1, L"dword:", 6))
{
wchar_t* x = wcschr(d + 1, L':');
x++;
value = wcstol(x, NULL, 16);
}
if (bInput)
{
wchar_t* x = wcschr(d + 2, L'"');
x[0] = 0;
wcscpy_s(wszDefault, MAX_LINE_LENGTH, d + 2);
}
if (!bJustCheck)
if (bInput)
{
dwSize = MAX_LINE_LENGTH;
GUI_RegCreateKeyExW(
bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
wcschr(section, L'\\') + 1,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_READ | (hDC ? 0 : (!bIsHKLM ? KEY_WRITE : 0)),
NULL,
& hKey,
& dwDisposition
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
GUI_RegQueryValueExW(
hKey,
name,
0,
NULL,
wszDefault,
&dwSize
);
}
else if (!bJustCheck)
{
GUI_RegCreateKeyExW(
bIsHKLM ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
@ -2067,7 +2161,28 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
value = hKey;
}
if (bInvert || bBool || bJustCheck)
if (bInput)
{
wcscpy_s(wszTitle, MAX_LINE_LENGTH, text + 3);
wcscat_s(
text,
MAX_LINE_LENGTH,
L" : "
);
if (wszDefault[0] == 0)
{
wcscat_s(text, MAX_LINE_LENGTH, wszFallbackDefault);
}
else
{
wcscat_s(
text,
MAX_LINE_LENGTH,
wszDefault
);
}
}
else if (bInvert || bBool || bJustCheck)
{
if (value)
{
@ -2254,7 +2369,23 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
else
{
DWORD val = 0;
if (bChoice || bChoiceLefted)
if (bInput)
{
WCHAR* wszAnswer = malloc(MAX_LINE_LENGTH * sizeof(WCHAR));
InputBox(FALSE, hwnd, wszPrompt, wszTitle, wszDefault, wszAnswer, MAX_LINE_LENGTH);
GUI_RegSetValueExW(
hKey,
name,
0,
REG_SZ,
wszAnswer,
(wcslen(wszAnswer) + 1) * sizeof(WCHAR)
);
Sleep(100);
PostMessageW(FindWindowW(_T(EPW_WEATHER_CLASSNAME), NULL), EP_WEATHER_WM_FETCH_DATA, 0, 0);
free(wszAnswer);
}
else if (bChoice || bChoiceLefted)
{
RECT rcTemp;
rcTemp = rcText;
@ -2298,7 +2429,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
{
value = _this->section + 1;
}
if (!(bChoice || bChoiceLefted) || ((bChoice || bChoiceLefted) && val))
if (!bInput && (!(bChoice || bChoiceLefted) || ((bChoice || bChoiceLefted) && val)))
{
GUI_RegSetValueExW(
hKey,
@ -2332,6 +2463,22 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
}
DestroyMenu(hMenu);
}
if (wszTitle)
{
free(wszTitle);
}
if (wszPrompt)
{
free(wszPrompt);
}
if (wszDefault)
{
free(wszDefault);
}
if (wszFallbackDefault)
{
free(wszFallbackDefault);
}
}
if (hDC && (!strncmp(line, ";l ", 3) || !strncmp(line, ";y ", 3)))
{
@ -2477,6 +2624,7 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
if (text[0] == L'\u2714') dwType = 1;
else if (text[0] == L'\u274C') dwType = 2;
else if (text[accLen - 1] == 56405) dwType = 3;
else if (!strstr(line, "dword")) dwType = 5;
WCHAR accText[1000], accText2[1000];
ZeroMemory(accText, 1000 * sizeof(wchar_t));
ZeroMemory(accText2, 1000 * sizeof(wchar_t));
@ -2494,7 +2642,8 @@ static BOOL GUI_Build(HDC hDC, HWND hwnd, POINT pt)
(dwType == 2 ? L"Disabled" :
(dwType == 3 ? L"Link" :
(dwType == 4 ? L"Button" :
L"List")))
(dwType == 5 ? L"Input" :
L"List"))))
);
accLen = wcslen(accText);
unsigned int j = 0;
@ -2935,10 +3084,10 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
return 0;
}
// this should be determined from the file, but for now it works
else if (wParam >= '1' && wParam <= '9')
else if (wParam >= '1' && wParam <= '9' || wParam == '0')
{
_this->tabOrder = 0;
GUI_SetSection(_this, TRUE, wParam - '1');
GUI_SetSection(_this, TRUE, wParam == '0' ? 9 : wParam - '1');
_this->bShouldAnnounceSelected = TRUE;
InvalidateRect(hWnd, NULL, FALSE);
return 0;
@ -2983,6 +3132,14 @@ static LRESULT CALLBACK GUI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
SetTimer(hWnd, GUI_TIMER_READ_HELP, 200, NULL);
return 0;
}
else if (wParam == 'Z')
{
return 0;
}
else if (wParam == 'X')
{
return 0;
}
}
else if (uMsg == WM_NCMOUSELEAVE && IsThemeActive())
{
@ -3187,7 +3344,7 @@ __declspec(dllexport) int ZZGUI(HWND hWnd, HINSTANCE hInstance, LPSTR lpszCmdLin
return 0;
}
HRESULT hr = CoInitialize(0);
HRESULT hr = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
HKEY hKey = NULL;
DWORD dwSize = sizeof(DWORD);

View File

@ -24,6 +24,7 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#include "getline.h"
#include "fmemopen.h"
#include "utility.h"
#include "../ep_weather_host/ep_weather.h"
#define MAX_LINE_LENGTH 2000
extern HMODULE hModule;

View File

@ -77,6 +77,7 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
MSG* msg = (MSG*)lParam;
if (GetSystemMetrics(SM_CMONITORS) >= 2 && msg->message == WM_SYSCOMMAND && (msg->wParam & 0xFFF0) == SC_TASKLIST)
{
printf("Position Start\n");
if (bMonitorOverride)
{
goto finish;
@ -102,6 +103,7 @@ LRESULT CALLBACK OpenStartOnCurentMonitorThreadHook(
POINT pt;
pt.x = GET_X_LPARAM(pts);
pt.y = GET_Y_LPARAM(pts);
printf("!! %d %d\n", pt.x, pt.y);
HMONITOR monitor = MonitorFromPoint(
pt,
MONITOR_DEFAULTTONULL
@ -131,12 +133,7 @@ DWORD OpenStartOnCurentMonitorThread(OpenStartOnCurentMonitorThreadParams* unuse
HWND g_ProgWin = NULL;
while (!g_ProgWin)
{
g_ProgWin = FindWindowEx(
NULL,
NULL,
L"Progman",
NULL
);
g_ProgWin = GetShellWindow();
if (!g_ProgWin)
{
Sleep(100);

View File

@ -31,6 +31,11 @@
#endif
#include <valinet/hooking/iatpatch.h>
#include <valinet/utility/memmem.h>
#include "../ep_weather_host/ep_weather.h"
#ifdef _WIN64
#include "../ep_weather_host/ep_weather_host_h.h"
IEPWeather* epw = NULL;
#endif
#define WINX_ADJUST_X 5
#define WINX_ADJUST_Y 5
@ -99,6 +104,13 @@ BYTE* lpShouldDisplayCCButton = NULL;
HMONITOR hMonitorList[MAX_NUM_MONITORS];
DWORD dwMonitorCount = 0;
HANDLE hCanStartSws = NULL;
DWORD dwWeatherViewMode = EP_WEATHER_VIEW_ICONTEXT;
DWORD dwWeatherTemperatureUnit = EP_WEATHER_TUNIT_CELSIUS;
DWORD dwWeatherUpdateSchedule = EP_WEATHER_UPDATE_NORMAL;
WCHAR* wszWeatherTerm = NULL;
WCHAR* wszWeatherLanguage = NULL;
WCHAR* wszEPWeatherKillswitch = NULL;
HANDLE hEPWeatherKillswitch = NULL;
int Code = 0;
HRESULT InjectStartFromExplorer();
void InvokeClockFlyout();
@ -3552,10 +3564,639 @@ HRESULT WINAPI Widgets_GetTooltipTextHook(__int64 a1, __int64 a2, __int64 a3, WC
}
}
/*int WINAPI explorer_LoadStringWHook(HINSTANCE hInstance, UINT uID, WCHAR* lpBuffer, UINT cchBufferMax)
{
WCHAR wszBuffer[MAX_PATH];
if (hInstance == GetModuleHandle(NULL) && uID == 912)// && SUCCEEDED(epw->lpVtbl->GetTitle(epw, MAX_PATH, wszBuffer)))
{
//sws_error_PrintStackTrace();
int rez = LoadStringW(hInstance, uID, lpBuffer, cchBufferMax);
//wprintf(L"%s\n", lpBuffer);
return rez;
}
else
{
return LoadStringW(hInstance, uID, lpBuffer, cchBufferMax);
}
}*/
void stub1(void* i)
{
}
HWND PeopleButton_LastHWND = NULL;
BOOL explorer_DeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags)
{
if (uPosition == 621 && uFlags == 0) // when removing News and interests
{
DeleteMenu(hMenu, 449, 0); // remove Cortana menu
DeleteMenu(hMenu, 435, 0); // remove People menu
}
return DeleteMenu(hMenu, uPosition, uFlags);
}
SIZE (*PeopleButton_CalculateMinimumSizeFunc)(void*, SIZE*);
SIZE WINAPI PeopleButton_CalculateMinimumSizeHook(void* _this, SIZE* pSz)
{
SIZE ret = PeopleButton_CalculateMinimumSizeFunc(_this, pSz);
int mul = 1;
if (epw)
{
switch (dwWeatherViewMode)
{
case EP_WEATHER_VIEW_ICONTEXT:
mul = 4;
break;
case EP_WEATHER_VIEW_ICONTEMP:
mul = 2;
break;
case EP_WEATHER_VIEW_ICONONLY:
mul = 1;
break;
}
}
//printf(">> %d %d\n", pSz->cx, pSz->cy);
pSz->cx = pSz->cx * mul;
if (pSz->cy && epw)
{
BOOL bIsInitialized = TRUE;
HRESULT hr = epw->lpVtbl->IsInitialized(epw, &bIsInitialized);
if (SUCCEEDED(hr))
{
int rt = MulDiv(48, pSz->cy, 60);
if (!bIsInitialized)
{
epw->lpVtbl->SetTerm(epw, MAX_PATH * sizeof(WCHAR), wszWeatherTerm);
epw->lpVtbl->SetLanguage(epw, MAX_PATH * sizeof(WCHAR), wszWeatherLanguage);
if (FAILED(epw->lpVtbl->Initialize(epw, wszEPWeatherKillswitch, bAllocConsole, EP_WEATHER_PROVIDER_GOOGLE, rt, rt, dwWeatherTemperatureUnit, dwWeatherUpdateSchedule * 1000, pSz->cy / 48.0)))
{
epw->lpVtbl->Release(epw);
}
}
else
{
epw->lpVtbl->SetIconSize(epw, rt, rt);
}
}
else
{
if (hr == 0x800706ba) // RPC server is unavailable
{
epw = NULL;
InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);
}
}
}
return ret;
}
int PeopleBand_MulDivHook(int nNumber, int nNumerator, int nDenominator)
{
//printf("<< %d %d %d\n", nNumber, nNumerator, nDenominator);
int mul = 1;
if (epw)
{
switch (dwWeatherViewMode)
{
case EP_WEATHER_VIEW_ICONTEXT:
mul = 4;
break;
case EP_WEATHER_VIEW_ICONTEMP:
mul = 2;
break;
case EP_WEATHER_VIEW_ICONONLY:
mul = 1;
break;
}
}
return MulDiv(nNumber * mul, nNumerator, nDenominator);
}
DWORD epw_cbTemperature = 0;
DWORD epw_cbUnit = 0;
DWORD epw_cbCondition = 0;
DWORD epw_cbImage = 0;
WCHAR* epw_wszTemperature = NULL;
WCHAR* epw_wszUnit = NULL;
WCHAR* epw_wszCondition = NULL;
char* epw_pImage = NULL;
__int64 (*PeopleBand_DrawTextWithGlowFunc)(
HDC hdc,
const unsigned __int16* a2,
int a3,
struct tagRECT* a4,
unsigned int a5,
unsigned int a6,
unsigned int a7,
unsigned int dy,
unsigned int a9,
int a10,
int(__stdcall* a11)(HDC, unsigned __int16*, int, struct tagRECT*, unsigned int, __int64),
__int64 a12);
__int64 __fastcall PeopleBand_DrawTextWithGlowHook(
HDC hdc,
const unsigned __int16* a2,
int a3,
struct tagRECT* a4,
unsigned int a5,
unsigned int a6,
unsigned int a7,
unsigned int dy,
unsigned int a9,
int a10,
int(__stdcall* a11)(HDC, unsigned __int16*, int, struct tagRECT*, unsigned int, __int64),
__int64 a12)
{
if (a5 == 0x21 && epw)
{
BOOL bUseCachedData = InSendMessage();
HRESULT hr = S_OK;
if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->LockData(epw)))
{
UINT dpiX = 0, dpiY = 0;
HRESULT hr = GetDpiForMonitor(MonitorFromWindow(PeopleButton_LastHWND, MONITOR_DEFAULTTOPRIMARY), MDT_DEFAULT, &dpiX, &dpiY);
BOOL bShouldUnlockData = TRUE;
DWORD cbTemperature = 0;
DWORD cbUnit = 0;
DWORD cbCondition = 0;
DWORD cbImage = 0;
BOOL bEmptyData = FALSE;
if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->GetDataSizes(epw, &cbTemperature, &cbUnit, &cbCondition, &cbImage)))
{
if (cbTemperature && cbUnit && cbCondition && cbImage)
{
epw_cbTemperature = cbTemperature;
epw_cbUnit = cbUnit;
epw_cbCondition = cbCondition;
epw_cbImage = cbImage;
}
else
{
if (!bUseCachedData)
{
bEmptyData = TRUE;
if (bShouldUnlockData)
{
epw->lpVtbl->UnlockData(epw);
bShouldUnlockData = FALSE;
}
}
else
{
bEmptyData = !epw_wszTemperature || !epw_wszUnit || !epw_wszCondition;
}
bUseCachedData = TRUE;
}
if (!bUseCachedData)
{
if (epw_wszTemperature)
{
free(epw_wszTemperature);
}
epw_wszTemperature = calloc(1, epw_cbTemperature);
if (epw_wszUnit)
{
free(epw_wszUnit);
}
epw_wszUnit = calloc(1, epw_cbUnit);
if (epw_wszCondition)
{
free(epw_wszCondition);
}
epw_wszCondition = calloc(1, epw_cbCondition);
if (epw_pImage)
{
free(epw_pImage);
}
epw_pImage = calloc(1, epw_cbImage);
}
if (bUseCachedData ? TRUE : SUCCEEDED(hr = epw->lpVtbl->GetData(epw, epw_cbTemperature, epw_wszTemperature, epw_cbUnit, epw_wszUnit, epw_cbCondition, epw_wszCondition, epw_cbImage, epw_pImage)))
{
if (!bUseCachedData)
{
epw->lpVtbl->UnlockData(epw);
bShouldUnlockData = FALSE;
}
LOGFONTW logFont;
ZeroMemory(&logFont, sizeof(logFont));
NONCLIENTMETRICS ncm;
ZeroMemory(&ncm, sizeof(NONCLIENTMETRICS));
ncm.cbSize = sizeof(NONCLIENTMETRICS);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0);
logFont = ncm.lfCaptionFont;
logFont.lfHeight = -14 * (dpiX / 96.0);
if (bEmptyData)
{
DWORD dwVal = 1, dwSize = sizeof(DWORD);
RegGetValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"TaskbarSmallIcons", RRF_RT_DWORD, NULL, &dwVal, &dwSize);
if (!dwVal)
{
logFont.lfHeight *= 1.6;
}
}
else
{
if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT)
{
//logFont.lfHeight = -12 * (dpiX / 96.0);
}
}
HFONT hFont = CreateFontIndirectW(&logFont);
if (hFont)
{
HDC hDC = CreateCompatibleDC(0);
if (hDC)
{
COLORREF rgbColor = RGB(0, 0, 0);
if (ShouldSystemUseDarkMode && ShouldSystemUseDarkMode())
{
rgbColor = RGB(255, 255, 255);
}
HFONT hOldFont = SelectFont(hDC, hFont);
if (bEmptyData)
{
RECT rcText;
SetRect(&rcText, 0, 0, a4->right, a4->bottom);
SIZE size;
size.cx = rcText.right - rcText.left;
size.cy = rcText.bottom - rcText.top;
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER | DT_HIDEPREFIX | DT_CENTER;
HBITMAP hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(L"\U0001f4f0", hFont, dwTextFlags, size, rgbColor);
if (hBitmap)
{
HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);
BITMAP BMInf;
GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
GdiAlphaBlend(hdc, 0, 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);
SelectBitmap(hDC, hOldBMP);
DeleteBitmap(hBitmap);
}
}
else
{
DWORD dwTextFlags = DT_SINGLELINE | DT_VCENTER | DT_HIDEPREFIX;
WCHAR wszText1[MAX_PATH];
swprintf_s(wszText1, MAX_PATH, L"%s %s", epw_wszTemperature, dwWeatherTemperatureUnit == EP_WEATHER_TUNIT_FAHRENHEIT ? L"\u00B0F" : L"\u00B0C");// epw_wszUnit);
RECT rcText1;
SetRect(&rcText1, 0, 0, a4->right, a4->bottom);
DrawTextW(hDC, wszText1, -1, &rcText1, dwTextFlags | DT_CALCRECT);
rcText1.bottom = a4->bottom;
WCHAR wszText2[MAX_PATH];
swprintf_s(wszText2, MAX_PATH, L"%s", epw_wszCondition);
RECT rcText2;
SetRect(&rcText2, 0, 0, a4->right, a4->bottom);
DrawTextW(hDC, wszText2, -1, &rcText2, dwTextFlags | DT_CALCRECT);
rcText2.bottom = a4->bottom;
dwTextFlags |= DT_END_ELLIPSIS;
int addend = 0;
//int rt = MulDiv(48, a4->bottom, 60);
int rt = sqrt(epw_cbImage / 4);
int p = 0;// MulDiv(rt, 4, 64);
int margin_h = MulDiv(12, dpiX, 144);
switch (dwWeatherViewMode)
{
case EP_WEATHER_VIEW_ICONTEXT:
addend = (rcText1.right - rcText1.left) + margin_h + (rcText2.right - rcText2.left) + margin_h;
break;
case EP_WEATHER_VIEW_ICONTEMP:
addend = (rcText1.right - rcText1.left) + margin_h;
break;
case EP_WEATHER_VIEW_ICONONLY:
addend = 0;
break;
}
int margin_v = (a4->bottom - rt) / 2;
int total_h = (margin_h - p) + rt + (margin_h - p) + addend;
if (total_h > a4->right)
{
int diff = total_h - a4->right;
rcText2.right -= diff - 2;
switch (dwWeatherViewMode)
{
case EP_WEATHER_VIEW_ICONTEXT:
addend = (rcText1.right - rcText1.left) + margin_h + (rcText2.right - rcText2.left) + margin_h;
break;
case EP_WEATHER_VIEW_ICONTEMP:
addend = (rcText1.right - rcText1.left) + margin_h;
break;
case EP_WEATHER_VIEW_ICONONLY:
addend = 0;
break;
}
total_h = (margin_h - p) + rt + (margin_h - p) + addend;
}
int start_x = (a4->right - total_h) / 2;
HBITMAP hBitmap = NULL, hOldBitmap = NULL;
void* pvBits = NULL;
SIZE size;
BITMAPINFOHEADER BMIH;
ZeroMemory(&BMIH, sizeof(BITMAPINFOHEADER));
BMIH.biSize = sizeof(BITMAPINFOHEADER);
BMIH.biWidth = rt;
BMIH.biHeight = -rt;
BMIH.biPlanes = 1;
BMIH.biBitCount = 32;
BMIH.biCompression = BI_RGB;
hBitmap = CreateDIBSection(hDC, &BMIH, 0, &pvBits, NULL, 0);
if (hBitmap)
{
memcpy(pvBits, epw_pImage, epw_cbImage);
hOldBitmap = SelectBitmap(hDC, hBitmap);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
GdiAlphaBlend(hdc, start_x + (margin_h - p), margin_v, rt, rt, hDC, 0, 0, rt, rt, bf);
SelectBitmap(hDC, hOldBitmap);
DeleteBitmap(hBitmap);
}
if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEMP || dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT)
{
size.cx = rcText1.right - rcText1.left;
size.cy = rcText1.bottom - rcText1.top;
hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(wszText1, hFont, dwTextFlags, size, rgbColor);
if (hBitmap)
{
HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);
BITMAP BMInf;
GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
GdiAlphaBlend(hdc, start_x + (margin_h - p) + rt + (margin_h - p), 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);
SelectBitmap(hDC, hOldBMP);
DeleteBitmap(hBitmap);
}
}
if (dwWeatherViewMode == EP_WEATHER_VIEW_ICONTEXT)
{
size.cx = rcText2.right - rcText2.left;
size.cy = rcText2.bottom - rcText2.top;
hBitmap = sws_WindowHelpers_CreateAlphaTextBitmap(wszText2, hFont, dwTextFlags, size, rgbColor);
if (hBitmap)
{
HBITMAP hOldBMP = SelectBitmap(hDC, hBitmap);
BITMAP BMInf;
GetObjectW(hBitmap, sizeof(BITMAP), &BMInf);
BLENDFUNCTION bf;
bf.BlendOp = AC_SRC_OVER;
bf.BlendFlags = 0;
bf.SourceConstantAlpha = 0xFF;
bf.AlphaFormat = AC_SRC_ALPHA;
GdiAlphaBlend(hdc, start_x + (margin_h - p) + rt + (margin_h - p) + (rcText1.right - rcText1.left) + margin_h, 0, BMInf.bmWidth, BMInf.bmHeight, hDC, 0, 0, BMInf.bmWidth, BMInf.bmHeight, bf);
SelectBitmap(hDC, hOldBMP);
DeleteBitmap(hBitmap);
}
}
}
SelectFont(hDC, hOldFont);
DeleteDC(hDC);
}
}
}
/*free(epw_pImage);
free(epw_wszCondition);
free(epw_wszUnit);
free(epw_wszTemperature);*/
}
if (!bUseCachedData && bShouldUnlockData)
{
epw->lpVtbl->UnlockData(epw);
}
}
else
{
//printf("444444444444 0x%x\n", hr);
if (hr == 0x800706ba) // RPC server is unavailable
{
epw = NULL;
InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);
}
}
//printf("hr %x\n", hr);
return S_OK;
}
else
{
return PeopleBand_DrawTextWithGlowFunc(hdc, a2, a3, a4, a5, a6, a7, dy, a9, a10, a11, a12);
}
}
void(*PeopleButton_ShowTooltipFunc)(__int64 a1, unsigned __int8 bShow) = 0;
void WINAPI PeopleButton_ShowTooltipHook(__int64 _this, unsigned __int8 bShow)
{
if (epw)
{
if (bShow)
{
HRESULT hr = epw->lpVtbl->LockData(epw);
if (SUCCEEDED(hr))
{
WCHAR wszBuffer[MAX_PATH];
ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);
epw->lpVtbl->GetTitle(epw, sizeof(WCHAR) * MAX_PATH, wszBuffer, dwWeatherViewMode);
if (wcsstr(wszBuffer, L"(null)"))
{
HMODULE hModule = GetModuleHandleW(L"pnidui.dll");
if (hModule)
{
LoadStringW(hModule, 35, wszBuffer, MAX_PATH);
}
}
TTTOOLINFOW ti;
ZeroMemory(&ti, sizeof(TTTOOLINFOW));
ti.cbSize = sizeof(TTTOOLINFOW);
ti.hwnd = *((INT64*)_this + 1);
ti.uId = *((INT64*)_this + 1);
ti.lpszText = wszBuffer;
SendMessageW((HWND) * ((INT64*)_this + 10), TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
epw->lpVtbl->UnlockData(epw);
}
}
}
else
{
WCHAR wszBuffer[MAX_PATH];
ZeroMemory(wszBuffer, sizeof(WCHAR) * MAX_PATH);
LoadStringW(GetModuleHandle(NULL), 912, wszBuffer, MAX_PATH);
if (wszBuffer[0])
{
TTTOOLINFOW ti;
ZeroMemory(&ti, sizeof(TTTOOLINFOW));
ti.cbSize = sizeof(TTTOOLINFOW);
ti.hwnd = *((INT64*)_this + 1);
ti.uId = *((INT64*)_this + 1);
ti.lpszText = wszBuffer;
SendMessageW((HWND) * ((INT64*)_this + 10), TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
}
}
if (PeopleButton_ShowTooltipFunc)
{
return PeopleButton_ShowTooltipFunc(_this, bShow);
}
return 0;
}
__int64 (*PeopleButton_OnClickFunc)(__int64 a1, __int64 a2) = 0;
__int64 PeopleButton_OnClickHook(__int64 a1, __int64 a2)
{
if (epw)
{
HWND hWnd = NULL;
if (SUCCEEDED(epw->lpVtbl->GetWindowHandle(epw, &hWnd)) && hWnd)
{
if (IsWindowVisible(hWnd))
{
if (GetForegroundWindow() != hWnd)
{
SwitchToThisWindow(hWnd, TRUE);
}
else
{
epw->lpVtbl->Hide(epw);
//printf("HR %x\n", PostMessageW(hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0));
}
}
else
{
RECT rcButton;
GetWindowRect(PeopleButton_LastHWND, &rcButton);
POINT pButton;
pButton.x = rcButton.left;
pButton.y = rcButton.top;
RECT rcWindow;
GetWindowRect(hWnd, &rcWindow);
POINT pNewWindow;
RECT rc;
UINT tbPos = GetTaskbarLocationAndSize(pButton, &rc);
if (tbPos == TB_POS_BOTTOM)
{
pNewWindow.y = rcButton.top - (rcWindow.bottom - rcWindow.top);
}
else if (tbPos == TB_POS_TOP)
{
pNewWindow.y = rcButton.bottom;
}
else if (tbPos == TB_POS_LEFT)
{
pNewWindow.x = rcButton.right;
}
if (tbPos == TB_POS_RIGHT)
{
pNewWindow.x = rcButton.left - (rcWindow.right - rcWindow.left);
}
if (tbPos == TB_POS_BOTTOM || tbPos == TB_POS_TOP)
{
pNewWindow.x = rcButton.left + ((rcButton.right - rcButton.left) / 2) - ((rcWindow.right - rcWindow.left) / 2);
HMONITOR hMonitor = MonitorFromPoint(pButton, MONITOR_DEFAULTTOPRIMARY);
if (hMonitor)
{
MONITORINFO mi;
mi.cbSize = sizeof(MONITORINFO);
if (GetMonitorInfoW(hMonitor, &mi))
{
if (mi.rcWork.right < pNewWindow.x + (rcWindow.right - rcWindow.left))
{
pNewWindow.x = mi.rcWork.right - (rcWindow.right - rcWindow.left);
}
}
}
}
else if (tbPos == TB_POS_LEFT || tbPos == TB_POS_RIGHT)
{
pNewWindow.y = rcButton.top + ((rcButton.bottom - rcButton.top) / 2) - ((rcWindow.bottom - rcWindow.top) / 2);
HMONITOR hMonitor = MonitorFromPoint(pButton, MONITOR_DEFAULTTOPRIMARY);
if (hMonitor)
{
MONITORINFO mi;
mi.cbSize = sizeof(MONITORINFO);
if (GetMonitorInfoW(hMonitor, &mi))
{
if (mi.rcWork.bottom < pNewWindow.y + (rcWindow.bottom - rcWindow.top))
{
pNewWindow.y = mi.rcWork.bottom - (rcWindow.bottom - rcWindow.top);
}
}
}
}
SetWindowPos(hWnd, NULL, pNewWindow.x, pNewWindow.y, 0, 0, SWP_NOSIZE, SWP_SHOWWINDOW | SWP_FRAMECHANGED);
epw->lpVtbl->Show(epw);
SwitchToThisWindow(hWnd, TRUE);
}
}
return 0;
}
else
{
if (PeopleButton_OnClickFunc)
{
return PeopleButton_OnClickFunc(a1, a2);
}
return 0;
}
}
INT64 PeopleButton_SubclassProc(
_In_ HWND hWnd,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam,
UINT_PTR uIdSubclass,
DWORD_PTR dwRefData
)
{
if (uMsg == WM_NCDESTROY)
{
RemoveWindowSubclass(hWnd, PeopleButton_SubclassProc, PeopleButton_SubclassProc);
if (epw)
{
epw->lpVtbl->Release(epw);
epw = NULL;
PeopleButton_LastHWND = NULL;
}
}
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
static BOOL(*SetChildWindowNoActivateFunc)(HWND);
BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)
{
@ -3597,13 +4238,38 @@ BOOL explorer_SetChildWindowNoActivateHook(HWND hWnd)
*(uintptr_t*)(Instance + 160) = ToggleTaskView; // OnClick
VirtualProtect(Instance + 160, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
}
/*else if (!wcscmp(wszComponentName, L"PeopleButton"))
else if (!wcscmp(wszComponentName, L"PeopleButton"))
{
DWORD dwOldProtect;
uintptr_t PeopleButton_Instance = *((uintptr_t*)GetWindowLongPtrW(hWnd, 0) + 17);
VirtualProtect(PeopleButton_Instance + 32, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
if (!PeopleButton_CalculateMinimumSizeFunc) PeopleButton_CalculateMinimumSizeFunc = *(uintptr_t*)(PeopleButton_Instance + 32);
*(uintptr_t*)(PeopleButton_Instance + 32) = PeopleButton_CalculateMinimumSizeHook; // CalculateMinimumSize
VirtualProtect(PeopleButton_Instance + 32, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
VirtualProtect(Instance + 224, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
if (!PeopleButton_ShowTooltipFunc) PeopleButton_ShowTooltipFunc = *(uintptr_t*)(Instance + 224);
*(uintptr_t*)(Instance + 224) = PeopleButton_ShowTooltipHook; // OnTooltipShow
VirtualProtect(Instance + 224, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
VirtualProtect(Instance + 160, sizeof(uintptr_t), PAGE_READWRITE, &dwOldProtect);
*(uintptr_t*)(Instance + 160) = ToggleMainClockFlyout; // OnClick
if (!PeopleButton_OnClickFunc) PeopleButton_OnClickFunc = *(uintptr_t*)(Instance + 160);
*(uintptr_t*)(Instance + 160) = PeopleButton_OnClickHook; // OnClick
VirtualProtect(Instance + 160, sizeof(uintptr_t), dwOldProtect, &dwOldProtect);
}*/
PeopleButton_LastHWND = hWnd;
SetWindowSubclass(hWnd, PeopleButton_SubclassProc, PeopleButton_SubclassProc, 0);
if (!epw)
{
if (SUCCEEDED(CoCreateInstance(&CLSID_EPWeather, NULL, CLSCTX_LOCAL_SERVER, &IID_IEPWeather, &epw)) && epw)
{
epw->lpVtbl->SetNotifyWindow(epw, hWnd);
}
}
}
}
}
return SetChildWindowNoActivateFunc(hWnd);
@ -4568,6 +5234,108 @@ void WINAPI LoadSettings(LPARAM lParam)
&bDisableOfficeHotkeys,
&dwSize
);
#ifdef _WIN64
DWORD dwOldWeatherTemperatureUnit = dwWeatherTemperatureUnit;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherTemperatureUnit"),
0,
NULL,
&dwWeatherTemperatureUnit,
&dwSize
);
if (dwWeatherTemperatureUnit != dwOldWeatherTemperatureUnit && epw)
{
epw->lpVtbl->SetTemperatureUnit(epw, dwWeatherTemperatureUnit);
HWND hWnd = NULL;
if (SUCCEEDED(epw->lpVtbl->GetWindowHandle(epw, &hWnd)) && hWnd)
{
SendMessageW(hWnd, EP_WEATHER_WM_FETCH_DATA, 0, 0);
}
}
DWORD dwOldWeatherViewMode = dwWeatherViewMode;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherViewMode"),
0,
NULL,
&dwWeatherViewMode,
&dwSize
);
if (dwWeatherViewMode != dwOldWeatherViewMode && PeopleButton_LastHWND)
{
ToggleTaskbarAutohide();
ToggleTaskbarAutohide();
InvalidateRect(PeopleButton_LastHWND, NULL, TRUE);
}
DWORD dwOldUpdateSchedule = dwWeatherUpdateSchedule;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("WeatherContentUpdateMode"),
0,
NULL,
&dwWeatherUpdateSchedule,
&dwSize
);
if (dwWeatherUpdateSchedule != dwOldUpdateSchedule && epw)
{
epw->lpVtbl->SetUpdateSchedule(epw, dwWeatherUpdateSchedule * 1000);
}
dwSize = MAX_PATH * sizeof(WCHAR);
if (RegQueryValueExW(
hKey,
TEXT("WeatherLocation"),
0,
NULL,
wszWeatherTerm,
&dwSize
))
{
wcscpy_s(wszWeatherTerm, MAX_PATH, L"");
}
else
{
if (wszWeatherTerm[0] == 0)
{
wcscpy_s(wszWeatherTerm, MAX_PATH, L"");
}
}
if (epw)
{
epw->lpVtbl->SetTerm(epw, MAX_PATH * sizeof(WCHAR), wszWeatherTerm);
}
dwSize = MAX_PATH * sizeof(WCHAR);
if (RegQueryValueExW(
hKey,
TEXT("WeatherLanguage"),
0,
NULL,
wszWeatherLanguage,
&dwSize
))
{
wcscpy_s(wszWeatherLanguage, MAX_PATH, L"en");
}
else
{
if (wszWeatherLanguage[0] == 0)
{
wcscpy_s(wszWeatherLanguage, MAX_PATH, L"en");
}
}
if (epw)
{
epw->lpVtbl->SetLanguage(epw, MAX_PATH * sizeof(WCHAR), wszWeatherLanguage);
}
#endif
dwTemp = TASKBARGLOMLEVEL_DEFAULT;
dwSize = sizeof(DWORD);
RegQueryValueExW(
@ -6534,6 +7302,12 @@ DWORD Inject(BOOL bIsExplorer)
int rv;
if (bIsExplorer)
{
wszWeatherLanguage = malloc(sizeof(WCHAR) * MAX_PATH);
wszWeatherTerm = malloc(sizeof(WCHAR) * MAX_PATH);
}
LoadSettings(MAKELPARAM(bIsExplorer, FALSE));
#ifdef _WIN64
@ -6724,6 +7498,13 @@ DWORD Inject(BOOL bIsExplorer)
return;
}
wszEPWeatherKillswitch = calloc(sizeof(WCHAR), MAX_PATH);
rand_string(wszEPWeatherKillswitch, MAX_PATH / 2);
wcscat_s(wszEPWeatherKillswitch, MAX_PATH, _T(EP_Weather_Killswitch));
hEPWeatherKillswitch = CreateMutexW(NULL, TRUE, wszEPWeatherKillswitch);
#ifdef _WIN64
hCanStartSws = CreateEventW(NULL, FALSE, FALSE, NULL);
hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);
@ -6798,6 +7579,7 @@ DWORD Inject(BOOL bIsExplorer)
VnPatchIAT(hExplorer, "uxtheme.dll", "OpenThemeDataForDpi", explorer_OpenThemeDataForDpi);
VnPatchIAT(hExplorer, "uxtheme.dll", "DrawThemeBackground", explorer_DrawThemeBackground);
VnPatchIAT(hExplorer, "uxtheme.dll", "CloseThemeData", explorer_CloseThemeData);
//VnPatchIAT(hExplorer, "api-ms-win-core-libraryloader-l1-2-0.dll", "LoadStringW", explorer_LoadStringWHook);
if (bClassicThemeMitigations)
{
/*explorer_SetWindowThemeFunc = SetWindowTheme;
@ -6827,6 +7609,10 @@ DWORD Inject(BOOL bIsExplorer)
{
VnPatchIAT(hExplorer, "API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL", "SetRect", explorer_SetRect);
}
if (bOldTaskbar)
{
VnPatchIAT(hExplorer, "USER32.DLL", "DeleteMenu", explorer_DeleteMenu);
}
#ifdef USE_PRIVATE_INTERFACES
@ -6870,7 +7656,13 @@ DWORD Inject(BOOL bIsExplorer)
SetPreferredAppMode = GetProcAddress(hUxtheme, (LPCSTR)0x87);
AllowDarkModeForWindow = GetProcAddress(hUxtheme, (LPCSTR)0x85);
ShouldAppsUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x84);
ShouldSystemUseDarkMode = GetProcAddress(hUxtheme, (LPCSTR)0x8A);
GetThemeName = GetProcAddress(hUxtheme, (LPCSTR)0x4A);
PeopleBand_DrawTextWithGlowFunc = GetProcAddress(hUxtheme, (LPCSTR)0x7E);
if (bOldTaskbar)
{
VnPatchIAT(hExplorer, "uxtheme.dll", (LPCSTR)0x7E, PeopleBand_DrawTextWithGlowHook);
}
printf("Setup uxtheme functions done\n");
@ -7067,6 +7859,16 @@ DWORD Inject(BOOL bIsExplorer)
HANDLE hPeopleBand = LoadLibraryW(L"PeopleBand.dll");
if (hPeopleBand)
{
VnPatchIAT(hPeopleBand, "api-ms-win-core-largeinteger-l1-1-0.dll", "MulDiv", PeopleBand_MulDivHook);
printf("Setup peopleband functions done\n");
}
rv = funchook_install(funchook, 0);
if (rv != 0)
{

View File

@ -1,67 +1,49 @@
/*-
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
/*
* Copyright (c) 2017 Joachim Nilsson <troglobit@gmail.com>
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Novell nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fmemopen.h"
FILE*
fmemopen(void* buf, size_t size, const char* mode)
FILE* fmemopen(void* buf, size_t len, const char* type)
{
char temppath[MAX_PATH + 1];
char tempnam[MAX_PATH + 1];
DWORD l;
HANDLE fh;
FILE* fp;
int fd;
FILE* fp;
char tp[MAX_PATH - 13];
char fn[MAX_PATH + 1];
if (strcmp(mode, "r") != 0 && strcmp(mode, "r+") != 0)
return 0;
l = GetTempPathA(MAX_PATH, temppath);
if (!l || l >= MAX_PATH)
return 0;
if (!GetTempFileNameA(temppath, "solvtmp", 0, tempnam))
return 0;
fh = CreateFileA(tempnam, DELETE | GENERIC_READ | GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE,
NULL);
if (fh == INVALID_HANDLE_VALUE)
return 0;
fp = _fdopen(_open_osfhandle((intptr_t)fh, 0), "w+b");
if (!fp)
{
CloseHandle(fh);
return 0;
}
if (buf && size && fwrite(buf, size, 1, fp) != 1)
{
fclose(fp);
return 0;
}
rewind(fp);
return fp;
if (!GetTempPathA(sizeof(tp), tp))
return NULL;
if (!GetTempFileNameA(tp, "eptmp", 0, fn))
return NULL;
_sopen_s(&fd, fn,
_O_CREAT | _O_RDWR | _O_SHORT_LIVED | _O_TEMPORARY | _O_BINARY,
_SH_DENYRW,
_S_IREAD | _S_IWRITE);
if (fd == -1)
return NULL;
fp = _fdopen(fd, "w+");
if (!fp) {
_close(fd);
return NULL;
}
fwrite(buf, len, 1, fp);
rewind(fp);
return fp;
}

View File

@ -4,5 +4,6 @@
#include <io.h>
#include <fcntl.h>
#include <windows.h>
FILE* fmemopen(void* buf, size_t size, const char* mode);
#include <sys/stat.h>
FILE* fmemopen(void* buf, size_t len, const char* type);
#endif

View File

@ -68,9 +68,7 @@
;x 1 Small
;x 0 Large (default)
"TaskbarSmallIcons"=dword:00000000
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Show People on the taskbar
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand"=dword:00000000
;e
;T System tray
@ -346,6 +344,48 @@
;https://github.com/valinet/ExplorerPatcher/wiki/Simple-Window-Switcher
;T Weather
;t The following settings only apply to the Windows 10 taskbar:
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Show Weather on the taskbar
;"Virtualized_{D17F1E1A-5919-4427-8F89-A1A8503CA3EB}_PeopleBand"=dword:00000000
;c 3 Layout
;x 1 Icon only
;x 3 Icon and temperature
;x 0 Icon and text (default)
"WeatherViewMode"=dword:00000000
;c 7 Update frequency
;x 60 Every minute
;x 300 Every 5 minutes
;x 900 Every 15 minutes
;x 1200 Every 20 minutes (default)
;x 1800 Every half an hour
;x 3600 Every hour
;x 7200 Every couple of hours
"WeatherContentUpdateMode"=dword:000004B0
;c 2 Temperature unit
;x 0 Celsius (default)
;x 1 Fahrenheit
"WeatherTemperatureUnit"=dword:00000000
;w Location
;Search City or Zip Code; the program looks up "weather in /* what you typed */" on Google. Leave blank for the default value (IP-based current location).
;Current location (default)
"WeatherLocation"=""
;w Language
;Type the short code for the language you'd like the weather data to be displayed in. For example, try "en", "ro", "de", "fr" etc. Leave blank for the default value (English).
;en (default)
"WeatherLanguage"=""
;q
;t Weather data courtesy of Google, and weather.com.
;y Learn more about the Weather taskbar widget 🡕
;https://github.com/valinet/ExplorerPatcher/wiki/Weather
;u Refresh weather data
;update_weather
;T Other
[HKEY_CURRENT_USER\Software\ExplorerPatcher]
;b Remember last used section in this window
@ -401,6 +441,15 @@
"UpdatePolicy"=dword:00000001
;b Receive pre-release versions, if available (not recommended)
"UpdatePreferStaging"=dword:00000000
;t Update servers:
;w Releases
;Type a URL that serves resources adhering to GitHub's releases API. To learn how to configure your own update server, please consult the wiki.
;github.com/valinet/ExplorerPatcher/releases/latest
"UpdateURL"=""
;w Pre-releases
;Type a URL that serves resources adhering to GitHub's pre-releases API. To learn how to configure your own update server, please consult the wiki.
;api.github.com/repos/valinet/ExplorerPatcher/releases?per_page=1
"UpdateURLStaging"=""
;y Check for updates
;;;EP_CHECK_FOR_UPDATES
;y Update program and restart File Explorer
@ -483,6 +532,7 @@
;reset
;f
;u Restart File Explorer (*)
;restart

View File

@ -596,6 +596,10 @@ BOOL IsUpdateAvailable(LPCWSTR wszDataStore, char* szCheckAgainst, BOOL* lpFail,
szUpdateURL,
&dwSize
);
if (dwSize == 1 && szUpdateURL[0] == 0)
{
strcat_s(szUpdateURL, MAX_PATH, UPDATES_RELEASE_INFO_URL_STABLE);
}
strcat_s(szUpdateURL, MAX_PATH, "/download/");
strcat_s(szUpdateURL, MAX_PATH, SETUP_UTILITY_NAME);
if (wszInfoURL)
@ -609,6 +613,10 @@ BOOL IsUpdateAvailable(LPCWSTR wszDataStore, char* szCheckAgainst, BOOL* lpFail,
wszInfoURL,
&dwSize
);
if (dwSize == 1 && wszInfoURL[0] == 0)
{
wcscat_s(wszInfoURL, dwInfoURLLen, _T(UPDATES_RELEASE_INFO_URL_STABLE));
}
}
dwSize = sizeof(DWORD);
RegQueryValueExA(
@ -641,6 +649,10 @@ BOOL IsUpdateAvailable(LPCWSTR wszDataStore, char* szCheckAgainst, BOOL* lpFail,
szUpdateURL,
&dwSize
);
if (dwSize == 1 && szUpdateURL[0] == 0)
{
strcat_s(szUpdateURL, MAX_PATH, UPDATES_RELEASE_INFO_URL_STAGING);
}
}
RegCloseKey(hKey);
}
@ -706,6 +718,10 @@ BOOL UpdateProduct(
szUpdateURL,
&dwSize
);
if (dwSize == 1 && szUpdateURL[0] == 0)
{
strcat_s(szUpdateURL, MAX_PATH, UPDATES_RELEASE_INFO_URL_STABLE);
}
strcat_s(szUpdateURL, MAX_PATH, "/download/");
strcat_s(szUpdateURL, MAX_PATH, SETUP_UTILITY_NAME);
dwSize = sizeof(DWORD);
@ -739,6 +755,10 @@ BOOL UpdateProduct(
szUpdateURL,
&dwSize
);
if (dwSize == 1 && szUpdateURL[0] == 0)
{
strcat_s(szUpdateURL, MAX_PATH, UPDATES_RELEASE_INFO_URL_STAGING);
}
}
RegCloseKey(hKey);
}

View File

@ -789,3 +789,408 @@ LSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride)
}
return TRUE;
}
char* StrReplaceAllA(const char* s, const char* oldW, const char* newW, int* dwNewSize)
{
char* result;
int i, cnt = 0;
int newWlen = strlen(newW);
int oldWlen = strlen(oldW);
for (i = 0; s[i] != '\0'; i++) {
if (strstr(&s[i], oldW) == &s[i]) {
cnt++;
i += oldWlen - 1;
}
}
result = (char*)malloc(i + cnt * (newWlen - oldWlen) + 1);
i = 0;
while (*s) {
if (strstr(s, oldW) == s) {
strcpy_s(&result[i], strlen(newW) + 1, newW);
i += newWlen;
s += oldWlen;
}
else
result[i++] = *s++;
}
result[i] = '\0';
if (dwNewSize) *dwNewSize = i;
return result;
}
WCHAR* StrReplaceAllW(const WCHAR* s, const WCHAR* oldW, const WCHAR* newW, int* dwNewSize)
{
WCHAR* result;
int i, cnt = 0;
int newWlen = wcslen(newW);
int oldWlen = wcslen(oldW);
for (i = 0; s[i] != L'\0'; i++) {
if (wcsstr(&s[i], oldW) == &s[i]) {
cnt++;
i += oldWlen - 1;
}
}
result = (WCHAR*)malloc((i + cnt * (newWlen - oldWlen) + 1) * sizeof(WCHAR));
i = 0;
while (*s) {
if (wcsstr(s, oldW) == s) {
wcscpy_s(&result[i], newWlen + 1, newW);
i += newWlen;
s += oldWlen;
}
else
result[i++] = *s++;
}
result[i] = L'\0';
if (dwNewSize) *dwNewSize = i;
return result;
}
HWND InputBox_HWND;
HRESULT getEngineGuid(LPCTSTR extension, GUID* guidBuffer)
{
wchar_t buffer[100];
HKEY hk;
DWORD size;
HKEY subKey;
DWORD type;
// See if this file extension is associated
// with an ActiveX script engine
if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, extension, 0,
KEY_QUERY_VALUE | KEY_READ, &hk))
{
type = REG_SZ;
size = sizeof(buffer);
size = RegQueryValueEx(hk, 0, 0, &type,
(LPBYTE)&buffer[0], &size);
RegCloseKey(hk);
if (!size)
{
// The engine set an association.
// We got the Language string in buffer[]. Now
// we can use it to look up the engine's GUID
// Open HKEY_CLASSES_ROOT\{LanguageName}
again: size = sizeof(buffer);
if (!RegOpenKeyEx(HKEY_CLASSES_ROOT, (LPCTSTR)&buffer[0], 0,
KEY_QUERY_VALUE | KEY_READ, &hk))
{
// Read the GUID (in string format)
// into buffer[] by querying the value of CLSID
if (!RegOpenKeyEx(hk, L"CLSID", 0,
KEY_QUERY_VALUE | KEY_READ, &subKey))
{
size = RegQueryValueExW(subKey, 0, 0, &type,
(LPBYTE)&buffer[0], &size);
RegCloseKey(subKey);
}
else if (extension)
{
// If an error, see if we have a "ScriptEngine"
// key under here that contains
// the real language name
if (!RegOpenKeyEx(hk, L"ScriptEngine", 0,
KEY_QUERY_VALUE | KEY_READ, &subKey))
{
size = RegQueryValueEx(subKey, 0, 0, &type,
(LPBYTE)&buffer[0], &size);
RegCloseKey(subKey);
if (!size)
{
RegCloseKey(hk);
extension = 0;
goto again;
}
}
}
}
RegCloseKey(hk);
if (!size)
{
// Convert the GUID string to a GUID
// and put it in caller's guidBuffer
if ((size = CLSIDFromString(&buffer[0], guidBuffer)))
{
return(E_FAIL);
}
return(size);
}
}
}
return(E_FAIL);
}
ULONG STDMETHODCALLTYPE ep_static_AddRefRelease(void* _this)
{
return 1;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_QueryInterface(void* _this, REFIID riid, void** ppv)
{
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IActiveScriptSite))
*ppv = _this;
else if (IsEqualIID(riid, &IID_IActiveScriptSiteWindow))
*ppv = ((unsigned char*)_this + 8);
else
{
*ppv = 0;
return(E_NOINTERFACE);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_QueryInterface(void* _this, REFIID riid, void** ppv)
{
return IActiveScriptSite_QueryInterface((char*)_this - 8, riid, ppv);
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_GetLCID(void* _this, LCID* plcid)
{
*plcid = LOCALE_USER_DEFAULT;
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_GetItemInfo(void* _this, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown** ppiunkItem, ITypeInfo** ppti)
{
return TYPE_E_ELEMENTNOTFOUND;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_GetDocVersionString(void* _this, BSTR* pbstrVersion)
{
*pbstrVersion = 0;
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_OnScriptTerminate(void* _this, const void* pvarResult, const EXCEPINFO* pexcepinfo)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_OnStateChange(void* _this, SCRIPTSTATE ssScriptState)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_OnScriptError(void* _this, IActiveScriptError* scriptError)
{
ULONG lineNumber;
BSTR desc;
EXCEPINFO ei;
OLECHAR wszOutput[1024];
// Call GetSourcePosition() to retrieve the line # where
// the error occurred in the script
scriptError->lpVtbl->GetSourcePosition(scriptError, 0, &lineNumber, 0);
// Call GetSourceLineText() to retrieve the line in the script that
// has an error.
desc = 0;
scriptError->lpVtbl->GetSourceLineText(scriptError, &desc);
// Call GetExceptionInfo() to fill in our EXCEPINFO struct with more
// information.
ZeroMemory(&ei, sizeof(EXCEPINFO));
scriptError->lpVtbl->GetExceptionInfo(scriptError, &ei);
// Format the message we'll display to the user
wsprintfW(&wszOutput[0], L"%s\nLine %u: %s\n%s", ei.bstrSource,
lineNumber + 1, ei.bstrDescription, desc ? desc : "");
// Free what we got from the IActiveScriptError functions
SysFreeString(desc);
SysFreeString(ei.bstrSource);
SysFreeString(ei.bstrDescription);
SysFreeString(ei.bstrHelpFile);
// Display the message
MessageBoxW(0, &wszOutput[0], L"Error",
MB_SETFOREGROUND | MB_OK | MB_ICONEXCLAMATION);
return(S_OK);
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_OnEnterScript(void* _this)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSite_OnLeaveScript(void* _this)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_GetWindow(void* _this, HWND* phWnd)
{
*phWnd = InputBox_HWND;
return S_OK;
}
HRESULT STDMETHODCALLTYPE IActiveScriptSiteWindow_EnableModeless(void* _this, BOOL fEnable)
{
return S_OK;
}
static const IActiveScriptSiteVtbl IActiveScriptSite_Vtbl = {
.QueryInterface = IActiveScriptSite_QueryInterface,
.AddRef = ep_static_AddRefRelease,
.Release = ep_static_AddRefRelease,
.GetLCID = IActiveScriptSite_GetLCID,
.GetItemInfo = IActiveScriptSite_GetItemInfo,
.GetDocVersionString = IActiveScriptSite_GetDocVersionString,
.OnScriptTerminate = IActiveScriptSite_OnScriptTerminate,
.OnStateChange = IActiveScriptSite_OnStateChange,
.OnScriptError = IActiveScriptSite_OnScriptError,
.OnEnterScript = IActiveScriptSite_OnEnterScript,
.OnLeaveScript = IActiveScriptSite_OnLeaveScript,
};
static const IActiveScriptSiteWindowVtbl IActiveScriptSiteWindow_Vtbl = {
.QueryInterface = IActiveScriptSiteWindow_QueryInterface,
.AddRef = ep_static_AddRefRelease,
.Release = ep_static_AddRefRelease,
.GetWindow = IActiveScriptSiteWindow_GetWindow,
.EnableModeless = IActiveScriptSiteWindow_EnableModeless,
};
typedef struct _CSimpleScriptSite
{
IActiveScriptSiteVtbl* lpVtbl;
IActiveScriptSiteWindowVtbl* lpVtbl1;
} CSimpleScriptSite;
static const CSimpleScriptSite CSimpleScriptSite_Instance = {
.lpVtbl = &IActiveScriptSite_Vtbl,
.lpVtbl1 = &IActiveScriptSiteWindow_Vtbl
};
static BOOL HideInput = FALSE;
static LRESULT CALLBACK InputBoxProc(int nCode, WPARAM wParam, LPARAM lParam) {
if (nCode < HC_ACTION)
return CallNextHookEx(0, nCode, wParam, lParam);
if (nCode = HCBT_ACTIVATE) {
if (HideInput == TRUE) {
HWND TextBox = FindWindowExA((HWND)wParam, NULL, "Edit", NULL);
SendDlgItemMessageW((HWND)wParam, GetDlgCtrlID(TextBox), EM_SETPASSWORDCHAR, L'\x25cf', 0);
}
}
if (nCode = HCBT_CREATEWND) {
if (!(GetWindowLongPtr((HWND)wParam, GWL_STYLE) & WS_CHILD))
SetWindowLongPtr((HWND)wParam, GWL_EXSTYLE, GetWindowLongPtr((HWND)wParam, GWL_EXSTYLE) | WS_EX_DLGMODALFRAME);
}
return CallNextHookEx(0, nCode, wParam, lParam);
}
HRESULT InputBox(BOOL bPassword, HWND hWnd, LPCWSTR wszPrompt, LPCWSTR wszTitle, LPCWSTR wszDefault, LPCWSTR wszAnswer, DWORD cbAnswer)
{
HRESULT hr = S_OK;
GUID guidBuffer;
getEngineGuid(L".vbs", &guidBuffer);
DWORD cchPromptSafe = 0, cchTitleSafe = 0, cchDefaultSafe = 0;
LPWSTR wszPromptSafe = StrReplaceAllW(wszPrompt, L"\"", L"\"\"", &cchPromptSafe);
LPWSTR wszTitleSafe = StrReplaceAllW(wszTitle, L"\"", L"\"\"", &cchTitleSafe);
LPWSTR wszDefaultSafe = StrReplaceAllW(wszDefault, L"\"", L"\"\"", &cchDefaultSafe);
if (!wszPromptSafe || !wszTitleSafe || !wszDefaultSafe)
{
if (wszPromptSafe)
{
free(wszPromptSafe);
}
if (wszTitleSafe)
{
free(wszTitleSafe);
}
if (wszDefaultSafe)
{
free(wszDefaultSafe);
}
return E_OUTOFMEMORY;
}
IActiveScript* pActiveScript = NULL;
hr = CoCreateInstance(&guidBuffer, 0, CLSCTX_ALL,
&IID_IActiveScript,
(void**)&pActiveScript);
if (SUCCEEDED(hr) && pActiveScript)
{
hr = pActiveScript->lpVtbl->SetScriptSite(pActiveScript, &CSimpleScriptSite_Instance);
if (SUCCEEDED(hr))
{
IActiveScriptParse* pActiveScriptParse = NULL;
hr = pActiveScript->lpVtbl->QueryInterface(pActiveScript, &IID_IActiveScriptParse, &pActiveScriptParse);
if (SUCCEEDED(hr) && pActiveScriptParse)
{
hr = pActiveScriptParse->lpVtbl->InitNew(pActiveScriptParse);
if (SUCCEEDED(hr))
{
LPWSTR wszEvaluation = malloc(sizeof(WCHAR) * (cchPromptSafe + cchTitleSafe + cchDefaultSafe + 100));
if (wszEvaluation)
{
swprintf_s(wszEvaluation, cchPromptSafe + cchTitleSafe + cchDefaultSafe + 100, L"InputBox(\"%s\", \"%s\", \"%s\")", wszPromptSafe, wszTitleSafe, wszDefaultSafe);
DWORD cchEvaluation2 = 0;
LPWSTR wszEvaluation2 = StrReplaceAllW(wszEvaluation, L"\n", L"\" + vbNewLine + \"", &cchEvaluation2);
if (wszEvaluation2)
{
EXCEPINFO ei;
ZeroMemory(&ei, sizeof(EXCEPINFO));
DWORD dwThreadId = GetCurrentThreadId();
HINSTANCE hInstance = GetModuleHandle(NULL);
if (!hWnd)
{
InputBox_HWND = GetAncestor(GetActiveWindow(), GA_ROOTOWNER);
}
else
{
InputBox_HWND = hWnd;
}
HHOOK hHook = SetWindowsHookExW(WH_CBT, &InputBoxProc, hInstance, dwThreadId);
VARIANT result;
VariantInit(&result);
HideInput = bPassword;
hr = pActiveScriptParse->lpVtbl->ParseScriptText(pActiveScriptParse, wszEvaluation2, NULL, NULL, NULL, 0, 0, SCRIPTTEXT_ISEXPRESSION, &result, &ei);
UnhookWindowsHookEx(hHook);
free(wszEvaluation2);
memcpy(wszAnswer, result.bstrVal, cbAnswer * sizeof(WCHAR));
VariantClear(&result);
}
free(wszEvaluation);
}
}
pActiveScriptParse->lpVtbl->Release(pActiveScriptParse);
}
pActiveScript->lpVtbl->Release(pActiveScript);
}
}
if (wszPromptSafe)
{
free(wszPromptSafe);
}
if (wszTitleSafe)
{
free(wszTitleSafe);
}
if (wszDefaultSafe)
{
free(wszDefaultSafe);
}
return hr;
}

View File

@ -18,6 +18,7 @@
#include <valinet/universal/toast/toast.h>
#include "queryversion.h"
#pragma comment(lib, "Psapi.lib")
#include <activscp.h>
#include "def.h"
@ -220,6 +221,8 @@ static void(*AllowDarkModeForWindow)(HWND hWnd, INT64 bAllowDark);
static BOOL(*ShouldAppsUseDarkMode)();
static BOOL(*ShouldSystemUseDarkMode)();
static void(*GetThemeName)(void*, void*, void*);
static BOOL AppsShouldUseDarkMode() { return TRUE; }
@ -236,6 +239,27 @@ BOOL SystemShutdown(BOOL reboot);
LSTATUS RegisterDWMService(DWORD dwDesiredState, DWORD dwOverride);
char* StrReplaceAllA(const char* s, const char* oldW, const char* newW, int* dwNewSize);
WCHAR* StrReplaceAllW(const WCHAR* s, const WCHAR* oldW, const WCHAR* newW, int* dwNewSize);
HRESULT InputBox(BOOL bPassword, HWND hWnd, LPCWSTR wszPrompt, LPCWSTR wszTitle, LPCWSTR wszDefault, LPCWSTR wszAnswer, DWORD cbAnswer);
// https://codereview.stackexchange.com/questions/29198/random-string-generator-in-c
static inline WCHAR* rand_string(WCHAR* str, size_t size)
{
const WCHAR charset[] = L"abcdefghijklmnopqrstuvwxyz";
if (size) {
--size;
for (size_t n = 0; n < size; n++) {
int key = rand() % (int)(sizeof charset - 1);
str[n] = charset[key];
}
str[size] = L'\0';
}
return str;
}
inline long long milliseconds_now() {
LARGE_INTEGER s_frequency;
BOOL s_use_qpc = QueryPerformanceFrequency(&s_frequency);

View File

@ -346,6 +346,32 @@ int WINAPI wWinMain(
wcscat_s(wszPath, MAX_PATH, L"\\ep_dwm.exe");
bOk = InstallResource(TRUE, hInstance, IDR_EP_DWM, wszPath);
}
if (argc >= 2)
{
wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH);
}
else
{
GetCurrentDirectoryW(MAX_PATH, wszPath);
}
if (bOk)
{
wcscat_s(wszPath, MAX_PATH, L"\\ep_weather_host.dll");
bOk = InstallResource(TRUE, hInstance, IDR_EP_WEATHER, wszPath);
}
if (argc >= 2)
{
wcsncpy_s(wszPath, MAX_PATH, wargv[1], MAX_PATH);
}
else
{
GetCurrentDirectoryW(MAX_PATH, wszPath);
}
if (bOk)
{
wcscat_s(wszPath, MAX_PATH, L"\\ep_weather_host_stub.dll");
bOk = InstallResource(TRUE, hInstance, IDR_EP_WEATHER_STUB, wszPath);
}
return 0;
}
@ -447,6 +473,8 @@ int WINAPI wWinMain(
CloseHandle(sei.hProcess);
}
Sleep(500);
BOOL bAreRoundedCornersDisabled = FALSE;
HANDLE h_exists = CreateEventW(NULL, FALSE, FALSE, L"Global\\ep_dwm_" _T(EP_CLSID));
if (h_exists)
@ -628,6 +656,27 @@ int WINAPI wWinMain(
wcscat_s(wszPath, MAX_PATH, L"\\ep_dwm.exe");
bOk = InstallResource(bInstall, hInstance, IDR_EP_DWM, wszPath);
}
if (bInstall)
{
if (bOk)
{
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\ep_weather_host.dll");
bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER, wszPath);
}
if (bOk)
{
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\ep_weather_host_stub.dll");
bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER_STUB, wszPath);
}
if (bOk)
{
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\WebView2Loader.dll");
bOk = InstallResource(bInstall, hInstance, IDR_MS_WEBVIEW2_LOADER, wszPath);
}
}
if (bOk)
{
bOk = GetWindowsDirectoryW(wszPath, MAX_PATH);
@ -670,6 +719,109 @@ int WINAPI wWinMain(
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
CloseHandle(ShExecInfo.hProcess);
}
if (bOk)
{
WCHAR wszArgs[MAX_PATH];
wszArgs[0] = L'/';
wszArgs[1] = L's';
wszArgs[2] = L' ';
wszArgs[3] = L'"';
if (!bInstall)
{
wszArgs[3] = L'/';
wszArgs[4] = L'u';
wszArgs[5] = L' ';
wszArgs[6] = L'"';
}
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4 + (bInstall ? 0 : 3));
wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_weather_host.dll\"");
wprintf(L"%s\n", wszArgs);
WCHAR wszApp[MAX_PATH * 2];
GetSystemDirectoryW(wszApp, MAX_PATH * 2);
wcscat_s(wszApp, MAX_PATH * 2, L"\\regsvr32.exe");
wprintf(L"%s\n", wszApp);
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = NULL;
sei.hInstApp = NULL;
sei.lpVerb = NULL;
sei.lpFile = wszApp;
sei.lpParameters = wszArgs;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (ShellExecuteExW(&sei) && sei.hProcess)
{
WaitForSingleObject(sei.hProcess, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeProcess(sei.hProcess, &dwExitCode);
SetLastError(dwExitCode);
CloseHandle(sei.hProcess);
}
}
if (bOk)
{
WCHAR wszArgs[MAX_PATH];
wszArgs[0] = L'/';
wszArgs[1] = L's';
wszArgs[2] = L' ';
wszArgs[3] = L'"';
if (!bInstall)
{
wszArgs[3] = L'/';
wszArgs[4] = L'u';
wszArgs[5] = L' ';
wszArgs[6] = L'"';
}
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszArgs + 4 + (bInstall ? 0 : 3));
wcscat_s(wszArgs, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_weather_host_stub.dll\"");
wprintf(L"%s\n", wszArgs);
WCHAR wszApp[MAX_PATH * 2];
GetSystemDirectoryW(wszApp, MAX_PATH * 2);
wcscat_s(wszApp, MAX_PATH * 2, L"\\regsvr32.exe");
wprintf(L"%s\n", wszApp);
SHELLEXECUTEINFOW sei;
ZeroMemory(&sei, sizeof(SHELLEXECUTEINFOW));
sei.cbSize = sizeof(sei);
sei.fMask = SEE_MASK_NOCLOSEPROCESS;
sei.hwnd = NULL;
sei.hInstApp = NULL;
sei.lpVerb = NULL;
sei.lpFile = wszApp;
sei.lpParameters = wszArgs;
sei.hwnd = NULL;
sei.nShow = SW_NORMAL;
if (ShellExecuteExW(&sei) && sei.hProcess)
{
WaitForSingleObject(sei.hProcess, INFINITE);
DWORD dwExitCode = 0;
GetExitCodeProcess(sei.hProcess, &dwExitCode);
SetLastError(dwExitCode);
CloseHandle(sei.hProcess);
}
}
if (!bInstall)
{
if (bOk)
{
SHGetFolderPathW(NULL, SPECIAL_FOLDER, NULL, SHGFP_TYPE_CURRENT, wszPath);
wcscat_s(wszPath, MAX_PATH, _T(APP_RELATIVE_PATH) L"\\ep_weather_host.dll");
bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER, wszPath);
}
if (bOk)
{
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\ep_weather_host_stub.dll");
bOk = InstallResource(bInstall, hInstance, IDR_EP_WEATHER_STUB, wszPath);
}
if (bOk)
{
PathRemoveFileSpecW(wszPath);
wcscat_s(wszPath, MAX_PATH, L"\\WebView2Loader.dll");
bOk = InstallResource(bInstall, hInstance, IDR_MS_WEBVIEW2_LOADER, wszPath);
}
}
if (bOk)
{

View File

@ -96,6 +96,12 @@ IDR_EP_IA32 RCDATA "..\\build\\Release\\ExplorerPatcher.
IDR_EP_DWM RCDATA "..\\build\\Release\\ep_dwm.exe"
IDR_EP_WEATHER RCDATA "..\\build\\Release\\ep_weather_host.dll"
IDR_EP_WEATHER_STUB RCDATA "..\\build\\Release\\ep_weather_host_stub.dll"
IDR_MS_WEBVIEW2_LOADER RCDATA "..\\build\\Release\\WebView2Loader.dll"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -173,6 +173,14 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="..\build\Debug\ep_weather_host.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="..\build\Debug\ep_weather_host_stub.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="..\build\Debug\ExplorerPatcher.amd64.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@ -189,6 +197,14 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ExcludedFromBuild>
</None>
<None Include="..\build\Release\ep_weather_host.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="..\build\Release\ep_weather_host_stub.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</None>
<None Include="..\build\Release\ExplorerPatcher.amd64.dll">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>

View File

@ -48,5 +48,9 @@
<None Include="..\build\Debug\ExplorerPatcher.IA-32.dll" />
<None Include="..\build\Release\ep_dwm.exe" />
<None Include="..\build\Debug\ep_dwm.exe" />
<None Include="..\build\Debug\ep_weather_host.dll" />
<None Include="..\build\Release\ep_weather_host.dll" />
<None Include="..\build\Release\ep_weather_host_stub.dll" />
<None Include="..\build\Debug\ep_weather_host_stub.dll" />
</ItemGroup>
</Project>

View File

@ -96,6 +96,12 @@ IDR_EP_IA32 RCDATA "..\\build\\Debug\\ExplorerPatcher.IA
IDR_EP_DWM RCDATA "..\\build\\Debug\\ep_dwm.exe"
IDR_EP_WEATHER RCDATA "..\\build\\Debug\\ep_weather_host.dll"
IDR_EP_WEATHER_STUB RCDATA "..\\build\\Debug\\ep_weather_host_stub.dll"
IDR_MS_WEBVIEW2_LOADER RCDATA "..\\build\\Release\\WebView2Loader.dll"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -5,6 +5,9 @@
#define IDR_EP_AMD64 103
#define IDR_EP_IA32 104
#define IDR_EP_DWM 105
#define IDR_EP_WEATHER 106
#define IDR_EP_WEATHER_STUB 107
#define IDR_MS_WEBVIEW2_LOADER 201
// Next default values for new objects
//

View File

@ -0,0 +1,309 @@
#include "ep_weather.h"
#include "ep_weather_factory.h"
#include "ep_weather_host.h"
HMODULE epw_hModule;
DWORD epw_OutstandingObjects = 0;
DWORD epw_LockCount = 0;
#ifdef _WIN64
#pragma comment(linker, "/export:DllRegisterServer=_DllRegisterServer")
#else
#pragma comment(linker, "/export:DllRegisterServer=__DllRegisterServer@0")
#endif
HRESULT WINAPI _DllRegisterServer()
{
DWORD dwLastError = ERROR_SUCCESS;
HKEY hKey = NULL;
DWORD dwSize = 0;
wchar_t wszFilename[MAX_PATH];
wchar_t wszInstallPath[MAX_PATH];
if (!dwLastError)
{
if (!GetModuleFileNameW(epw_hModule, wszFilename, MAX_PATH))
{
dwLastError = GetLastError();
}
}
if (!dwLastError)
{
dwLastError = RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\CLSID\\") _T(CLSID_EPWeather_TEXT),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_WOW64_64KEY,
NULL,
&hKey,
NULL
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegSetValueExW(
hKey,
NULL,
0,
REG_SZ,
_T(CLSID_EPWeather_Name),
29 * sizeof(wchar_t)
);
dwLastError = RegSetValueExW(
hKey,
L"AppID",
0,
REG_SZ,
_T(CLSID_EPWeather_TEXT),
39 * sizeof(wchar_t)
);
RegCloseKey(hKey);
}
dwLastError = RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\CLSID\\") _T(CLSID_EPWeather_TEXT) _T("\\InProcServer32"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_WOW64_64KEY,
NULL,
&hKey,
NULL
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegSetValueExW(
hKey,
NULL,
0,
REG_SZ,
wszFilename,
(wcslen(wszFilename) + 1) * sizeof(wchar_t)
);
dwLastError = RegSetValueExW(
hKey,
L"ThreadingModel",
0,
REG_SZ,
L"Apartment",
10 * sizeof(wchar_t)
);
RegCloseKey(hKey);
}
dwLastError = RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\AppID\\") _T(CLSID_EPWeather_TEXT),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_WOW64_64KEY,
NULL,
&hKey,
NULL
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegSetValueExW(
hKey,
NULL,
0,
REG_SZ,
_T(CLSID_EPWeather_Name),
29 * sizeof(wchar_t)
);
dwLastError = RegSetValueExW(
hKey,
L"DllSurrogate",
0,
REG_SZ,
L"",
1 * sizeof(wchar_t)
);
RegCloseKey(hKey);
}
dwLastError = RegCreateKeyExW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\AppID\\") _T(CLSID_EPWeather_TEXT),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE | KEY_WOW64_64KEY,
NULL,
&hKey,
NULL
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegSetValueExW(
hKey,
NULL,
0,
REG_SZ,
_T(CLSID_EPWeather_Name),
29 * sizeof(wchar_t)
);
dwLastError = RegSetValueExW(
hKey,
L"DllSurrogate",
0,
REG_SZ,
L"",
1 * sizeof(wchar_t)
);
RegCloseKey(hKey);
}
}
return dwLastError == 0 ? (NOERROR) : (HRESULT_FROM_WIN32(dwLastError));
}
#ifdef _WIN64
#pragma comment(linker, "/export:DllUnregisterServer=_DllUnregisterServer")
#else
#pragma comment(linker, "/export:DllUnregisterServer=__DllUnregisterServer@0")
#endif
HRESULT WINAPI _DllUnregisterServer()
{
DWORD dwLastError = ERROR_SUCCESS;
HKEY hKey = NULL;
DWORD dwSize = 0;
wchar_t wszFilename[MAX_PATH];
if (!dwLastError)
{
if (!GetModuleFileNameW(epw_hModule, wszFilename, MAX_PATH))
{
dwLastError = GetLastError();
}
}
if (!dwLastError)
{
dwLastError = RegOpenKeyW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\CLSID\\") _T(CLSID_EPWeather_TEXT),
&hKey
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegDeleteTreeW(
hKey,
0
);
RegCloseKey(hKey);
if (!dwLastError)
{
RegDeleteKeyW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\CLSID\\") _T(CLSID_EPWeather_TEXT)
);
}
}
dwLastError = RegOpenKeyW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\AppID\\") _T(CLSID_EPWeather_TEXT),
&hKey
);
if (hKey == NULL || hKey == INVALID_HANDLE_VALUE)
{
hKey = NULL;
}
if (hKey)
{
dwLastError = RegDeleteTreeW(
hKey,
0
);
RegCloseKey(hKey);
if (!dwLastError)
{
RegDeleteKeyW(
HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Classes\\AppID\\") _T(CLSID_EPWeather_TEXT)
);
}
}
}
return dwLastError == 0 ? (NOERROR) : (HRESULT_FROM_WIN32(dwLastError));
}
#ifdef _WIN64
#pragma comment(linker, "/export:DllCanUnloadNow=_DllCanUnloadNow")
#else
#pragma comment(linker, "/export:DllCanUnloadNow=__DllCanUnloadNow@0")
#endif
HRESULT WINAPI _DllCanUnloadNow()
{
return((epw_OutstandingObjects | epw_LockCount) ? S_FALSE : S_OK);
}
#ifdef _WIN64
#pragma comment(linker, "/export:DllGetClassObject=_DllGetClassObject")
#else
#pragma comment(linker, "/export:DllGetClassObject=__DllGetClassObject@12")
#endif
HRESULT WINAPI _DllGetClassObject(
REFCLSID objGuid,
REFIID factoryGuid,
LPVOID* factoryHandle
)
{
HRESULT hr;
if (IsEqualCLSID(objGuid, &CLSID_EPWeather))
{
hr = ClassFactory->lpVtbl->QueryInterface(
ClassFactory,
factoryGuid,
factoryHandle
);
}
else
{
*factoryHandle = 0;
hr = CLASS_E_CLASSNOTAVAILABLE;
}
return(hr);
}
BOOL WINAPI DllMain(
_In_ HINSTANCE hinstDLL,
_In_ DWORD fdwReason,
_In_ LPVOID lpvReserved
)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
epw_hModule = hinstDLL;
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View File

@ -0,0 +1,51 @@
#ifndef _H_AS_H_
#define _H_AS_H_
#include <initguid.h>
#include <Windows.h>
#include <tchar.h>
#include <Shlwapi.h>
#pragma comment(lib, "Version.lib")
#pragma comment(lib, "Shlwapi.lib")
#define ALLOC(x) calloc(1, x)
#define FREE(x) free(x)
extern HMODULE epw_hModule;
extern DWORD epw_OutstandingObjects;
extern DWORD epw_LockCount;
// {A6EA9C2D-4982-4827-9204-0AC532959F6D}
#define CLSID_EPWeather_Name "ExplorerPatcher Weather Host"
#define CLSID_EPWeather_TEXT "{A6EA9C2D-4982-4827-9204-0AC532959F6D}"
#define EP_Weather_Killswitch "Global\\EP_Weather_Killswitch_" CLSID_EPWeather_TEXT
DEFINE_GUID(CLSID_EPWeather,
0xa6ea9c2d, 0x4982, 0x4827, 0x92, 0x4, 0xa, 0xc5, 0x32, 0x95, 0x9f, 0x6d);
#if defined(__cplusplus) && !defined(CINTERFACE)
#else
DEFINE_GUID(IID_IEPWeather,
0xcdbf3734, 0xf847, 0x4f1b, 0xb9, 0x53, 0xa6, 0x5, 0x43, 0x4d, 0xc1, 0xe7);
#endif
#define EPW_WEATHER_CLASSNAME "ExplorerPatcher_Weather_" CLSID_EPWeather_TEXT
#define EP_WEATHER_KEEP_VALUE -1
#define EP_WEATHER_NUM_PROVIDERS 2
#define EP_WEATHER_PROVIDER_TEST 0
#define EP_WEATHER_PROVIDER_GOOGLE 1
#define EP_WEATHER_NUM_TUNITS 2
#define EP_WEATHER_TUNIT_CELSIUS 0
#define EP_WEATHER_TUNIT_FAHRENHEIT 1
#define EP_WEATHER_VIEW_ICONONLY 1
#define EP_WEATHER_VIEW_ICONTEMP 3
#define EP_WEATHER_VIEW_ICONTEXT 0
#define EP_WEATHER_UPDATE_NORMAL 1200
#define EP_WEATHER_UPDATE_REDUCED 3600
#define EP_WEATHER_WM_FETCH_DATA (WM_USER + 10)
#endif

View File

@ -0,0 +1,93 @@
#include "ep_weather_factory.h"
#include "ep_weather_host.h"
ULONG STDMETHODCALLTYPE epw_factory_AddRef(IClassFactory* _this)
{
return(1);
}
ULONG STDMETHODCALLTYPE epw_factory_Release(IClassFactory* _this)
{
return(1);
}
HRESULT STDMETHODCALLTYPE epw_factory_QueryInterface(
IClassFactory* _this,
REFIID riid,
void** ppv
)
{
if (!IsEqualIID(riid, &IID_IUnknown) &&
!IsEqualIID(riid, &IID_IClassFactory))
{
*ppv = 0;
return(E_NOINTERFACE);
}
*ppv = _this;
_this->lpVtbl->AddRef(_this);
return(NOERROR);
}
HRESULT STDMETHODCALLTYPE epw_factory_LockServer(
IClassFactory* this,
BOOL flock
)
{
if (flock) InterlockedIncrement(&epw_LockCount);
else
{
LONG dwOutstandingLocks = InterlockedDecrement(&epw_LockCount);
LONG dwOutstandingObjects = InterlockedAdd(&epw_OutstandingObjects, 0);
if (!dwOutstandingObjects && !dwOutstandingLocks)
{
}
}
return(NOERROR);
}
HRESULT STDMETHODCALLTYPE epw_factory_CreateInstance(
IClassFactory* _this,
IUnknown* punkOuter,
REFIID vTableGuid,
void** ppv
)
{
HRESULT hr = E_NOINTERFACE;
EPWeather* thisobj = NULL;
*ppv = 0;
if (punkOuter)
{
hr = CLASS_E_NOAGGREGATION;
}
else
{
BOOL bOk = FALSE;
if (IsEqualIID(vTableGuid, &IID_IEPWeather))
{
if (!(thisobj = ALLOC(sizeof(EPWeather))))
{
hr = E_OUTOFMEMORY;
}
else
{
thisobj->lpVtbl = &IEPWeather_Vtbl;
bOk = TRUE;
}
}
if (bOk)
{
thisobj->cbCount = 1;
hr = thisobj->lpVtbl->QueryInterface(thisobj, vTableGuid, ppv);
thisobj->lpVtbl->Release(thisobj);
if (SUCCEEDED(hr)) InterlockedIncrement(&epw_OutstandingObjects);
}
else
{
return hr;
}
}
return(hr);
}

View File

@ -0,0 +1,34 @@
#ifndef _H_AS_FACTORY_H_
#define _H_AS_FACTORY_H_
#include "ep_weather.h"
ULONG STDMETHODCALLTYPE epw_factory_AddRef(IClassFactory* _this);
ULONG STDMETHODCALLTYPE epw_factory_Release(IClassFactory* _this);
HRESULT STDMETHODCALLTYPE epw_factory_QueryInterface(
IClassFactory* _this,
REFIID riid,
void** ppv
);
HRESULT STDMETHODCALLTYPE epw_factory_LockServer(
IClassFactory* _this,
BOOL flock
);
HRESULT STDMETHODCALLTYPE epw_factory_CreateInstance(
IClassFactory* _this,
IUnknown* punkOuter,
REFIID vTableGuid,
void** ppv
);
typedef interface IEPWeatherFactory IEPWeatherFactory;
// {A25216A3-4223-4CB3-A572-11A7CC1AEE4E}
DEFINE_GUID(IID_IEPWeatherFactory,
0xa25216a3, 0x4223, 0x4cb3, 0xa5, 0x72, 0x11, 0xa7, 0xcc, 0x1a, 0xee, 0x4e);
static const IClassFactoryVtbl IEPWeatherFactoryVtbl = {
epw_factory_QueryInterface,
epw_factory_AddRef,
epw_factory_Release,
epw_factory_CreateInstance,
epw_factory_LockServer
};
static IClassFactory IClassFactoryInstance = { &IEPWeatherFactoryVtbl };
static IClassFactory* ClassFactory = &IClassFactoryInstance;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,210 @@
#ifndef _H_AS_SERVICE_P_H_
#define _H_AS_SERVICE_P_H_
#include "ep_weather.h"
#include "ep_weather_utility.h"
#include "../ep_weather_host_stub/ep_weather_host_h.h"
#include <windowsx.h>
#include <ShlObj.h>
#include <Shobjidl.h>
#include <dwmapi.h>
#pragma comment(lib, "Dwmapi.lib")
#include <netlistmgr.h>
#include <Iphlpapi.h>
#pragma comment(lib, "IPHLPAPI.lib")
#include "WebView2.h"
DEFINE_GUID(IID_ITaskbarList,
0x56FDF342, 0xFD6D, 0x11d0, 0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90);
#define EP_WEATHER_NUM_SIGNALS 2
#define EP_WEATHER_TIMER_REQUEST_REPAINT 1
#define EP_WEATHER_TIMER_REQUEST_REPAINT_DELAY 1000
#define EP_WEATHER_TIMER_REBOUND_BROWSER 2
#define EP_WEATHER_TIMER_REBOUND_BROWSER_DELAY 1
#define EP_WEATHER_TIMER_SCHEDULE_REFRESH 10
typedef interface EPWeather
{
CONST_VTBL IEPWeatherVtbl* lpVtbl;
unsigned int cbCount;
HRESULT hrLastError;
HANDLE hMainThread;
HANDLE hInitializeEvent;
HWND hWnd;
INT64 bBrowserBusy; // interlocked
HWND hNotifyWnd; // interlocked
LONG64 dwTemperatureUnit; // interlocked
LONG64 dwUpdateSchedule; // interlocked
WCHAR wszTerm[MAX_PATH];
WCHAR wszLanguage[MAX_PATH];
LONG64 cbx; // interlocked
LONG64 cby; // interlocked
LONG64 dwProvider; // interlocked
double dpi;
HANDLE hMutexData; // protects the following:
DWORD cbTemperature;
LPCWSTR wszTemperature;
DWORD cbUnit;
LPCWSTR wszUnit;
DWORD cbCondition;
LPCWSTR wszCondition;
DWORD cbImage;
char* pImage;
DWORD cbLocation;
LPCWSTR wszLocation;
RECT rcBorderThickness; // local variables:
ITaskbarList* pTaskList;
ICoreWebView2Controller* pCoreWebView2Controller;
ICoreWebView2* pCoreWebView2;
EventRegistrationToken* tkOnNavigationCompleted;
LPCWSTR wszScriptData;
HANDLE hSignalExitMainThread;
HANDLE hSignalKillSwitch;
} EPWeather;
ULONG STDMETHODCALLTYPE epw_Weather_AddRef(EPWeather* _this);
ULONG STDMETHODCALLTYPE epw_Weather_Release(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_QueryInterface(EPWeather* _this, REFIID riid, void** ppv);
HRESULT STDMETHODCALLTYPE epw_Weather_About(EPWeather* _this, HWND hWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_Initialize(EPWeather* _this, WCHAR wszName[MAX_PATH], BOOL bAllocConsole, LONG64 dwProvider, LONG64 cbx, LONG64 cby, LONG64 dwTemperatureUnit, LONG64 dwUpdateSchedule, double dpi);
HRESULT STDMETHODCALLTYPE epw_Weather_Show(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_Hide(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_GetWindowHandle(EPWeather* _this, HWND* phWnd);
HRESULT STDMETHODCALLTYPE epw_Weather_IsInitialized(EPWeather* _this, BOOL* bIsInitialized);
HRESULT STDMETHODCALLTYPE epw_Weather_LockData(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_GetDataSizes(EPWeather* _this, LPDWORD pcbTemperature, LPDWORD pcbUnit, LPDWORD pcbCondition, LPDWORD pcbImage);
HRESULT STDMETHODCALLTYPE epw_Weather_GetData(EPWeather* _this, DWORD cbTemperature, LPCWSTR wszTemperature, DWORD cbUnit, LPCWSTR wszUnit, DWORD cbCondition, LPCWSTR wszCondition, DWORD cbImage, char* pImage);
HRESULT STDMETHODCALLTYPE epw_Weather_GetTitle(EPWeather* _this, DWORD cbTitle, LPCWSTR wszTitle, DWORD dwType);
HRESULT STDMETHODCALLTYPE epw_Weather_UnlockData(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_SetNotifyWindow(EPWeather* _this, HWND hWndNotify);
HRESULT STDMETHODCALLTYPE epw_Weather_SetTemperatureUnit(EPWeather* _this, LONG64 dwTemperatureUnit);
HRESULT STDMETHODCALLTYPE epw_Weather_SetUpdateSchedule(EPWeather* _this, LONG64 dwUpdateSchedule);
HRESULT STDMETHODCALLTYPE epw_Weather_SetTerm(EPWeather* _this, DWORD cbTerm, LPCWSTR wszTerm);
HRESULT STDMETHODCALLTYPE epw_Weather_SetLanguage(EPWeather* _this, DWORD cbLanguage, LPCWSTR wszLanguage);
HRESULT STDMETHODCALLTYPE epw_Weather_SetIconSize(EPWeather* _this, LONG64 cbx, LONG64 cby);
HRESULT STDMETHODCALLTYPE epw_Weather_GetIconSize(EPWeather* _this, LONG64* cbx, LONG64* cby);
static const IEPWeatherVtbl IEPWeather_Vtbl = {
.QueryInterface = epw_Weather_QueryInterface,
.AddRef = epw_Weather_AddRef,
.Release = epw_Weather_Release,
.About = epw_Weather_About,
.Initialize = epw_Weather_Initialize,
.Show = epw_Weather_Show,
.Hide = epw_Weather_Hide,
.GetWindowHandle = epw_Weather_GetWindowHandle,
.LockData = epw_Weather_LockData,
.GetDataSizes = epw_Weather_GetDataSizes,
.GetData = epw_Weather_GetData,
.UnlockData = epw_Weather_UnlockData,
.SetNotifyWindow = epw_Weather_SetNotifyWindow,
.IsInitialized = epw_Weather_IsInitialized,
.GetTitle = epw_Weather_GetTitle,
.SetTemperatureUnit = epw_Weather_SetTemperatureUnit,
.SetTerm = epw_Weather_SetTerm,
.SetLanguage = epw_Weather_SetLanguage,
.SetIconSize = epw_Weather_SetIconSize,
.GetIconSize = epw_Weather_GetIconSize,
.SetUpdateSchedule = epw_Weather_SetUpdateSchedule,
};
HRESULT STDMETHODCALLTYPE epw_Weather_static_Stub(void* _this);
ULONG STDMETHODCALLTYPE epw_Weather_static_AddRefRelease(EPWeather* _this);
HRESULT STDMETHODCALLTYPE epw_Weather_static_QueryInterface(EPWeather* _this, REFIID riid, void** ppv);
HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2EnvironmentCompleted(ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler* _this, HRESULT errorCode, ICoreWebView2Environment* pCoreWebView2Environment);
HRESULT STDMETHODCALLTYPE ICoreWebView2_CreateCoreWebView2ControllerCompleted(ICoreWebView2CreateCoreWebView2ControllerCompletedHandler* _this, HRESULT hr, ICoreWebView2Controller* pCoreWebView2Controller);
HRESULT STDMETHODCALLTYPE ICoreWebView2_NavigationCompleted(ICoreWebView2NavigationCompletedEventHandler* _this, ICoreWebView2* pCoreWebView2, ICoreWebView2NavigationCompletedEventArgs* pCoreWebView2NavigationCompletedEventArgs);
HRESULT STDMETHODCALLTYPE ICoreWebView2_ExecuteScriptCompleted(ICoreWebView2ExecuteScriptCompletedHandler* _this, HRESULT hr, LPCWSTR pResultObjectAsJson);
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_AdditionalBrowserArguments(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_Language(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_TargetCompatibleBrowserVersion(ICoreWebView2EnvironmentOptions* _this, LPWSTR* value);
HRESULT STDMETHODCALLTYPE ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount(ICoreWebView2EnvironmentOptions* _this, BOOL* allow);
static const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_CreateCoreWebView2EnvironmentCompleted,
};
static const ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandler = {
&EPWeather_ICoreWebView2CreateCoreWebView2EnvironmentCompletedHandlerVtbl
};
static const ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_CreateCoreWebView2ControllerCompleted,
};
static const ICoreWebView2CreateCoreWebView2ControllerCompletedHandler EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandler = {
&EPWeather_ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVtbl
};
static const ICoreWebView2NavigationCompletedEventHandlerVtbl EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_NavigationCompleted,
};
static const ICoreWebView2NavigationCompletedEventHandler EPWeather_ICoreWebView2NavigationCompletedEventHandler = {
&EPWeather_ICoreWebView2NavigationCompletedEventHandlerVtbl
};
static const ICoreWebView2ExecuteScriptCompletedHandlerVtbl EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.Invoke = ICoreWebView2_ExecuteScriptCompleted,
};
static const ICoreWebView2ExecuteScriptCompletedHandler EPWeather_ICoreWebView2ExecuteScriptCompletedHandler = {
&EPWeather_ICoreWebView2ExecuteScriptCompletedHandlerVtbl
};
static const ICoreWebView2EnvironmentOptionsVtbl EPWeather_ICoreWebView2EnvironmentOptionsVtbl = {
.QueryInterface = epw_Weather_static_QueryInterface,
.AddRef = epw_Weather_static_AddRefRelease,
.Release = epw_Weather_static_AddRefRelease,
.get_AdditionalBrowserArguments = ICoreWebView2_get_AdditionalBrowserArguments,
.put_AdditionalBrowserArguments = epw_Weather_static_Stub,
.get_Language = ICoreWebView2_get_Language,
.put_Language = epw_Weather_static_Stub,
.get_TargetCompatibleBrowserVersion = ICoreWebView2_get_TargetCompatibleBrowserVersion,
.put_TargetCompatibleBrowserVersion = epw_Weather_static_Stub,
.get_AllowSingleSignOnUsingOSPrimaryAccount = ICoreWebView2_get_AllowSingleSignOnUsingOSPrimaryAccount,
.put_AllowSingleSignOnUsingOSPrimaryAccount = epw_Weather_static_Stub,
};
static const ICoreWebView2EnvironmentOptions EPWeather_ICoreWebView2EnvironmentOptions = {
&EPWeather_ICoreWebView2EnvironmentOptionsVtbl
};
HRESULT STDMETHODCALLTYPE INetworkListManagerEvents_QueryInterface(void* _this, REFIID riid, void** ppv);
ULONG STDMETHODCALLTYPE INetworkListManagerEvents_AddRefRelease(void* _this);
HRESULT STDMETHODCALLTYPE INetworkListManagerEvents_ConnectivityChanged(void* _this, NLM_CONNECTIVITY newConnectivity);
static const INetworkListManagerEventsVtbl INetworkListManagerEvents_Vtbl = {
.QueryInterface = INetworkListManagerEvents_QueryInterface,
.AddRef = INetworkListManagerEvents_AddRefRelease,
.Release = INetworkListManagerEvents_AddRefRelease,
.ConnectivityChanged = INetworkListManagerEvents_ConnectivityChanged,
};
static const INetworkListManagerEvents INetworkListManagerEvents_Instance = {
.lpVtbl = &INetworkListManagerEvents_Vtbl,
};
#endif

View File

@ -0,0 +1,100 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "VALINET Solutions SRL"
VALUE "FileDescription", "ExplorerPatcher Weather Host"
VALUE "FileVersion", "1.0.0.0"
VALUE "InternalName", "ep_weather_host.exe"
VALUE "LegalCopyright", "Copyright (C) 2006-2022 VALINET Solutions SRL. All rights reserved."
VALUE "OriginalFilename", "ep_weather_host.exe"
VALUE "ProductName", "ExplorerPatcher"
VALUE "ProductVersion", "1.0.0.0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,183 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{314a50c1-f0a0-4d0c-89e1-ad8f3951043e}</ProjectGuid>
<RootNamespace>epweatherhost</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="ep_weather.c" />
<ClCompile Include="ep_weather_factory.c" />
<ClCompile Include="ep_weather_host.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\ep_weather_host_stub\ep_weather_host_h.h" />
<ClInclude Include="ep_weather.h" />
<ClInclude Include="ep_weather_factory.h" />
<ClInclude Include="ep_weather_host.h" />
<ClInclude Include="ep_weather_provider_google_html.h" />
<ClInclude Include="ep_weather_provider_google_script.h" />
<ClInclude Include="ep_weather_utility.h" />
<ClInclude Include="resource.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ep_weather_host.rc" />
</ItemGroup>
<ItemGroup>
<Midl Include="..\ep_weather_host_stub\ep_weather_host.idl" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.1072.54\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.1072.54\build\native\Microsoft.Web.WebView2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.1072.54\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.1072.54\build\native\Microsoft.Web.WebView2.targets'))" />
</Target>
</Project>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ep_weather_host.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ep_weather_factory.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ep_weather.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather_factory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather_host.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ep_weather_host_stub\ep_weather_host_h.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather_utility.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather_provider_google_script.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ep_weather_provider_google_html.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="ep_weather_host.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Midl Include="..\ep_weather_host_stub\ep_weather_host.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,51 @@
#ifndef _H_EP_WEATHER_PROVIDER_GOOGLE_HTML_H_
#define _H_EP_WEATHER_PROVIDER_GOOGLE_HTML_H_
#include <Windows.h>
#define EP_WEATHER_PROVIDER_GOOGLE_HTML_LEN 2000
LPCWSTR ep_weather_provider_google_html = L"\
<!DOCTYPE html>\n\
<html lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n\
<head>\n\
<meta charset=\"utf-8\" />\n\
<title>Weather</title>\n\
<style>\n\
html {\n\
background-color: transparent !important;\n\
}\n\
.google-weather-place {\n\
width: calc(655px); height: calc(370px);\n\
}\n\
.google-weather-crop {\n\
width: calc(655px); height: calc(370px);\n\
overflow: hidden;\n\
transition: 0.3s; \n\
position: absolute;\n\
}\n\
.google-weather-crop:hover {\n\
width: 655px; height: 370px;\n\
}\n\
.google-weather {\n\
position: relative;\n\
left: -180px; top: -180px;\n\
width: 2560px; height: 5120px;\n\
transform: scale(1.0);\n\
transform-origin: 180px 180px;\n\
transition: 0.3s;\n\
position: absolute;\n\
}\n\
.google-weather:hover { \n\
transform: scale(1); \n\
z-index: 1000; \n\
}\n\
</style>\n\
</head>\n\
<body>\n\
<div class=\"google-weather-place\">\n\
<div class=\"google-weather-crop\">\n\
<iframe id=\"frame\" allowtransparency=\"true\" class=\"google-weather\" src=\"https://www.google.com/search?igu=1&amp;hl=%s&amp;q=weather%s%s\">\n\
</iframe>\n\
</div>\n\
</div>\n\
</body>\n\
</html>";
#endif

View File

@ -0,0 +1,93 @@
#ifndef _H_EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_H_
#define _H_EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_H_
#include <Windows.h>
// many thanks to https://stackoverflow.com/questions/23202966/google-weather-widget-on-my-website
#define EP_WEATHER_PROVIDER_GOOGLE_SCRIPT_LEN 4000
LPCWSTR ep_weather_provider_google_script = L"\
function ep_weather_utf8ToHex(str) {\n\
return Array.from(str).map(c => \n\
c.charCodeAt(0) < 128 ? c.charCodeAt(0).toString(16) : \n\
encodeURIComponent(c).replace(/\\%%/g,'').toLowerCase()\n\
).join('');\n\
}\n\
function ep_weather_drawImageToCanvas(image) {\n\
const canvas = document.createElement('canvas');\n\
const w = image.width;\n\
const h = image.height;\n\
canvas.width = w;\n\
canvas.height = h;\n\
canvas.getContext('2d').drawImage(image, 0, 0);\n\
return canvas;\n\
}\n\
function ep_weather_toHexString (byteArray) {\n\
//const chars = new Buffer(byteArray.length * 2);\n\
const chars = new Uint8Array(byteArray.length * 2);\n\
const alpha = 'a'.charCodeAt(0) - 10;\n\
const digit = '0'.charCodeAt(0);\n\
\n\
let p = 0;\n\
for (let i = 0; i < byteArray.length; i++) {\n\
let nibble = byteArray[i] >>> 4;\n\
chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;\n\
nibble = byteArray[i] & 0xF;\n\
chars[p++] = nibble > 9 ? nibble + alpha : nibble + digit;\n\
}\n\
\n\
//return chars.toString('utf8');\n\
return String.fromCharCode.apply(null, chars);\n\
}\n\
function ep_weather_getData(imageBitmap, ch) {\n\
const canvas = ep_weather_drawImageToCanvas(imageBitmap);\n\
const ctx = canvas.getContext('2d');\n\
\n\
let result = [];\n\
for (let y = 0; y < canvas.height; y++) {\n\
for (let x = 0; x < canvas.width; x++) {\n\
let data = ctx.getImageData(x, y, 1, 1).data;\n\
result.push(data[2] * data[3] / 255);\n\
result.push(data[1] * data[3] / 255);\n\
result.push(data[0] * data[3] / 255);\n\
result.push(data[3]);\n\
}\n\
}\n\
let res = (\n\
document.getElementById(\"frame\").contentWindow.document.getElementById(ch.includes('x') ? \"wob_ttm\" : \"wob_tm\").innerText + \"#\" + \n\
Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t').filter(e => !e.style.display.toString().includes(\"none\"))[0].innerText + \"#\" + \n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"wob_tci\").alt + \"#\" + \n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"wob_loc\").innerText + \"#\" + \n\
ep_weather_toHexString(result)\n\
);\n\
console.log(res);\n\
document.body.style.backgroundColor='transparent';\n\
document.getElementById(\"frame\").contentWindow.document.body.style.backgroundColor='transparent';\n\
return res;\n\
}\n\
var ep_result;\n\
let unit = Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('span')).filter(e => e.className == 'wob_t')[0].innerText;\n\
let p = '%c';\n\
if (!unit.includes(p)) {\n\
Array.from(document.getElementById(\"frame\").contentWindow.document.getElementsByClassName('wob-unit')[0].getElementsByTagName('a')).filter(e => e.className == 'wob_t').filter(e => e.innerText.includes(p))[0].click();\n\
unit = 'x';\n\
}\n\
createImageBitmap(\n\
document.getElementById(\"frame\").contentWindow.document.getElementById('wob_tci'), \n\
{ resizeWidth: %d, resizeHeight: %d, resizeQuality: 'high' }\n\
)\n\
.then(imageBitmap => \n\
ep_result = ep_weather_getData(imageBitmap, unit)\n\
);\n\
function ep_weather_part1() {\n\
return \"run_part_2\";\n\
}\n\
ep_weather_part1();\n\
";
LPCWSTR ep_weather_provider_google_script2 = L"\
function ep_weather_part2() {\n\
document.getElementById(\"frame\").contentWindow.document.getElementsByClassName(\"KFFQ0c\")[0].style.display = 'none';\n\
document.getElementById(\"frame\").contentWindow.document.getElementById(\"search\").scrollIntoView(true);\n\
return ep_result;\n\
}\n\
ep_weather_part2();\n\
";
#endif

View File

@ -0,0 +1,34 @@
#ifndef _H_EP_WEATHER_UTILITY_H_
#define _H_EP_WEATHER_UTILITY_H_
#include <Windows.h>
#include <stdint.h>
inline void QueryVersionInfo(HMODULE hModule, WORD Resource, DWORD* dwLeftMost, DWORD* dwSecondLeft, DWORD* dwSecondRight, DWORD* dwRightMost)
{
HRSRC hResInfo;
DWORD dwSize;
HGLOBAL hResData;
LPVOID pRes, pResCopy;
UINT uLen;
VS_FIXEDFILEINFO* lpFfi;
hResInfo = FindResource(hModule, MAKEINTRESOURCE(Resource), RT_VERSION);
dwSize = SizeofResource(hModule, hResInfo);
hResData = LoadResource(hModule, hResInfo);
pRes = LockResource(hResData);
pResCopy = LocalAlloc(LMEM_FIXED, dwSize);
CopyMemory(pResCopy, pRes, dwSize);
FreeResource(hResData);
VerQueryValue(pResCopy, TEXT("\\"), (LPVOID*)&lpFfi, &uLen);
DWORD dwFileVersionMS = lpFfi->dwFileVersionMS;
DWORD dwFileVersionLS = lpFfi->dwFileVersionLS;
*dwLeftMost = HIWORD(dwFileVersionMS);
*dwSecondLeft = LOWORD(dwFileVersionMS);
*dwSecondRight = HIWORD(dwFileVersionLS);
*dwRightMost = LOWORD(dwFileVersionLS);
LocalFree(pResCopy);
}
#endif

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.WebView2" version="1.0.1072.54" targetFramework="native" />
</packages>

View File

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ep_weather_host.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@ -0,0 +1,61 @@
import "oaidl.idl";
import "ocidl.idl";
import "unknwn.idl";
[
object,
uuid(CDBF3734-F847-4F1B-B953-A605434DC1E7),
oleautomation,
helpstring("ExplorerPatcher Weather Information")
] interface IEPWeather : IUnknown
{
HRESULT About([in] HWND hWnd);
HRESULT Initialize([in] WCHAR wszName[260], [in] BOOL bAllocConsole, [in] LONG64 dwProvider, [in] LONG64 cbx, [in] LONG64 cby, [in] LONG64 dwTemperatureUnit, [in] LONG64 dwUpdateSchedule, [in] double dpi);
HRESULT Show();
HRESULT Hide();
HRESULT GetWindowHandle([out] HWND* phWnd);
HRESULT LockData();
HRESULT GetDataSizes(
[out] LPDWORD pcbTemperature,
[out] LPDWORD pcbUnit,
[out] LPDWORD pcbCondition,
[out] LPDWORD pcbImage
);
HRESULT GetData(
[in] DWORD cbTemperature,
[out, size_is(cbTemperature)] BYTE* wszTemperature,
[in] DWORD cbUnit,
[ out, size_is(cbUnit)] BYTE* wszUnit,
[in] DWORD cbCondition,
[out, size_is(cbCondition)] BYTE* wszCondition,
[in] DWORD cbImage,
[out, size_is(cbImage)] BYTE* pImage
);
HRESULT UnlockData();
HRESULT SetNotifyWindow([in] HWND hWndNotify);
HRESULT IsInitialized([out] BOOL* bIsInitialized);
HRESULT GetTitle([in] DWORD cbTitle, [out, size_is(cbTitle)] BYTE* wszTitle, [in] DWORD dwType);
HRESULT SetTemperatureUnit([in] LONG64 dwTemperatureUnit);
HRESULT SetTerm([in] DWORD cbTerm, [in, size_is(cbTerm)] BYTE* wszTerm);
HRESULT SetLanguage([in] DWORD cblanguage, [in, size_is(cblanguage)] BYTE* wszLanguage);
HRESULT SetUpdateSchedule([in] LONG64 dwUpdateSchedule);
HRESULT SetIconSize([in] LONG64 cbx, [in] LONG64 cby);
HRESULT GetIconSize([out] LONG64* cbx, [out] LONG64* cby);
};

View File

@ -0,0 +1,6 @@
LIBRARY ep_weather_host_stub.dll
DESCRIPTION 'ExplorerPatcher Weather Stub DLL'
EXPORTS DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{af02abac-eaeb-471c-9957-73d430b8b4de}</ProjectGuid>
<RootNamespace>epweatherhoststub</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\build\$(Configuration)</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>ep_weather_host_stub.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Midl Include="ep_weather_host.idl" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="dlldata.c">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile Include="ep_weather_host_i.c" />
<ClCompile Include="ep_weather_host_p.c">
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">REGISTER_PROXY_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ep_weather_host_h.h" />
</ItemGroup>
<ItemGroup>
<None Include="ep_weather_host_stub.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Midl Include="ep_weather_host.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dlldata.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ep_weather_host_i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ep_weather_host_p.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ep_weather_host_h.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ep_weather_host_stub.def">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>

@ -1 +1 @@
Subproject commit ebbdacbcabd8e0a50c470f07ccf3796d01f7324a
Subproject commit a3e51eb335f2421d137cc9bb89ec10ca54103dd1

View File

@ -1,7 +1,7 @@
#define VER_MAJOR 22000
#define VER_MINOR 469
#define VER_BUILD_HI 41
#define VER_BUILD_LO 16
#define VER_BUILD_HI 42
#define VER_BUILD_LO 0
#define VER_FLAGS VS_FF_PRERELEASE
@ -12,5 +12,5 @@
#define VER_STR(arg) #arg
// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22000.469.41.16"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.469.41.16"
#define VER_FILE_STRING VALUE "FileVersion", "22000.469.42.0"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22000.469.42.0"