8 Commits

74 changed files with 82 additions and 9371 deletions

View File

@@ -1,38 +0,0 @@
name: WUIsBack Nightly AutoBuilder
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- name: Download repository
uses: actions/checkout@v3
- name: Install NSIS
run: |
iwr -useb get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -RunAsAdmin
scoop update
scoop bucket add extras
scoop install nsis
- name: Download latest DLL
run: |
md .\Release
md .\x64\Release
md .\launcher\obj
iwr https://ftp.vichingo455.freeddns.org/pub/WUIsBack/.github/LegacyUpdate32.dll -outfile '.\Release\LegacyUpdate.dll'
iwr https://ftp.vichingo455.freeddns.org/pub/WUIsBack/.github/LegacyUpdate64.dll -outfile '.\x64\Release\LegacyUpdate.dll'
iwr https://ftp.vichingo455.freeddns.org/pub/WUIsBack/.github/LegacyUpdate32.exe -outfile '.\launcher\obj\LegacyUpdate32.exe'
iwr https://ftp.vichingo455.freeddns.org/pub/WUIsBack/.github/LegacyUpdate64.exe -outfile '.\launcher\obj\LegacyUpdate64.exe'
- name: Compile WUIsBack
run: |
makensis "setup\setup.nsi"
- name: Upload Nightly Build
uses: actions/upload-artifact@v4
with:
name: WUIsBack-nightly
path: setup/WUIsBack-latest.exe

3
.gitignore vendored
View File

@@ -120,3 +120,6 @@ ServiceFabricBackup/
*.msix
*.msm
*.msp
# VS Code
.vscode/

View File

@@ -1,13 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.LegacyUpdate.iml
/modules.xml
/contentModel.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT" />
<option name="description" value="" />
</component>
</project>

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="32" height="32" fill="none"><image xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAnYSURBVHgBlVdpbFzVFf7u22cfL7HHjkkcQpzYhCw1JBC3bGFLQA1QEK2gLCq/oD+qFlUtQkUt+dNWVZHKnwJCatUWaBGpWhFUmoaWCkJShyROYiBx4gTHdsbL7Ntbb899b8axnQbRJx+/O/Pm3vPd73zn3PMYPv+SOjo6jO7tqzv7H93yoB4zBtSQ1ispUlc6uwY7OtahS+0s9oStidcOTB784a5T+6Z/dcfueDyeKxQKZZpvkfHPc8Au5bi7u1vrevbZWweuPf8DWZO3NB5M5jtxMr0aUaOIzsQE3jq6Aw+sVPHUOg33vWlhbLKc5vn8geqBV57P7915pL+/vzA4OOgwxvgXAnD//ffLe4z+pR23bv3RLf2D3xKOGtdsuQWHPrsGpVocd2/4IyxXJ9N8ELIVp/1KKBZpSZOBlWpp8/QHL5feuOcV0zTP0/QambfYn7zY+XurHu+V+7+6a0vPx7enkhML+AurFaxoOYkQ3ePaLCTmYCTdg0Q4B5MzZMpxcHLBhElaVIlffr3Sva3bPvabIc/zKrSEjUUhkeaP96x6pBerNu9e0Tx75UD7aSQIn9YgiXOMj2zCuRNXI6WfgV2zYVctxNXzKJRDSMXPQVVrYDIPtiVxGjNoHet3JB7a/zx9s6q5uTm6yOccA8JLLPHYC28viZhXPNn7b0QVJ/BLjxxy7pFxz0KNKHZqFSRUF6ViKw6dXYnR6ctxvriU+FXBOK3v1sn2aFmXwmG0dOvLt3WWDr900HXdYp2JCwD6+vo09swHz7FwYsfdy45hc9OU/1Cs4RIEm3g1bQEoA1X6DKpbwgO9j6NVvRq7BkuwXfIoyUQ7LUcAmCeM+QAYFyCIFaO9x3H5uDxz4JTjOKVGKAQdbHL7T9awZOq74ov+SAUGfU17gUqTBaNwPLiWC6toopIpY/vKO2HI7VjZEsETm9vhFmeBagHcrlGknEAEUmN1cScgZJF1T3yHJ9f2JZPJ2HwNaMoVA0+jDmm8ZsCp68Sju+N6sEwbZqmGaq6MaztvwNLkdeQoCOUdVy7FIxvb4JYy8KpFcCcAwQV/lHlcZB+rA9GircamHz+Wy+WW0CdFzFeS9+5MSUp4e0MII6UmdCVCCOkFVD0Xe06ux7GxJGza5bYVKWztW4ayiQXXowM9KBFDb36cAY/QunI9FHUaLoBgUNquuZNGL5KJOBckdfVtNzNXifkxo2vCMrA3vRwFz0beNPHR2RQKGRspRceTN/WhZhsLnDdy6ts39WJdCzkrZYmJMjFhkWhdiPpDRahuQnVaOLzx+9fTKCkgSXL8sm1w6IkTrDY424lZW8KMVcPwVIxUX0GXnsPPv9ZLsbL8ChjSynMA5leynTs2ok2ugldz4CalPW1CgOAigzifmyF33DCgqqoAoEiM61cxm5YhYy5R5nk4PtWB0wVRA05jS/sQXnxwNVKJMCxHQ77SRBlhIB7KIRnOEqgL8YjqKn75wJcQsgrEQh6eSWBc2hn3FnAmhTqX27bdRB9UiXn6UkYM+GYRXTZHrqziT/u34cPja/HULQPobDKgU5Fp7NzjMgrVJHIExnL0BSERQJ+750qgkvdZ4I7pg2B1BsSNGckWWZYTQpYSc9WYv3uq48xiNIlAmESbZeKuvhuRCF1BtT9GmeRCZt5F8WfsovKODcub8cTNy4lVcu7YPqsiBJ7HAy2qiSQVpFA0GlUUbgciCXYGXzScBo+sb8d969v8702HUtNTEKP460qV6oqMsFaBLLn+go4XFNRSNUZOgvG9m5aibOn43T4SoyiNVJxETri+D9+fUiqVJMWtViYVFu4Q4pAoEzxKobiq0QQFv90/SWAEhaZfZHraw9i6oYuKkAlVnqumNPZwaGQI49kpcDkM022iY3k1OdJJFzKKNeZT74uRNuc5FZNCwIkFrni16oSrGB2SyFtFlFAFZUfF7w/WiBESEVVNz6ICU83itjXNGOhb5e9+8XV87DiOpIdhUA3RojreOpiC41CYuUqOme+Yi+3Tn1fL5sh5lRoXR/KqhWGPiogwTpuSHIWyQRTjMCQpAUltJWuBpCQpaUmMColRL18EQDFUGMkQwk1hhJJh3HvfX3DN5kEsWzFOTmVyDt984ZTPTdL/oqZptuSeP/R3bnuUsoG5AoRLILwQnagRAhKlWMeJzog4HaCRRsQ5sbiTkRQZCqWhGtGhRTSE4xxrN3yMrXf8DR2dE/7JJhgQYbAn9x6lOpCdmZmxpdzub7znmXbRswgAGbfEwUNxskRtEGxQR0AhkcSdgLnEkOBHWwRCHDayKkGmMEqkI0mEUw4OoenJFoq754fBF/XIG4epDmRpaAth5p3ZT1/1AVD6iVPPNQMgghm/rRQ/81mRUbE0OLZGACQ6TdgCAEwKjj82D9m+d7fArKhB/MVSU/uPsMrZERrmRFKIGeXKf3a+xE2r3ADBbddnQwDxWRGCdyT/gBFUpksRAqH6IOR5IZDJxK4bVzEfw9CBtbR7jkZLah3auVuSpDHh158nlrbHdo+6M4dfFih9HfiORTGqA7FFEVEpK3S/lNlUNc/lYhQOclpngTpn3wQTDQo+PdrjUy8KjPBvj+56z536cJDoFyK0fObEP9ERDQ8Pr0h8/cTrktG6HnVokizi6BNHZNUQUasIy9T3OVUIWh7/8jFIS2aRNjzYGoE0OLSQhmymDe/vuQ7jo6mgSSUv3KIu4A+XP0PKf3fZsmWnRkZG/EPEX356elokiEkCGJFTA7cwSY0KyEHueoGCKZfFzsumRGe/irKt48Y1aegtJczqNjyd+VkgBLjnzzeT845AG4HzfOkfD73glcf+Rfl/OpPJzBWS+W25684cnJadwlG5/Ss3MUmJzj0RfZ0ffzrv/UaGQkFV7s6NUwinTGR1D0xTqA+RcOLoGhyhuDeUwM1cvvLPh1+wz7//Dn38REgD894P5gPww2RPf5R20vveV5p6l0jhjlUX+ikRWwLBFH8aYypu3zgBvbWEDJXiQjGGV37xMEZPdM85d8bfGazs/eaveX74XXov+KSh/Hk+F76Y1EFYRNWsN/rqQWf68BBruapLMlpSwUMWZD/xGjUcfO+uY6jQKTky1oa3/no9KqWwv4hXOHW2euinr1cOPP2aZ+U+JOci7fKLnYtLwcWX+FGRlHoSY29nzLG3j+iXbVsvX3b7JrVtcz+0ZCvTE00rUiVDVESjxs1P9rdX00Mnzrj50XFz6GcfOMWzJ2mNs2QT9I45c+bMGROXeEm91MvpfIZEEyja6KSiKM1USkUjESMxqbIIOm2YxiKlSvQ8Tz1/NhKJZMrlsoj1/3wf/H8ANK5Gl19XIAIhBPN5LBZzybmTzWb9uomARf5FFv4vtN/QnyTNBIYAAAAASUVORK5CYII=" width="32" height="32"/></svg>

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders>
<Path>.</Path>
</attachedFolders>
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,37 +0,0 @@
{
"configurations": [
{
"name": "MinGW",
"includePath": [
"${workspaceFolder}/include",
"${workspaceFolder}/shared"
],
"compilerPath": "/usr/bin/i686-w64-mingw32-g++",
"cStandard": "c17",
"cppStandard": "c++11",
"intelliSenseMode": "windows-gcc-x86",
"compilerArgs": [
"-std=c++11",
"-mwindows",
"-municode",
"-s",
"-fPIE",
"-ffunction-sections",
"-fdata-sections",
"-fno-unwind-tables",
"-fno-asynchronous-unwind-tables",
"-fno-exceptions",
"-fno-rtti",
"-flto",
"-Wno-write-strings",
"-include stdafx.h"
],
"defines": [
"UNICODE",
"_UNICODE",
"_USRDLL"
]
}
],
"version": 4
}

View File

@@ -1,6 +0,0 @@
{
"files.associations": {
"*.rc": "cpp",
"*.idl": "cpp"
}
}

View File

@@ -1,8 +0,0 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.WinXP",
"Microsoft.VisualStudio.Component.VC.v141.ATL"
]
}

View File

@@ -1,37 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LegacyUpdate", "LegacyUpdate\LegacyUpdate.vcxproj", "{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug-VC08|Win32 = Debug-VC08|Win32
Debug-VC08|x64 = Debug-VC08|x64
Debug-VC17|Win32 = Debug-VC17|Win32
Debug-VC17|x64 = Debug-VC17|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC08|Win32.ActiveCfg = Debug-VC08|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC08|Win32.Build.0 = Debug-VC08|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC08|x64.ActiveCfg = Debug-VC17|x64
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC08|x64.Build.0 = Debug-VC17|x64
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC17|Win32.ActiveCfg = Debug-VC17|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC17|Win32.Build.0 = Debug-VC17|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC17|x64.ActiveCfg = Debug-VC17|x64
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Debug-VC17|x64.Build.0 = Debug-VC17|x64
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Release|Win32.ActiveCfg = Release|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Release|Win32.Build.0 = Release|Win32
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Release|x64.ActiveCfg = Release|x64
{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E11EF986-8512-4F69-B67C-C40CCB81052A}
EndGlobalSection
EndGlobal

View File

@@ -1,53 +0,0 @@
#include "stdafx.h"
#include <comdef.h>
#include "Utils.h"
#ifndef PROCESS_PER_MONITOR_DPI_AWARE
typedef int PROCESS_DPI_AWARENESS;
#define PROCESS_PER_MONITOR_DPI_AWARE 2
#endif
#ifndef DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2
typedef int DPI_AWARENESS_CONTEXT;
#define DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 ((DPI_AWARENESS_CONTEXT)-4)
#endif
typedef BOOL (WINAPI *_GetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD);
typedef BOOL (WINAPI *_SetProcessDpiAwarenessContext)(DPI_AWARENESS_CONTEXT);
typedef HRESULT (WINAPI *_SetProcessDpiAwareness)(PROCESS_DPI_AWARENESS);
typedef void (WINAPI *_SetProcessDPIAware)();
_GetProductInfo $GetProductInfo = (_GetProductInfo)GetProcAddress(GetModuleHandle(L"kernel32.dll"), "GetProductInfo");
BOOL GetVistaProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType) {
if ($GetProductInfo) {
return $GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion, dwSpMinorVersion, pdwReturnedProductType);
} else {
*pdwReturnedProductType = PRODUCT_UNDEFINED;
return FALSE;
}
}
void BecomeDPIAware() {
// Make the process DPI-aware... hopefully
// Windows 10 1703+ per-monitor v2
_SetProcessDpiAwarenessContext $SetProcessDpiAwarenessContext = (_SetProcessDpiAwarenessContext)GetProcAddress(LoadLibrary(L"user32.dll"), "SetProcessDpiAwarenessContext");
if ($SetProcessDpiAwarenessContext) {
$SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
return;
}
// Windows 8.1 - 10 1607 per-monitor v1
_SetProcessDpiAwareness $SetProcessDpiAwareness = (_SetProcessDpiAwareness)GetProcAddress(LoadLibrary(L"shcore.dll"), "SetProcessDpiAwareness");
if ($SetProcessDpiAwareness) {
$SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
return;
}
// Windows Vista - 8
_SetProcessDPIAware $SetProcessDPIAware = (_SetProcessDPIAware)GetProcAddress(LoadLibrary(L"user32.dll"), "SetProcessDPIAware");
if ($SetProcessDPIAware) {
$SetProcessDPIAware();
}
}

View File

@@ -1,4 +0,0 @@
#pragma once
BOOL GetVistaProductInfo(DWORD dwOSMajorVersion, DWORD dwOSMinorVersion, DWORD dwSpMajorVersion, DWORD dwSpMinorVersion, PDWORD pdwReturnedProductType);
void BecomeDPIAware();

View File

@@ -1,84 +0,0 @@
// ElevationHelper.cpp : Implementation of CElevationHelper
#include "stdafx.h"
#include "Compat.h"
#include "ElevationHelper.h"
#include "HResult.h"
#include "Utils.h"
#include <strsafe.h>
const BSTR permittedProgIDs[] = {
L"Microsoft.Update.",
NULL
};
BOOL ProgIDIsPermitted(PWSTR progID) {
if (progID == NULL) {
return FALSE;
}
for (int i = 0; permittedProgIDs[i] != NULL; i++) {
if (wcsncmp(progID, permittedProgIDs[i], wcslen(permittedProgIDs[i])) == 0) {
return TRUE;
}
}
return FALSE;
}
STDMETHODIMP CoCreateInstanceAsAdmin(HWND hwnd, __in REFCLSID rclsid, __in REFIID riid, __deref_out void **ppv) {
WCHAR clsidString[45];
StringFromGUID2(rclsid, clsidString, ARRAYSIZE(clsidString));
WCHAR monikerName[75];
HRESULT hr = StringCchPrintf(monikerName, ARRAYSIZE(monikerName), L"Elevation:Administrator!new:%s", clsidString);
if (!SUCCEEDED(hr)) {
return hr;
}
BIND_OPTS3 bindOpts;
memset(&bindOpts, 0, sizeof(bindOpts));
bindOpts.cbStruct = sizeof(bindOpts);
bindOpts.hwnd = hwnd;
bindOpts.dwClassContext = CLSCTX_LOCAL_SERVER;
return CoGetObject(monikerName, &bindOpts, riid, ppv);
}
CElevationHelper::CElevationHelper() {
BecomeDPIAware();
}
STDMETHODIMP CElevationHelper::CreateObject(BSTR progID, IDispatch **retval) {
if (progID == NULL) {
return E_INVALIDARG;
}
HRESULT hr = S_OK;
CComPtr<IDispatch> object;
if (!ProgIDIsPermitted(progID)) {
hr = E_ACCESSDENIED;
goto end;
}
CLSID clsid;
hr = CLSIDFromProgID(progID, &clsid);
if (!SUCCEEDED(hr)) {
goto end;
}
hr = object.CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER);
if (!SUCCEEDED(hr)) {
goto end;
}
*retval = object.Detach();
end:
if (!SUCCEEDED(hr)) {
TRACE("CreateObject(%ls) failed: %ls\n", progID, GetMessageForHresult(hr));
}
return hr;
}
STDMETHODIMP CElevationHelper::Reboot(void) {
return ::Reboot();
}

View File

@@ -1,45 +0,0 @@
#pragma once
// ElevationHelper.h : Declaration of the CElevationHelper class.
#include <atlctl.h>
#include "resource.h"
#include "LegacyUpdate_i.h"
BOOL ProgIDIsPermitted(PWSTR progID);
STDMETHODIMP CoCreateInstanceAsAdmin(HWND hwnd, __in REFCLSID rclsid, __in REFIID riid, __deref_out void **ppv);
// CElevationHelper
class ATL_NO_VTABLE CElevationHelper :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CElevationHelper, &CLSID_ElevationHelper>,
public ISupportErrorInfo,
public IDispatchImpl<IElevationHelper, &IID_IElevationHelper, &LIBID_LegacyUpdateLib, /*wMajor =*/ 1, /*wMinor =*/ 0> {
public:
CElevationHelper();
DECLARE_REGISTRY_RESOURCEID(IDR_ELEVATIONHELPER)
BEGIN_COM_MAP(CElevationHelper)
COM_INTERFACE_ENTRY(IElevationHelper)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) {
return IsEqualGUID(riid, IID_IElevationHelper) ? S_OK : S_FALSE;
}
// IElevationHelper
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct() { return S_OK; }
void FinalRelease() {}
STDMETHODIMP CreateObject(BSTR progID, IDispatch **retval);
STDMETHODIMP Reboot(void);
};
OBJECT_ENTRY_AUTO(__uuidof(ElevationHelper), CElevationHelper)

View File

@@ -1,31 +0,0 @@
HKCR
{
LegacyUpdate.ElevationHelper.1 = s 'Legacy Update Elevation Helper'
{
CLSID = s '{84F517AD-6438-478F-BEA8-F0B808DC257F}'
}
LegacyUpdate.ElevationHelper = s 'Legacy Update Elevation Helper'
{
CurVer = s 'LegacyUpdate.ElevationHelper.1'
}
NoRemove CLSID
{
ForceRemove {84F517AD-6438-478F-BEA8-F0B808DC257F} = s 'Legacy Update Elevation Helper'
{
ProgID = s 'LegacyUpdate.ElevationHelper.1'
VersionIndependentProgID = s 'LegacyUpdate.ElevationHelper'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
val AppID = s '%APPID%'
val LocalizedString = s '@%MODULE%,-1'
TypeLib = s '{05D22F33-C7C3-4C90-BDD9-CEDC86EA8FBE}'
Version = s '1.0'
Elevation
{
val Enabled = d '1'
}
}
}
}

View File

@@ -1,650 +0,0 @@
#pragma once
#include <wuapi.h>
// Copied from wuapi.h in Windows SDK 10.0.19041.0
#ifndef __IUpdateInstaller3_FWD_DEFINED__
#define __IUpdateInstaller3_FWD_DEFINED__
typedef interface IUpdateInstaller3 IUpdateInstaller3;
#endif /* __IUpdateInstaller3_FWD_DEFINED__ */
#ifndef __IUpdateInstaller4_FWD_DEFINED__
#define __IUpdateInstaller4_FWD_DEFINED__
typedef interface IUpdateInstaller4 IUpdateInstaller4;
#endif /* __IUpdateInstaller4_FWD_DEFINED__ */
// {16d11c35-099a-48d0-8338-5fae64047f8e}
DEFINE_GUID(IID_IUpdateInstaller3,0x16d11c35,0x099a,0x48d0,0x83,0x38,0x5f,0xae,0x64,0x04,0x7f,0x8e);
// {EF8208EA-2304-492D-9109-23813B0958E1}
DEFINE_GUID(IID_IUpdateInstaller4, 0xef8208ea, 0x2304, 0x492d, 0x91, 0x9, 0x23, 0x81, 0x3b, 0x9, 0x58, 0xe1);
#ifndef __IUpdateInstaller3_INTERFACE_DEFINED__
#define __IUpdateInstaller3_INTERFACE_DEFINED__
/* interface IUpdateInstaller3 */
/* [hidden][unique][uuid][nonextensible][dual][oleautomation][object][helpstring] */
EXTERN_C const IID IID_IUpdateInstaller3;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("16d11c35-099a-48d0-8338-5fae64047f8e")
IUpdateInstaller3 : public IUpdateInstaller2
{
public:
virtual /* [helpstring][propget][id] */ HRESULT STDMETHODCALLTYPE get_AttemptCloseAppsIfNecessary(
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval) = 0;
virtual /* [helpstring][propput][id] */ HRESULT STDMETHODCALLTYPE put_AttemptCloseAppsIfNecessary(
/* [in] */ VARIANT_BOOL value) = 0;
};
#else /* C style interface */
typedef struct IUpdateInstaller3Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IUpdateInstaller3 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IUpdateInstaller3 * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in IUpdateInstaller3 * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IUpdateInstaller3 * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ClientApplicationID )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ClientApplicationID )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in BSTR value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_IsForced )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_IsForced )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][restricted][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ParentHwnd )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt HWND *retval);
/* [helpstring][restricted][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ParentHwnd )(
__RPC__in IUpdateInstaller3 * This,
/* [unique][in] */ __RPC__in_opt HWND value);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ParentWindow )(
__RPC__in IUpdateInstaller3 * This,
/* [unique][in] */ __RPC__in_opt IUnknown *value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ParentWindow )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt IUnknown **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Updates )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt IUpdateCollection **retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Updates )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in_opt IUpdateCollection *value);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *BeginInstall )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in_opt IUnknown *onProgressChanged,
/* [in] */ __RPC__in_opt IUnknown *onCompleted,
/* [in] */ VARIANT state,
/* [retval][out] */ __RPC__deref_out_opt IInstallationJob **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *BeginUninstall )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in_opt IUnknown *onProgressChanged,
/* [in] */ __RPC__in_opt IUnknown *onCompleted,
/* [in] */ VARIANT state,
/* [retval][out] */ __RPC__deref_out_opt IInstallationJob **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EndInstall )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in_opt IInstallationJob *value,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EndUninstall )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ __RPC__in_opt IInstallationJob *value,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Install )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RunWizard )(
__RPC__in IUpdateInstaller3 * This,
/* [defaultvalue][unique][in] */ __RPC__in_opt BSTR dialogTitle,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_IsBusy )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Uninstall )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AllowSourcePrompts )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AllowSourcePrompts )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_RebootRequiredBeforeInstallation )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ForceQuiet )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ForceQuiet )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AttemptCloseAppsIfNecessary )(
__RPC__in IUpdateInstaller3 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AttemptCloseAppsIfNecessary )(
__RPC__in IUpdateInstaller3 * This,
/* [in] */ VARIANT_BOOL value);
END_INTERFACE
} IUpdateInstaller3Vtbl;
interface IUpdateInstaller3
{
CONST_VTBL struct IUpdateInstaller3Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IUpdateInstaller3_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IUpdateInstaller3_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IUpdateInstaller3_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IUpdateInstaller3_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IUpdateInstaller3_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IUpdateInstaller3_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IUpdateInstaller3_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IUpdateInstaller3_get_ClientApplicationID(This,retval) \
( (This)->lpVtbl -> get_ClientApplicationID(This,retval) )
#define IUpdateInstaller3_put_ClientApplicationID(This,value) \
( (This)->lpVtbl -> put_ClientApplicationID(This,value) )
#define IUpdateInstaller3_get_IsForced(This,retval) \
( (This)->lpVtbl -> get_IsForced(This,retval) )
#define IUpdateInstaller3_put_IsForced(This,value) \
( (This)->lpVtbl -> put_IsForced(This,value) )
#define IUpdateInstaller3_get_ParentHwnd(This,retval) \
( (This)->lpVtbl -> get_ParentHwnd(This,retval) )
#define IUpdateInstaller3_put_ParentHwnd(This,value) \
( (This)->lpVtbl -> put_ParentHwnd(This,value) )
#define IUpdateInstaller3_put_ParentWindow(This,value) \
( (This)->lpVtbl -> put_ParentWindow(This,value) )
#define IUpdateInstaller3_get_ParentWindow(This,retval) \
( (This)->lpVtbl -> get_ParentWindow(This,retval) )
#define IUpdateInstaller3_get_Updates(This,retval) \
( (This)->lpVtbl -> get_Updates(This,retval) )
#define IUpdateInstaller3_put_Updates(This,value) \
( (This)->lpVtbl -> put_Updates(This,value) )
#define IUpdateInstaller3_BeginInstall(This,onProgressChanged,onCompleted,state,retval) \
( (This)->lpVtbl -> BeginInstall(This,onProgressChanged,onCompleted,state,retval) )
#define IUpdateInstaller3_BeginUninstall(This,onProgressChanged,onCompleted,state,retval) \
( (This)->lpVtbl -> BeginUninstall(This,onProgressChanged,onCompleted,state,retval) )
#define IUpdateInstaller3_EndInstall(This,value,retval) \
( (This)->lpVtbl -> EndInstall(This,value,retval) )
#define IUpdateInstaller3_EndUninstall(This,value,retval) \
( (This)->lpVtbl -> EndUninstall(This,value,retval) )
#define IUpdateInstaller3_Install(This,retval) \
( (This)->lpVtbl -> Install(This,retval) )
#define IUpdateInstaller3_RunWizard(This,dialogTitle,retval) \
( (This)->lpVtbl -> RunWizard(This,dialogTitle,retval) )
#define IUpdateInstaller3_get_IsBusy(This,retval) \
( (This)->lpVtbl -> get_IsBusy(This,retval) )
#define IUpdateInstaller3_Uninstall(This,retval) \
( (This)->lpVtbl -> Uninstall(This,retval) )
#define IUpdateInstaller3_get_AllowSourcePrompts(This,retval) \
( (This)->lpVtbl -> get_AllowSourcePrompts(This,retval) )
#define IUpdateInstaller3_put_AllowSourcePrompts(This,value) \
( (This)->lpVtbl -> put_AllowSourcePrompts(This,value) )
#define IUpdateInstaller3_get_RebootRequiredBeforeInstallation(This,retval) \
( (This)->lpVtbl -> get_RebootRequiredBeforeInstallation(This,retval) )
#define IUpdateInstaller3_get_ForceQuiet(This,retval) \
( (This)->lpVtbl -> get_ForceQuiet(This,retval) )
#define IUpdateInstaller3_put_ForceQuiet(This,value) \
( (This)->lpVtbl -> put_ForceQuiet(This,value) )
#define IUpdateInstaller3_get_AttemptCloseAppsIfNecessary(This,retval) \
( (This)->lpVtbl -> get_AttemptCloseAppsIfNecessary(This,retval) )
#define IUpdateInstaller3_put_AttemptCloseAppsIfNecessary(This,value) \
( (This)->lpVtbl -> put_AttemptCloseAppsIfNecessary(This,value) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IUpdateInstaller3_INTERFACE_DEFINED__ */
#ifndef __IUpdateInstaller4_INTERFACE_DEFINED__
#define __IUpdateInstaller4_INTERFACE_DEFINED__
/* interface IUpdateInstaller4 */
/* [hidden][unique][uuid][nonextensible][dual][oleautomation][object][helpstring] */
EXTERN_C const IID IID_IUpdateInstaller4;
#if defined(__cplusplus) && !defined(CINTERFACE)
MIDL_INTERFACE("EF8208EA-2304-492D-9109-23813B0958E1")
IUpdateInstaller4 : public IUpdateInstaller3
{
public:
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Commit(
/* [in] */ DWORD dwFlags) = 0;
};
#else /* C style interface */
typedef struct IUpdateInstaller4Vtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in REFIID riid,
/* [annotation][iid_is][out] */
_COM_Outptr_ void **ppvObject);
ULONG ( STDMETHODCALLTYPE *AddRef )(
__RPC__in IUpdateInstaller4 * This);
ULONG ( STDMETHODCALLTYPE *Release )(
__RPC__in IUpdateInstaller4 * This);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfoCount )(
__RPC__in IUpdateInstaller4 * This,
/* [out] */ __RPC__out UINT *pctinfo);
HRESULT ( STDMETHODCALLTYPE *GetTypeInfo )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ UINT iTInfo,
/* [in] */ LCID lcid,
/* [out] */ __RPC__deref_out_opt ITypeInfo **ppTInfo);
HRESULT ( STDMETHODCALLTYPE *GetIDsOfNames )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in REFIID riid,
/* [size_is][in] */ __RPC__in_ecount_full(cNames) LPOLESTR *rgszNames,
/* [range][in] */ __RPC__in_range(0,16384) UINT cNames,
/* [in] */ LCID lcid,
/* [size_is][out] */ __RPC__out_ecount_full(cNames) DISPID *rgDispId);
/* [local] */ HRESULT ( STDMETHODCALLTYPE *Invoke )(
IUpdateInstaller4 * This,
/* [annotation][in] */
_In_ DISPID dispIdMember,
/* [annotation][in] */
_In_ REFIID riid,
/* [annotation][in] */
_In_ LCID lcid,
/* [annotation][in] */
_In_ WORD wFlags,
/* [annotation][out][in] */
_In_ DISPPARAMS *pDispParams,
/* [annotation][out] */
_Out_opt_ VARIANT *pVarResult,
/* [annotation][out] */
_Out_opt_ EXCEPINFO *pExcepInfo,
/* [annotation][out] */
_Out_opt_ UINT *puArgErr);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ClientApplicationID )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt BSTR *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ClientApplicationID )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in BSTR value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_IsForced )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_IsForced )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][restricted][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ParentHwnd )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt HWND *retval);
/* [helpstring][restricted][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ParentHwnd )(
__RPC__in IUpdateInstaller4 * This,
/* [unique][in] */ __RPC__in_opt HWND value);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ParentWindow )(
__RPC__in IUpdateInstaller4 * This,
/* [unique][in] */ __RPC__in_opt IUnknown *value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ParentWindow )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt IUnknown **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_Updates )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt IUpdateCollection **retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_Updates )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in_opt IUpdateCollection *value);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *BeginInstall )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in_opt IUnknown *onProgressChanged,
/* [in] */ __RPC__in_opt IUnknown *onCompleted,
/* [in] */ VARIANT state,
/* [retval][out] */ __RPC__deref_out_opt IInstallationJob **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *BeginUninstall )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in_opt IUnknown *onProgressChanged,
/* [in] */ __RPC__in_opt IUnknown *onCompleted,
/* [in] */ VARIANT state,
/* [retval][out] */ __RPC__deref_out_opt IInstallationJob **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EndInstall )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in_opt IInstallationJob *value,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *EndUninstall )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ __RPC__in_opt IInstallationJob *value,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Install )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *RunWizard )(
__RPC__in IUpdateInstaller4 * This,
/* [defaultvalue][unique][in] */ __RPC__in_opt BSTR dialogTitle,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_IsBusy )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Uninstall )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__deref_out_opt IInstallationResult **retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AllowSourcePrompts )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AllowSourcePrompts )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_RebootRequiredBeforeInstallation )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_ForceQuiet )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_ForceQuiet )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][propget][id] */ HRESULT ( STDMETHODCALLTYPE *get_AttemptCloseAppsIfNecessary )(
__RPC__in IUpdateInstaller4 * This,
/* [retval][out] */ __RPC__out VARIANT_BOOL *retval);
/* [helpstring][propput][id] */ HRESULT ( STDMETHODCALLTYPE *put_AttemptCloseAppsIfNecessary )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ VARIANT_BOOL value);
/* [helpstring][id] */ HRESULT ( STDMETHODCALLTYPE *Commit )(
__RPC__in IUpdateInstaller4 * This,
/* [in] */ DWORD dwFlags);
END_INTERFACE
} IUpdateInstaller4Vtbl;
interface IUpdateInstaller4
{
CONST_VTBL struct IUpdateInstaller4Vtbl *lpVtbl;
};
#ifdef COBJMACROS
#define IUpdateInstaller4_QueryInterface(This,riid,ppvObject) \
( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) )
#define IUpdateInstaller4_AddRef(This) \
( (This)->lpVtbl -> AddRef(This) )
#define IUpdateInstaller4_Release(This) \
( (This)->lpVtbl -> Release(This) )
#define IUpdateInstaller4_GetTypeInfoCount(This,pctinfo) \
( (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) )
#define IUpdateInstaller4_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \
( (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) )
#define IUpdateInstaller4_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \
( (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) )
#define IUpdateInstaller4_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \
( (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) )
#define IUpdateInstaller4_get_ClientApplicationID(This,retval) \
( (This)->lpVtbl -> get_ClientApplicationID(This,retval) )
#define IUpdateInstaller4_put_ClientApplicationID(This,value) \
( (This)->lpVtbl -> put_ClientApplicationID(This,value) )
#define IUpdateInstaller4_get_IsForced(This,retval) \
( (This)->lpVtbl -> get_IsForced(This,retval) )
#define IUpdateInstaller4_put_IsForced(This,value) \
( (This)->lpVtbl -> put_IsForced(This,value) )
#define IUpdateInstaller4_get_ParentHwnd(This,retval) \
( (This)->lpVtbl -> get_ParentHwnd(This,retval) )
#define IUpdateInstaller4_put_ParentHwnd(This,value) \
( (This)->lpVtbl -> put_ParentHwnd(This,value) )
#define IUpdateInstaller4_put_ParentWindow(This,value) \
( (This)->lpVtbl -> put_ParentWindow(This,value) )
#define IUpdateInstaller4_get_ParentWindow(This,retval) \
( (This)->lpVtbl -> get_ParentWindow(This,retval) )
#define IUpdateInstaller4_get_Updates(This,retval) \
( (This)->lpVtbl -> get_Updates(This,retval) )
#define IUpdateInstaller4_put_Updates(This,value) \
( (This)->lpVtbl -> put_Updates(This,value) )
#define IUpdateInstaller4_BeginInstall(This,onProgressChanged,onCompleted,state,retval) \
( (This)->lpVtbl -> BeginInstall(This,onProgressChanged,onCompleted,state,retval) )
#define IUpdateInstaller4_BeginUninstall(This,onProgressChanged,onCompleted,state,retval) \
( (This)->lpVtbl -> BeginUninstall(This,onProgressChanged,onCompleted,state,retval) )
#define IUpdateInstaller4_EndInstall(This,value,retval) \
( (This)->lpVtbl -> EndInstall(This,value,retval) )
#define IUpdateInstaller4_EndUninstall(This,value,retval) \
( (This)->lpVtbl -> EndUninstall(This,value,retval) )
#define IUpdateInstaller4_Install(This,retval) \
( (This)->lpVtbl -> Install(This,retval) )
#define IUpdateInstaller4_RunWizard(This,dialogTitle,retval) \
( (This)->lpVtbl -> RunWizard(This,dialogTitle,retval) )
#define IUpdateInstaller4_get_IsBusy(This,retval) \
( (This)->lpVtbl -> get_IsBusy(This,retval) )
#define IUpdateInstaller4_Uninstall(This,retval) \
( (This)->lpVtbl -> Uninstall(This,retval) )
#define IUpdateInstaller4_get_AllowSourcePrompts(This,retval) \
( (This)->lpVtbl -> get_AllowSourcePrompts(This,retval) )
#define IUpdateInstaller4_put_AllowSourcePrompts(This,value) \
( (This)->lpVtbl -> put_AllowSourcePrompts(This,value) )
#define IUpdateInstaller4_get_RebootRequiredBeforeInstallation(This,retval) \
( (This)->lpVtbl -> get_RebootRequiredBeforeInstallation(This,retval) )
#define IUpdateInstaller4_get_ForceQuiet(This,retval) \
( (This)->lpVtbl -> get_ForceQuiet(This,retval) )
#define IUpdateInstaller4_put_ForceQuiet(This,value) \
( (This)->lpVtbl -> put_ForceQuiet(This,value) )
#define IUpdateInstaller4_get_AttemptCloseAppsIfNecessary(This,retval) \
( (This)->lpVtbl -> get_AttemptCloseAppsIfNecessary(This,retval) )
#define IUpdateInstaller4_put_AttemptCloseAppsIfNecessary(This,value) \
( (This)->lpVtbl -> put_AttemptCloseAppsIfNecessary(This,value) )
#define IUpdateInstaller4_Commit(This,dwFlags) \
( (This)->lpVtbl -> Commit(This,dwFlags) )
#endif /* COBJMACROS */
#endif /* C style interface */
#endif /* __IUpdateInstaller4_INTERFACE_DEFINED__ */

View File

@@ -1,36 +0,0 @@
#include "stdafx.h"
#include "Exec.h"
#include "HResult.h"
#include "LegacyUpdate.h"
#include <shellapi.h>
// Function signature required by Rundll32.exe.
void CALLBACK LaunchUpdateSite(HWND hwnd, HINSTANCE hInstance, LPSTR lpszCmdLine, int nCmdShow) {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
LPWSTR path;
if (!SUCCEEDED(hr)) {
goto end;
}
// This just calls LegacyUpdate.exe now for backwards compatibility.
hr = GetInstallPath(&path);
if (!SUCCEEDED(hr)) {
goto end;
}
PathAppend(path, L"LegacyUpdate.exe");
DWORD code;
hr = Exec(L"open", path, NULL, NULL, nCmdShow, TRUE, &code);
if (SUCCEEDED(hr)) {
hr = HRESULT_FROM_WIN32(code);
}
end:
if (!SUCCEEDED(hr)) {
MessageBox(NULL, GetMessageForHresult(hr), L"Legacy Update", MB_OK | MB_ICONERROR);
}
CoUninitialize();
}

View File

@@ -1,3 +0,0 @@
#pragma once
void CALLBACK LaunchUpdateSite(HWND hwnd, HINSTANCE hinstance, LPSTR lpszCmdLine, int nCmdShow);

View File

@@ -1,14 +0,0 @@
; LegacyUpdate.def : Declares the module parameters.
EXPORTS
; Registration
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
; Rundll32
LaunchUpdateSite PRIVATE
; Internal use
GetMessageForHresult

View File

@@ -1,126 +0,0 @@
// LegacyUpdate.idl : IDL source for LegacyUpdate
//
// This file will be processed by the MIDL tool to
// produce the type library (LegacyUpdate.tlb) and marshalling code.
#include <olectl.h>
#include <idispids.h>
import "oaidl.idl";
import "ocidl.idl";
import "wuapi.idl";
typedef enum OSVersionField {
e_majorVer = 0,
e_minorVer = 1,
e_buildNumber = 2,
e_platform = 3,
e_SPMajor = 4,
e_SPMinor = 5,
e_productSuite = 6,
e_productType = 7,
e_systemMetric = 8,
e_SPVersionString = 9,
e_controlVersionString = 10,
e_VistaProductType = 11,
e_productName = 12,
e_displayVersion = 13,
e_maxOSVersionFieldValue = 13
} OSVersionField;
typedef enum UserType {
e_nonAdmin = 0,
e_admin = 2,
e_elevated = 3
} UserType;
[
object,
uuid(C33085BB-C3E1-4D27-A214-AF01953DF5E5),
dual,
nonextensible,
helpstring("ILegacyUpdateCtrl Interface"),
pointer_default(unique)
]
interface ILegacyUpdateCtrl : IDispatch {
[id(1)] HRESULT CheckControl([out, retval] VARIANT_BOOL *retval);
[id(2)] HRESULT MessageForHresult(LONG inHresult, [out, retval] BSTR *retval);
[id(3)] HRESULT GetOSVersionInfo(OSVersionField osField, LONG systemMetric, [out, retval] VARIANT *retval);
[id(14)] HRESULT RequestElevation(void);
[id(4)] HRESULT CreateObject(BSTR progID, [out, retval] IDispatch **retval);
[id(15)] HRESULT SetBrowserHwnd(IUpdateInstaller *installer);
[id(5)] HRESULT GetUserType([out, retval] UserType *retval);
[id(8)] HRESULT RebootIfRequired(void);
[id(9)] HRESULT ViewWindowsUpdateLog(void);
[id(13)] HRESULT OpenWindowsUpdateSettings(void);
[id(6), propget] HRESULT IsRebootRequired([out, retval] VARIANT_BOOL *retval);
[id(7), propget] HRESULT IsWindowsUpdateDisabled([out, retval] VARIANT_BOOL *retval);
[id(10), propget] HRESULT IsUsingWsusServer([out, retval] VARIANT_BOOL *retval);
[id(11), propget] HRESULT WsusServerUrl([out, retval] BSTR *retval);
[id(12), propget] HRESULT WsusStatusServerUrl([out, retval] BSTR *retval);
};
[
object,
uuid(4524BFBF-70BD-4EAC-AD33-6BADA4FB0638),
dual,
nonextensible,
pointer_default(unique)
]
interface IProgressBarControl : IDispatch
{
[id(1), propget] HRESULT Value([out, retval] SHORT *retval);
[id(1), propput] HRESULT Value([in] SHORT newVal);
};
[
object,
uuid(3236E684-0E4B-4780-9F31-F1983F5AB78D),
dual,
nonextensible,
pointer_default(unique),
oleautomation
]
interface IElevationHelper : IDispatch
{
[id(1)] HRESULT CreateObject(BSTR progID, [out, retval] IDispatch **retval);
[id(2)] HRESULT Reboot(void);
};
[
uuid(05D22F33-C7C3-4C90-BDD9-CEDC86EA8FBE),
version(1.0),
helpstring("Legacy Update Control")
]
library LegacyUpdateLib {
importlib(STDOLE_TLB);
[
uuid(AD28E0DF-5F5A-40B5-9432-85EFD97D1F9F),
control,
helpstring("LegacyUpdateCtrl Class")
]
coclass LegacyUpdateCtrl {
[default] interface ILegacyUpdateCtrl;
};
[
uuid(7B875A2F-2DFB-4D38-91F5-5C0BFB74C377),
control,
helpstring("ProgressBarControl Class")
]
coclass ProgressBarControl
{
[default] interface IProgressBarControl;
};
[
uuid(84F517AD-6438-478F-BEA8-F0B808DC257F),
helpstring("ElevationHelper Class")
]
coclass ElevationHelper
{
[default] interface IElevationHelper;
};
};

View File

@@ -1,134 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#include "Version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#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(65001)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#ifndef APSTUDIO_INVOKED\r\n"
"#include ""targetver.h""\r\n"
"#endif\r\n"
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""LegacyUpdate.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_BUILD
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Hashbang Productions"
VALUE "FileDescription", "Legacy Update"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", "LegacyUpdate.dll"
VALUE "LegalCopyright", "© Hashbang Productions. All rights reserved."
VALUE "OriginalFilename", "LegacyUpdate.dll"
VALUE "ProductName", "Legacy Update"
VALUE "ProductVersion", VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_LEGACYUPDATEOCX REGISTRY "LegacyUpdate.rgs"
IDR_LEGACYUPDATECTRL REGISTRY "LegacyUpdateCtrl.rgs"
IDR_PROGRESSBARCONTROL REGISTRY "ProgressBarControl.rgs"
IDR_ELEVATIONHELPER REGISTRY "ElevationHelper.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_LEGACYUPDATE "Legacy Update"
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "LegacyUpdate.tlb"
#include "wuerror.rc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -1,14 +0,0 @@
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'Legacy Update Control'
{
val DllSurrogate = s ''
}
'LegacyUpdate.dll'
{
val AppID = s '%APPID%'
}
}
}

View File

@@ -1,601 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug-VC08|x64">
<Configuration>Debug-VC08</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-VC17|Win32">
<Configuration>Debug-VC17</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-VC08|Win32">
<Configuration>Debug-VC08</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug-VC17|x64">
<Configuration>Debug-VC17</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{95F3E1A1-5DDA-4C4D-B52B-981D46E6C98B}</ProjectGuid>
<RootNamespace>LegacyUpdate</RootNamespace>
<Keyword>AtlProj</Keyword>
<WindowsTargetPlatformVersion>7.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v90</PlatformToolset>
<UseOfAtl>Static</UseOfAtl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v90</PlatformToolset>
<UseOfAtl>Static</UseOfAtl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
<XPDeprecationWarning>false</XPDeprecationWarning>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
<XPDeprecationWarning>false</XPDeprecationWarning>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v90</PlatformToolset>
<UseOfAtl>Static</UseOfAtl>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v141_xp</PlatformToolset>
<XPDeprecationWarning>false</XPDeprecationWarning>
<UseOfAtl>Static</UseOfAtl>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'" Label="PropertySheets">
<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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<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-VC08|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetExt>.dll</TargetExt>
<IncludePath>$(SolutionDir)\shared;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
<RegisterOutput>false</RegisterOutput>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>cmd /c start /min "" taskkill /im iexplore.exe</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<MinimalRebuild>false</MinimalRebuild>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
<RegisterOutput>false</RegisterOutput>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>cmd /c start /min "" taskkill /im iexplore.exe</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
<RegisterOutput>false</RegisterOutput>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>cmd /c start /min "" taskkill /im iexplore.exe</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
<RegisterOutput>false</RegisterOutput>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<PreBuildEvent>
<Command>cmd /c start /min "" taskkill /im iexplore.exe</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>
</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>
</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
<ValidateAllParameters>true</ValidateAllParameters>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<PreBuildEvent>
<Command>cmd /c start /min "" taskkill /im iexplore.exe</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>
</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>
</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;_MERGE_PROXYSTUB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<CompileAs />
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>.\LegacyUpdate.def</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalOptions>/filealign:0x200 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MkTypLibCompatible>false</MkTypLibCompatible>
<GenerateStublessProxies>true</GenerateStublessProxies>
<TypeLibraryName>$(IntDir)LegacyUpdate.tlb</TypeLibraryName>
<HeaderFileName>LegacyUpdate_i.h</HeaderFileName>
<DllDataFileName>
</DllDataFileName>
<InterfaceIdentifierFileName>LegacyUpdate_i.c</InterfaceIdentifierFileName>
<ProxyFileName>LegacyUpdate_p.c</ProxyFileName>
</Midl>
<ResourceCompile>
<Culture>0x0409</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="ElevationHelper.rgs" />
<None Include="icon.ico" />
<None Include="LegacyUpdate.def" />
<None Include="LegacyUpdate.rgs" />
<None Include="LegacyUpdateCtrl.rgs" />
<None Include="ProgressBarControl.html">
<DeploymentContent>true</DeploymentContent>
</None>
<None Include="ProgressBarControl.rgs" />
<CustomBuild Include="wuerror.mc">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<FileType>Document</FileType>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Message Table</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Message Table</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</DeploymentContent>
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</DeploymentContent>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">mc %(FullPath) -r $(IntDir) -h $(IntDir)</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">Compiling Message Table</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">Compiling Message Table</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">Compiling Message Table</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">Compiling Message Table</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">$(IntDir)%(Identity).rc;$(IntDir)%(Identity).h;$(IntDir)MSG0409.bin</Outputs>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">false</ExcludedFromBuild>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\shared\Exec.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\shared\LegacyUpdate.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\shared\Registry.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\shared\VersionInfo.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\shared\HResult.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="..\shared\WMI.c">
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">CompileAsCpp</CompileAs>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
</ClCompile>
<ClCompile Include="ElevationHelper.cpp" />
<ClCompile Include="LaunchUpdateSite.cpp" />
<ClCompile Include="LegacyUpdateCtrl.cpp" />
<ClCompile Include="Compat.cpp" />
<ClCompile Include="ProgressBarControl.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Utils.cpp" />
<ClCompile Include="dlldatax.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
</ClCompile>
<ClCompile Include="LegacyUpdate_i.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC08|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug-VC17|x64'">false</CompileAsManaged>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</PrecompiledHeader>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\wuerror.h" />
<ClInclude Include="..\shared\Exec.h" />
<ClInclude Include="..\shared\LegacyUpdate.h" />
<ClInclude Include="..\shared\VersionInfo.h" />
<ClInclude Include="..\shared\WMI.h" />
<ClInclude Include="..\shared\HResult.h" />
<ClInclude Include="Compat.h" />
<ClInclude Include="ElevationHelper.h" />
<ClInclude Include="IUpdateInstaller4.h" />
<ClInclude Include="LaunchUpdateSite.h" />
<ClInclude Include="LegacyUpdateCtrl.h" />
<ClInclude Include="ProgressBarControl.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Utils.h" />
<ClInclude Include="dlldatax.h" />
<ClInclude Include="dllmain.h" />
<ClInclude Include="LegacyUpdate_i.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LegacyUpdate.rc" />
</ItemGroup>
<ItemGroup>
<Midl Include="LegacyUpdate.idl" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="LegacyUpdate.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -1,168 +0,0 @@
<?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;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;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>
<Filter Include="Shared">
<UniqueIdentifier>{7f88225c-35ff-498e-a402-49bc456952b5}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="LegacyUpdate.def">
<Filter>Source Files</Filter>
</None>
<None Include="icon.ico">
<Filter>Resource Files</Filter>
</None>
<None Include="LegacyUpdate.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="LegacyUpdateCtrl.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="ProgressBarControl.rgs">
<Filter>Resource Files</Filter>
</None>
<None Include="ProgressBarControl.html" />
<None Include="ElevationHelper.rgs">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LegacyUpdateCtrl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LaunchUpdateSite.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Compat.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dlldatax.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LegacyUpdate_i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ProgressBarControl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ElevationHelper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\shared\WMI.c">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\Registry.c">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\VersionInfo.c">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\HResult.c">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\Exec.c">
<Filter>Shared</Filter>
</ClCompile>
<ClCompile Include="..\shared\LegacyUpdate.c">
<Filter>Shared</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LegacyUpdateCtrl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Utils.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LaunchUpdateSite.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Compat.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dlldatax.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="dllmain.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="LegacyUpdate_i.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ProgressBarControl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ElevationHelper.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\WMI.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\VersionInfo.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\HResult.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\include\wuerror.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="IUpdateInstaller4.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\shared\Exec.h">
<Filter>Shared</Filter>
</ClInclude>
<ClInclude Include="..\shared\LegacyUpdate.h">
<Filter>Shared</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="LegacyUpdate.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Midl Include="LegacyUpdate.idl">
<Filter>Source Files</Filter>
</Midl>
<Midl Include="wuapi.idl">
<Filter>Source Files</Filter>
</Midl>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="wuerror.mc">
<Filter>Resource Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

View File

@@ -1,521 +0,0 @@
// LegacyUpdateCtrl.cpp : Implementation of the CLegacyUpdateCtrl ActiveX Control class.
#include "stdafx.h"
#include "LegacyUpdateCtrl.h"
#include "Compat.h"
#include "ElevationHelper.h"
#include "Exec.h"
#include "HResult.h"
#include "LegacyUpdate.h"
#include "Registry.h"
#include "User.h"
#include "Utils.h"
#include "VersionInfo.h"
#include "WULog.h"
#include <atlbase.h>
#include <ShlObj.h>
#include <wuapi.h>
#include "IUpdateInstaller4.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
const BSTR permittedHosts[] = {
L"legacyupdate.net",
L"test.legacyupdate.net",
NULL
};
// CLegacyUpdateCtrl message handlers
IHTMLDocument2 *CLegacyUpdateCtrl::GetHTMLDocument() {
CComPtr<IOleClientSite> clientSite;
HRESULT hr = GetClientSite(&clientSite);
if (!SUCCEEDED(hr) || clientSite == NULL) {
TRACE("GetDocument() failed: %ls\n", GetMessageForHresult(hr));
return NULL;
}
CComPtr<IOleContainer> container;
hr = clientSite->GetContainer(&container);
if (!SUCCEEDED(hr) || container == NULL) {
TRACE("GetDocument() failed: %ls\n", GetMessageForHresult(hr));
return NULL;
}
CComPtr<IHTMLDocument2> document;
hr = container->QueryInterface(IID_IHTMLDocument2, (void **)&document);
if (!SUCCEEDED(hr) || document == NULL) {
TRACE("GetDocument() failed: %ls\n", GetMessageForHresult(hr));
return NULL;
}
return document.Detach();
}
HWND CLegacyUpdateCtrl::GetIEWindowHWND() {
CComPtr<IOleWindow> oleWindow;
HRESULT hr = QueryInterface(IID_IOleWindow, (void **)&oleWindow);
if (!SUCCEEDED(hr) || !oleWindow) {
goto end;
}
HWND hwnd;
hr = oleWindow->GetWindow(&hwnd);
if (!SUCCEEDED(hr)) {
goto end;
}
return hwnd;
end:
if (!SUCCEEDED(hr)) {
TRACE("GetIEWindowHWND() failed: %ls\n", GetMessageForHresult(hr));
}
return 0;
}
BOOL CLegacyUpdateCtrl::IsPermitted(void) {
CComPtr<IHTMLDocument2> document = GetHTMLDocument();
if (document == NULL) {
#ifdef _DEBUG
// Allow debugging outside of IE (e.g. via PowerShell)
TRACE("GetHTMLDocument() failed - allowing anyway due to debug build\n");
return TRUE;
#else
return FALSE;
#endif
}
CComPtr<IHTMLLocation> location;
CComBSTR host;
HRESULT hr = document->get_location(&location);
if (!SUCCEEDED(hr) || location == NULL) {
goto end;
}
hr = location->get_host(&host);
if (!SUCCEEDED(hr)) {
goto end;
}
for (int i = 0; permittedHosts[i] != NULL; i++) {
if (wcscmp(host, permittedHosts[i]) == 0) {
return TRUE;
}
}
end:
if (!SUCCEEDED(hr)) {
TRACE("IsPermitted() failed: %ls\n", GetMessageForHresult(hr));
}
return FALSE;
}
STDMETHODIMP CLegacyUpdateCtrl::GetElevatedHelper(CComPtr<IElevationHelper> &retval) {
CComPtr<IElevationHelper> elevatedHelper = m_elevatedHelper ? m_elevatedHelper : m_nonElevatedHelper;
if (elevatedHelper == NULL) {
// Use the helper directly, without elevation. It's the responsibility of the caller to ensure it
// is already running as admin on 2k/XP, or that it has requested elevation on Vista+.
HRESULT hr = m_nonElevatedHelper.CoCreateInstance(CLSID_ElevationHelper, NULL, CLSCTX_INPROC_SERVER);
if (!SUCCEEDED(hr)) {
return hr;
}
elevatedHelper = m_nonElevatedHelper;
}
retval = elevatedHelper;
return S_OK;
}
#define DoIsPermittedCheck() \
if (!IsPermitted()) { \
return E_ACCESSDENIED; \
}
STDMETHODIMP CLegacyUpdateCtrl::SetClientSite(IOleClientSite *pClientSite) {
HRESULT hr = IOleObjectImpl::SetClientSite(pClientSite);
if (!SUCCEEDED(hr)) {
return hr;
}
DoIsPermittedCheck();
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::CheckControl(VARIANT_BOOL *retval) {
DoIsPermittedCheck();
// Just return true so the site can confirm the control is working.
*retval = VARIANT_TRUE;
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::MessageForHresult(LONG inHresult, BSTR *retval) {
DoIsPermittedCheck();
*retval = SysAllocString(GetMessageForHresult(inHresult));
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::GetOSVersionInfo(OSVersionField osField, LONG systemMetric, VARIANT *retval) {
DoIsPermittedCheck();
VariantInit(retval);
OSVERSIONINFOEX *versionInfo = GetVersionInfo();
switch (osField) {
case e_majorVer:
retval->vt = VT_UI4;
retval->ulVal = versionInfo->dwMajorVersion;
break;
case e_minorVer:
retval->vt = VT_UI4;
retval->ulVal = versionInfo->dwMinorVersion;
break;
case e_buildNumber:
retval->vt = VT_UI4;
retval->ulVal = versionInfo->dwBuildNumber;
break;
case e_platform:
retval->vt = VT_UI4;
retval->ulVal = versionInfo->dwPlatformId;
break;
case e_SPMajor:
retval->vt = VT_I4;
retval->lVal = versionInfo->wServicePackMajor;
break;
case e_SPMinor:
retval->vt = VT_I4;
retval->lVal = versionInfo->wServicePackMinor;
break;
case e_productSuite:
retval->vt = VT_I4;
retval->lVal = versionInfo->wSuiteMask;
break;
case e_productType:
retval->vt = VT_I4;
retval->lVal = versionInfo->wProductType;
break;
case e_systemMetric:
retval->vt = VT_I4;
retval->lVal = GetSystemMetrics(systemMetric);
break;
case e_SPVersionString: {
LPWSTR data;
DWORD size;
HRESULT hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"BuildLab", 0, &data, &size);
retval->vt = VT_BSTR;
retval->bstrVal = SUCCEEDED(hr)
? SysAllocStringLen(data, size - 1)
// BuildLab doesn't exist on Windows 2000.
: SysAllocString(versionInfo->szCSDVersion);
if (data) {
LocalFree(data);
}
break;
}
case e_controlVersionString: {
LPWSTR data;
HRESULT hr = GetOwnVersion(&data);
if (!SUCCEEDED(hr)) {
return hr;
}
retval->vt = VT_BSTR;
retval->bstrVal = SysAllocString(data);
break;
}
case e_VistaProductType: {
DWORD productType;
GetVistaProductInfo(versionInfo->dwMajorVersion, versionInfo->dwMinorVersion, versionInfo->wServicePackMajor, versionInfo->wServicePackMinor, &productType);
retval->vt = VT_UI4;
retval->ulVal = productType;
break;
}
case e_productName: {
HRESULT hr = GetOSProductName(retval);
if (!SUCCEEDED(hr)) {
LPWSTR data;
DWORD size;
hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"ProductName", 0, &data, &size);
if (SUCCEEDED(hr)) {
retval->vt = VT_BSTR;
retval->bstrVal = SysAllocStringLen(data, size - 1);
}
}
break;
}
case e_displayVersion: {
LPWSTR data;
DWORD size;
HRESULT hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"DisplayVersion", 0, &data, &size);
if (SUCCEEDED(hr)) {
retval->vt = VT_BSTR;
retval->bstrVal = SysAllocStringLen(data, size - 1);
LocalFree(data);
}
break;
}
}
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::RequestElevation() {
DoIsPermittedCheck();
if (m_elevatedHelper != NULL || !AtLeastWinVista()) {
return S_OK;
}
// https://learn.microsoft.com/en-us/windows/win32/com/the-com-elevation-moniker
HRESULT hr = CoCreateInstanceAsAdmin(GetIEWindowHWND(), CLSID_ElevationHelper, IID_IElevationHelper, (void**)&m_elevatedHelper);
if (!SUCCEEDED(hr)) {
TRACE("RequestElevation() failed: %ls\n", GetMessageForHresult(hr));
}
return hr;
}
STDMETHODIMP CLegacyUpdateCtrl::CreateObject(BSTR progID, IDispatch **retval) {
DoIsPermittedCheck();
HRESULT hr = S_OK;
CComPtr<IElevationHelper> elevatedHelper;
if (progID == NULL) {
hr = E_INVALIDARG;
goto end;
}
if (!ProgIDIsPermitted(progID)) {
hr = E_ACCESSDENIED;
goto end;
}
hr = GetElevatedHelper(elevatedHelper);
if (!SUCCEEDED(hr)) {
goto end;
}
return elevatedHelper->CreateObject(progID, retval);
end:
if (!SUCCEEDED(hr)) {
TRACE("CreateObject(%ls) failed: %ls\n", progID, GetMessageForHresult(hr));
}
return hr;
}
STDMETHODIMP CLegacyUpdateCtrl::SetBrowserHwnd(IUpdateInstaller *installer) {
DoIsPermittedCheck();
if (installer == NULL) {
return E_INVALIDARG;
}
CComPtr<IUpdateInstaller> updateInstaller = NULL;
HRESULT hr = installer->QueryInterface(IID_IUpdateInstaller, (void **)&updateInstaller);
if (!SUCCEEDED(hr)) {
return hr;
}
updateInstaller->put_ParentHwnd(GetIEWindowHWND());
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::GetUserType(UserType *retval) {
DoIsPermittedCheck();
if (IsUserAdmin()) {
// Entire process is elevated.
*retval = e_admin;
} else if (m_elevatedHelper != NULL) {
// Our control has successfully received elevation.
*retval = e_elevated;
} else {
// The control has no admin rights (although it may not have requested them yet).
*retval = e_nonAdmin;
}
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::get_IsRebootRequired(VARIANT_BOOL *retval) {
DoIsPermittedCheck();
// Ask WU itself whether a reboot is required
CComPtr<ISystemInformation> systemInfo;
if (SUCCEEDED(systemInfo.CoCreateInstance(CLSID_SystemInformation, NULL, CLSCTX_INPROC_SERVER))) {
if (SUCCEEDED(systemInfo->get_RebootRequired(retval)) && *retval == VARIANT_TRUE) {
return S_OK;
}
}
// Check reboot flag in registry
HKEY subkey;
HRESULT hr = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update\\RebootRequired", KEY_WOW64_64KEY, KEY_READ, &subkey));
if (SUCCEEDED(hr)) {
RegCloseKey(subkey);
*retval = VARIANT_TRUE;
return S_OK;
}
*retval = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::get_IsWindowsUpdateDisabled(VARIANT_BOOL *retval) {
DoIsPermittedCheck();
// Future note: These are in HKCU on NT; HKLM on 9x.
// Remove links and access to Windows Update
DWORD value;
HRESULT hr = GetRegistryDword(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer", L"NoWindowsUpdate", KEY_WOW64_64KEY, &value);
if (SUCCEEDED(hr) && value == 1) {
*retval = VARIANT_TRUE;
return S_OK;
}
// Remove access to use all Windows Update features
hr = GetRegistryDword(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\WindowsUpdate", L"DisableWindowsUpdateAccess", KEY_WOW64_64KEY, &value);
if (SUCCEEDED(hr) && value == 1) {
*retval = VARIANT_TRUE;
return S_OK;
}
*retval = VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::RebootIfRequired(void) {
DoIsPermittedCheck();
HRESULT hr = S_OK;
VARIANT_BOOL isRebootRequired;
if (SUCCEEDED(get_IsRebootRequired(&isRebootRequired)) && isRebootRequired == VARIANT_TRUE) {
// Calling Commit() is recommended on Windows 10, to ensure feature updates are properly prepared
// prior to the reboot. If IUpdateInstaller4 doesn't exist, we can skip this.
CComPtr<IUpdateInstaller4> installer;
hr = installer.CoCreateInstance(CLSID_UpdateInstaller, NULL, CLSCTX_INPROC_SERVER);
if (SUCCEEDED(hr) && hr != REGDB_E_CLASSNOTREG) {
hr = installer->Commit(0);
if (!SUCCEEDED(hr)) {
return hr;
}
}
CComPtr<IElevationHelper> elevatedHelper;
hr = GetElevatedHelper(elevatedHelper);
if (!SUCCEEDED(hr)) {
return hr;
}
hr = elevatedHelper->Reboot();
}
return hr;
}
static HRESULT StartLauncher(LPWSTR params, BOOL wait) {
LPWSTR path;
HRESULT hr = GetInstallPath(&path);
if (!SUCCEEDED(hr)) {
return hr;
}
PathAppend(path, L"LegacyUpdate.exe");
DWORD code;
hr = Exec(L"open", path, params, NULL, SW_SHOW, wait, &code);
if (SUCCEEDED(hr)) {
hr = HRESULT_FROM_WIN32(code);
}
return hr;
}
STDMETHODIMP CLegacyUpdateCtrl::ViewWindowsUpdateLog(void) {
DoIsPermittedCheck();
HRESULT hr = StartLauncher(L"/log", FALSE);
if (!SUCCEEDED(hr)) {
// Try directly
hr = ::ViewWindowsUpdateLog(SW_SHOWDEFAULT);
}
return hr;
}
STDMETHODIMP CLegacyUpdateCtrl::OpenWindowsUpdateSettings(void) {
DoIsPermittedCheck();
HRESULT hr = StartLauncher(L"/options", FALSE);
if (!SUCCEEDED(hr)) {
TRACE(L"OpenWindowsUpdateSettings() failed, falling back: %ls\n", GetMessageForHresult(hr));
// Might happen if the site isn't trusted, and the user rejected the IE medium integrity prompt.
// Use the basic Automatic Updates dialog directly from COM.
CComPtr<IAutomaticUpdates> automaticUpdates;
hr = automaticUpdates.CoCreateInstance(CLSID_AutomaticUpdates, NULL, CLSCTX_INPROC_SERVER);
if (SUCCEEDED(hr)) {
hr = automaticUpdates->ShowSettingsDialog();
}
if (!SUCCEEDED(hr)) {
TRACE(L"OpenWindowsUpdateSettings() failed: %ls\n", GetMessageForHresult(hr));
}
}
return hr;
}
STDMETHODIMP CLegacyUpdateCtrl::get_IsUsingWsusServer(VARIANT_BOOL *retval) {
DoIsPermittedCheck();
DWORD useWUServer;
HRESULT hr = GetRegistryDword(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate\\AU", L"UseWUServer", 0, &useWUServer);
*retval = SUCCEEDED(hr) && useWUServer == 1 ? VARIANT_TRUE : VARIANT_FALSE;
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::get_WsusServerUrl(BSTR *retval) {
DoIsPermittedCheck();
LPWSTR data;
DWORD size;
HRESULT hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate", L"WUServer", 0, &data, &size);
*retval = SUCCEEDED(hr) ? SysAllocStringLen(data, size - 1) : NULL;
if (data) {
LocalFree(data);
}
return S_OK;
}
STDMETHODIMP CLegacyUpdateCtrl::get_WsusStatusServerUrl(BSTR *retval) {
DoIsPermittedCheck();
LPWSTR data;
DWORD size;
HRESULT hr = GetRegistryString(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsUpdate", L"WUStatusServer", 0, &data, &size);
*retval = SUCCEEDED(hr) ? SysAllocStringLen(data, size - 1) : NULL;
if (data) {
LocalFree(data);
}
return S_OK;
}

View File

@@ -1,119 +0,0 @@
#pragma once
// LegacyUpdateCtrl.h : Declaration of the CLegacyUpdateCtrl ActiveX Control class.
// CLegacyUpdateCtrl : See LegacyUpdateCtrl.cpp for implementation.
#include <atlctl.h>
#include <MsHTML.h>
#include <wuapi.h>
#include "resource.h"
#include "LegacyUpdate_i.h"
// CLegacyUpdateCtrl
class ATL_NO_VTABLE CLegacyUpdateCtrl :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<ILegacyUpdateCtrl, &IID_ILegacyUpdateCtrl, &LIBID_LegacyUpdateLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IPersistStreamInitImpl<CLegacyUpdateCtrl>,
public IOleControlImpl<CLegacyUpdateCtrl>,
public IOleObjectImpl<CLegacyUpdateCtrl>,
public IOleInPlaceActiveObjectImpl<CLegacyUpdateCtrl>,
public IViewObjectExImpl<CLegacyUpdateCtrl>,
public IOleInPlaceObjectWindowlessImpl<CLegacyUpdateCtrl>,
public ISupportErrorInfo,
public IObjectWithSiteImpl<CLegacyUpdateCtrl>,
public IPersistStorageImpl<CLegacyUpdateCtrl>,
public IQuickActivateImpl<CLegacyUpdateCtrl>,
public IProvideClassInfo2Impl<&CLSID_LegacyUpdateCtrl, NULL, &LIBID_LegacyUpdateLib>,
public CComCoClass<CLegacyUpdateCtrl, &CLSID_LegacyUpdateCtrl>,
public CComControl<CLegacyUpdateCtrl> {
private:
CComPtr<IElevationHelper> m_elevatedHelper;
CComPtr<IElevationHelper> m_nonElevatedHelper;
public:
CLegacyUpdateCtrl() {
m_bWindowOnly = TRUE;
}
DECLARE_OLEMISC_STATUS(
OLEMISC_INVISIBLEATRUNTIME |
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST |
OLEMISC_INSIDEOUT |
OLEMISC_CANTLINKINSIDE |
OLEMISC_RECOMPOSEONRESIZE
)
DECLARE_REGISTRY_RESOURCEID(IDR_LEGACYUPDATECTRL)
BEGIN_COM_MAP(CLegacyUpdateCtrl)
COM_INTERFACE_ENTRY(ILegacyUpdateCtrl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
COM_INTERFACE_ENTRY(IPersistStreamInit)
COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IQuickActivate)
COM_INTERFACE_ENTRY(IPersistStorage)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
END_COM_MAP()
BEGIN_PROP_MAP(CLegacyUpdateCtrl)
END_PROP_MAP()
BEGIN_MSG_MAP(CLegacyUpdateCtrl)
CHAIN_MSG_MAP(CComControl<CLegacyUpdateCtrl>)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) {
return IsEqualGUID(riid, IID_ILegacyUpdateCtrl) ? S_OK : S_FALSE;
}
// IViewObjectEx
DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
// ILegacyUpdateCtrl
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct() { return S_OK; }
void FinalRelease() {}
private:
IHTMLDocument2 *GetHTMLDocument();
HWND GetIEWindowHWND();
BOOL IsPermitted();
STDMETHODIMP GetElevatedHelper(CComPtr<IElevationHelper> &retval);
public:
STDMETHODIMP SetClientSite(IOleClientSite *pClientSite);
STDMETHODIMP CheckControl(VARIANT_BOOL *retval);
STDMETHODIMP MessageForHresult(LONG inHresult, BSTR *retval);
STDMETHODIMP GetOSVersionInfo(OSVersionField osField, LONG systemMetric, VARIANT *retval);
STDMETHODIMP RequestElevation();
STDMETHODIMP CreateObject(BSTR progID, IDispatch **retval);
STDMETHODIMP SetBrowserHwnd(IUpdateInstaller *installer);
STDMETHODIMP GetUserType(UserType *retval);
STDMETHODIMP get_IsRebootRequired(VARIANT_BOOL *retval);
STDMETHODIMP get_IsWindowsUpdateDisabled(VARIANT_BOOL *retval);
STDMETHODIMP RebootIfRequired(void);
STDMETHODIMP ViewWindowsUpdateLog(void);
STDMETHODIMP OpenWindowsUpdateSettings(void);
STDMETHODIMP get_IsUsingWsusServer(VARIANT_BOOL *retval);
STDMETHODIMP get_WsusServerUrl(BSTR *retval);
STDMETHODIMP get_WsusStatusServerUrl(BSTR *retval);
};
OBJECT_ENTRY_AUTO(__uuidof(LegacyUpdateCtrl), CLegacyUpdateCtrl)

View File

@@ -1,37 +0,0 @@
HKCR
{
LegacyUpdate.Control.1 = s 'LegacyUpdateCtrl Class'
{
CLSID = s '{AD28E0DF-5F5A-40B5-9432-85EFD97D1F9F}'
}
LegacyUpdate.Control = s 'LegacyUpdateCtrl Class'
{
CurVer = s 'LegacyUpdate.Control.1'
}
NoRemove CLSID
{
ForceRemove {AD28E0DF-5F5A-40B5-9432-85EFD97D1F9F} = s 'Legacy Update Control'
{
ProgID = s 'LegacyUpdate.Control.1'
VersionIndependentProgID = s 'LegacyUpdate.Control'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
val AppID = s '%APPID%'
ForceRemove 'Control'
'MiscStatus' = s '0'
{
'1' = s '%OLEMISC%'
}
'TypeLib' = s '{05D22F33-C7C3-4C90-BDD9-CEDC86EA8FBE}'
'Version' = s '1.0'
'Implemented Categories'
{
'{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
'{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
}
}
}
}

View File

@@ -1,43 +0,0 @@
override DEBUG := $(or $(DEBUG),1)
MSBUILDCONFIG32 = $(if $(filter 1,$(DEBUG)),Debug-VC08,Release)
MSBUILDCONFIG64 = $(if $(filter 1,$(DEBUG)),Debug-VC17,Release)
MSBUILDFLAGS = /v:minimal /m
ifeq ($(CI),1)
ifeq ($(DEBUG),1)
MSBUILDCONFIG32 = Debug-VC17
endif
MSBUILDFLAGS += /p:PlatformToolset=v141_xp
endif
MSBUILDFLAGS32 = $(MSBUILDFLAGS) /p:Configuration=$(MSBUILDCONFIG32) /p:Platform=Win32
MSBUILDFLAGS64 = $(MSBUILDFLAGS) /p:Configuration=$(MSBUILDCONFIG64) /p:Platform=x64
VSPATH ?= $(shell wslpath "$(shell '/mnt/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe' -latest -property installationPath)")
PATH := $(VSPATH)/MSBuild/Current/Bin:$(PATH)
MSBUILD = msbuild.exe
all:
@# Workaround for "dlldatax.obj: LNK2001: unresolved external symbol _LegacyUpdate_ProxyFileInfo"
rm -f LegacyUpdate_p.c
cd ..; $(MSBUILD) $(MSBUILDFLAGS32) LegacyUpdate.sln
rm -f LegacyUpdate_p.c
cd ..; $(MSBUILD) $(MSBUILDFLAGS64) LegacyUpdate.sln
ifeq ($(SIGN),1)
../build/sign.sh \
../Release/LegacyUpdate.dll \
../x64/Release/LegacyUpdate.dll
endif
clean:
rm -rf \
Debug-VC08 Debug-VC17 Release x64 \
LegacyUpdate_i.c LegacyUpdate_i.h LegacyUpdate_p.c LegacyUpdateidl.h
cd ..; $(MSBUILD) $(MSBUILDFLAGS32) LegacyUpdate.sln /t:Clean
cd ..; $(MSBUILD) $(MSBUILDFLAGS64) LegacyUpdate.sln /t:Clean
.PHONY: all clean

View File

@@ -1,65 +0,0 @@
// ProgressBarControl.cpp : Implementation of CProgressBarControl
#include "stdafx.h"
#include "ProgressBarControl.h"
#include <CommCtrl.h>
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#ifndef PBS_MARQUEE
#define PBS_MARQUEE 0x08
#endif
#ifndef PBM_SETMARQUEE
#define PBM_SETMARQUEE (WM_USER + 10)
#endif
LRESULT CProgressBarControl::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) {
RECT rc;
GetWindowRect(&rc);
rc.right -= rc.left;
rc.bottom -= rc.top;
rc.left = 0;
rc.top = 0;
m_ctl.Create(m_hWnd, rc, PROGRESS_CLASS, WS_CHILD | WS_VISIBLE, WS_EX_CLIENTEDGE);
put_Value(-1);
return 0;
}
STDMETHODIMP CProgressBarControl::SetObjectRects(LPCRECT prcPos, LPCRECT prcClip) {
IOleInPlaceObjectWindowlessImpl<CProgressBarControl>::SetObjectRects(prcPos, prcClip);
::SetWindowPos(m_ctl.m_hWnd, NULL, 0, 0,
prcPos->right - prcPos->left,
prcPos->bottom - prcPos->top,
SWP_NOZORDER | SWP_NOACTIVATE);
return S_OK;
}
STDMETHODIMP CProgressBarControl::get_Value(SHORT *pValue) {
if (m_ctl.GetWindowLongPtr(GWL_STYLE) & PBS_MARQUEE) {
// Marquee - no value
*pValue = -1;
} else {
// Normal - return PBM_GETPOS
*pValue = (SHORT)m_ctl.SendMessage(PBM_GETPOS, 0, 0);
}
return S_OK;
}
STDMETHODIMP CProgressBarControl::put_Value(SHORT value) {
if (value == -1) {
// Marquee style
m_ctl.SetWindowLongPtr(GWL_STYLE, m_ctl.GetWindowLongPtr(GWL_STYLE) | PBS_MARQUEE);
m_ctl.SendMessage(PBM_SETMARQUEE, TRUE, 100);
} else {
// Normal style
SHORT oldValue;
get_Value(&oldValue);
if (oldValue == -1) {
m_ctl.SetWindowLongPtr(GWL_STYLE, m_ctl.GetWindowLongPtr(GWL_STYLE) & ~PBS_MARQUEE);
m_ctl.SendMessage(PBM_SETRANGE, 0, MAKELPARAM(0, 100));
}
m_ctl.SendMessage(PBM_SETPOS, value, 0);
}
return S_OK;
}

View File

@@ -1,77 +0,0 @@
#pragma once
// ProgressBarControl.h : Declaration of the CProgressBarControl class.
#include <atlctl.h>
#include "resource.h"
#include "LegacyUpdate_i.h"
// CProgressBarControl
class ATL_NO_VTABLE CProgressBarControl :
public CComObjectRootEx<CComSingleThreadModel>,
public IDispatchImpl<IProgressBarControl, &IID_IProgressBarControl, &LIBID_LegacyUpdateLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IOleControlImpl<CProgressBarControl>,
public IOleObjectImpl<CProgressBarControl>,
public IOleInPlaceActiveObjectImpl<CProgressBarControl>,
public IViewObjectExImpl<CProgressBarControl>,
public IOleInPlaceObjectWindowlessImpl<CProgressBarControl>,
public CComCoClass<CProgressBarControl, &CLSID_ProgressBarControl>,
public CComControl<CProgressBarControl>
{
public:
CContainedWindow m_ctl;
CProgressBarControl() : m_ctl(L"msctls_progress32", this, 1) {
m_bWindowOnly = TRUE;
}
DECLARE_OLEMISC_STATUS(
OLEMISC_RECOMPOSEONRESIZE |
OLEMISC_CANTLINKINSIDE |
OLEMISC_INSIDEOUT |
OLEMISC_ACTIVATEWHENVISIBLE |
OLEMISC_SETCLIENTSITEFIRST
)
DECLARE_REGISTRY_RESOURCEID(IDR_PROGRESSBARCONTROL)
BEGIN_COM_MAP(CProgressBarControl)
COM_INTERFACE_ENTRY(IProgressBarControl)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
END_COM_MAP()
BEGIN_PROP_MAP(CProgressBarControl)
END_PROP_MAP()
BEGIN_MSG_MAP(CProgressBarControl)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
CHAIN_MSG_MAP(CComControl<CProgressBarControl>)
ALT_MSG_MAP(1)
END_MSG_MAP()
// IViewObjectEx
DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
// IProgressBarControl
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct() { return S_OK; }
void FinalRelease() {}
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled);
STDMETHODIMP SetObjectRects(LPCRECT prcPos, LPCRECT prcClip);
STDMETHODIMP get_Value(SHORT *pValue);
STDMETHODIMP put_Value(SHORT value);
};
OBJECT_ENTRY_AUTO(__uuidof(ProgressBarControl), CProgressBarControl)

View File

@@ -1,48 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>ATL test page for object ProgressBarControl</title>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="MSThemeCompatible" content="yes">
</head>
<body>
<div style="border: 1px solid;">
<object id="ProgressBarControl" classid="CLSID:7b875a2f-2dfb-4d38-91f5-5c0bfb74c377" width="208" height="14"></object>
</div>
<div id="Value">-1</div>
<button onclick="marquee()">Marquee</button>
<button onclick="normal()">Normal</button>
<button onclick="zero()">Zero</button>
<script>
var timer = -1;
function marquee() {
if (timer !== -1) {
clearInterval(timer);
}
ProgressBarControl.Value = -1;
Value.innerText = "-1";
}
function normal() {
if (timer !== -1) {
clearInterval(timer);
}
timer = setInterval(function() {
var value = ProgressBarControl.Value;
Value.innerText = value;
ProgressBarControl.Value = value === 100 ? 0 : value + 1;
}, 100);
}
function zero() {
ProgressBarControl.Value = 0;
}
</script>
</body>
</html>

View File

@@ -1,34 +0,0 @@
HKCR
{
LegacyUpdate.ProgressBar.1 = s 'ProgressBarControl Class'
{
CLSID = s '{7B875A2F-2DFB-4D38-91F5-5C0BFB74C377}'
}
LegacyUpdate.ProgressBar = s 'ProgressBarControl Class'
{
CurVer = s 'LegacyUpdate.ProgressBar.1'
}
NoRemove CLSID
{
ForceRemove {7B875A2F-2DFB-4D38-91F5-5C0BFB74C377} = s 'Legacy Update Progress Bar Control'
{
ForceRemove Programmable
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
ForceRemove Control
MiscStatus = s '0'
{
'1' = s '%OLEMISC%'
}
TypeLib = s '{05D22F33-C7C3-4C90-BDD9-CEDC86EA8FBE}'
Version = s '1.0'
'Implemented Categories'
{
'{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
'{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
}
}
}
}

View File

@@ -1,20 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by LegacyUpdate.rc
//
#define IDS_LEGACYUPDATE 1
#define IDR_LEGACYUPDATEOCX 101
#define IDR_LEGACYUPDATECTRL 102
#define IDR_PROGRESSBARCONTROL 103
#define IDR_ELEVATIONHELPER 104
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 204
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 105
#endif
#endif

View File

@@ -1,167 +0,0 @@
#include "stdafx.h"
#include <comdef.h>
#include <atlstr.h>
#include <shlwapi.h>
#include "HResult.h"
#include "WMI.h"
#include "VersionInfo.h"
#pragma comment(lib, "advapi32.lib")
#pragma comment(lib, "shlwapi.lib")
#pragma comment(lib, "version.lib")
typedef DWORD (WINAPI *_InitiateShutdownW)(LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwGracePeriod, DWORD dwShutdownFlags, DWORD dwReason);
static BOOL _loadedProductName = FALSE;
static CComVariant _productName;
typedef struct {
DWORD version;
DWORD osFlag;
LPWSTR library;
UINT stringIDs[3];
} WinNT5Variant;
static const WinNT5Variant nt5Variants[] = {
// XP
{0x0501, OS_TABLETPC, L"winbrand.dll", { 180, 2000}},
{0x0501, OS_MEDIACENTER, L"winbrand.dll", { 180, 2001}},
{0x0501, OS_STARTER, L"winbrand.dll", { 180, 2002}},
{0x0501, OS_EMBPOS, L"winbrand.dll", { 180, 2003}},
{0x0501, OS_WINFLP, L"winbrand.dll", { 180, 2004}},
{0x0501, OS_EMBSTD2009, L"winbrand.dll", { 180, 2005}},
{0x0501, OS_EMBPOS2009, L"winbrand.dll", { 180, 2006}},
// Check for XP Embedded last as WES2009 also identifies as OS_EMBEDDED.
{0x0501, OS_EMBEDDED, L"sysdm.cpl", { 180, 189}},
// Server 2003
{0x0502, OS_APPLIANCE, L"winbrand.dll", { 181, 2002}},
{0x0502, OS_STORAGESERVER, L"wssbrand.dll", {1101, 1102}},
{0x0502, OS_COMPUTECLUSTER, L"hpcbrand.dll", {1101, 1102, 1103}},
{0x0502, OS_HOMESERVER, L"whsbrand.dll", {1101, 1102}},
};
HRESULT GetOSProductName(LPVARIANT productName) {
if (!_loadedProductName) {
_loadedProductName = TRUE;
VariantInit(&_productName);
// Handle the absolute disaster of Windows XP/Server 2003 edition branding
WORD winver = GetWinVer();
if (HIBYTE(winver) == 5) {
WinNT5Variant variant = {};
for (DWORD i = 0; i < ARRAYSIZE(nt5Variants); i++) {
if (winver == nt5Variants[i].version && IsOS(nt5Variants[i].osFlag)) {
variant = nt5Variants[i];
break;
}
}
if (variant.version) {
HMODULE brandDll = LoadLibraryEx(variant.library, NULL, LOAD_LIBRARY_AS_DATAFILE);
if (brandDll) {
WCHAR brandStr[1024];
ZeroMemory(brandStr, ARRAYSIZE(brandStr));
DWORD j = 0;
while (variant.stringIDs[j] != 0) {
UINT id = variant.stringIDs[j];
WCHAR str[340];
if (id == 180 || id == 181) {
// Get "Microsoft Windows XP" or "Microsoft Windows Server 2003" string
HMODULE sysdm = LoadLibraryEx(L"sysdm.cpl", NULL, LOAD_LIBRARY_AS_DATAFILE);
if (sysdm) {
LoadString(sysdm, id, str, ARRAYSIZE(str));
FreeLibrary(sysdm);
}
} else {
LoadString(brandDll, id, str, ARRAYSIZE(str));
}
if (j > 0) {
wcscat(brandStr, L" ");
}
wcscat(brandStr, str);
j++;
}
_productName.vt = VT_BSTR;
_productName.bstrVal = SysAllocString(brandStr);
FreeLibrary(brandDll);
}
}
}
if (_productName.vt == VT_EMPTY) {
// Get from WMI
HRESULT hr = QueryWMIProperty(L"SELECT Caption FROM Win32_OperatingSystem", L"Caption", &_productName);
if (!SUCCEEDED(hr)) {
return hr;
}
}
}
VariantCopy(productName, &_productName);
return S_OK;
}
HRESULT Reboot() {
HRESULT hr = E_FAIL;
// Make sure we have permission to shut down
HANDLE token;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &token)) {
hr = AtlHresultFromLastError();
TRACE("OpenProcessToken() failed: %ls\n", GetMessageForHresult(hr));
goto end;
}
LUID shutdownLuid;
if (!LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &shutdownLuid)) {
hr = AtlHresultFromLastError();
TRACE("LookupPrivilegeValue() failed: %ls\n", GetMessageForHresult(hr));
goto end;
}
// Ask the system nicely to give us shutdown privilege
TOKEN_PRIVILEGES privileges;
privileges.PrivilegeCount = 1;
privileges.Privileges[0].Luid = shutdownLuid;
privileges.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
if (!AdjustTokenPrivileges(token, FALSE, &privileges, 0, NULL, NULL)) {
hr = AtlHresultFromLastError();
TRACE("AdjustTokenPrivileges() failed: %ls\n", GetMessageForHresult(hr));
goto end;
}
// Reboot with reason "Operating System: Security fix (Unplanned)", ensuring to install updates.
// Try InitiateShutdown first (Vista+)
_InitiateShutdownW $InitiateShutdownW = (_InitiateShutdownW)GetProcAddress(GetModuleHandle(L"advapi32.dll"), "InitiateShutdownW");
if ($InitiateShutdownW) {
hr = HRESULT_FROM_WIN32($InitiateShutdownW(NULL, NULL, 0, SHUTDOWN_RESTART | SHUTDOWN_INSTALL_UPDATES, SHTDN_REASON_MAJOR_OPERATINGSYSTEM | SHTDN_REASON_MINOR_SECURITYFIX));
}
// Try InitiateSystemShutdownEx (2k/XP)
if (!SUCCEEDED(hr)) {
TRACE("InitiateShutdown() failed: %ls\n", GetMessageForHresult(hr));
if (InitiateSystemShutdownEx(NULL, NULL, 0, FALSE, TRUE, SHTDN_REASON_MAJOR_OPERATINGSYSTEM | SHTDN_REASON_MINOR_SECURITYFIX) == 0) {
hr = AtlHresultFromLastError();
TRACE("InitiateSystemShutdownExW() failed: %ls\n", GetMessageForHresult(hr));
}
}
// Last-ditch attempt ExitWindowsEx (only guaranteed to work for the current logged in user)
if (!ExitWindowsEx(EWX_REBOOT | EWX_FORCEIFHUNG, SHTDN_REASON_MAJOR_OPERATINGSYSTEM | SHTDN_REASON_MINOR_SECURITYFIX)) {
hr = AtlHresultFromLastError();
TRACE("ExitWindowsEx() failed: %ls\n", GetMessageForHresult(hr));
}
end:
if (token) {
CloseHandle(token);
}
return hr;
}

View File

@@ -1,5 +0,0 @@
#pragma once
HRESULT GetOSProductName(LPVARIANT productName);
HRESULT Reboot();

View File

@@ -1,17 +0,0 @@
@echo off
setlocal enabledelayedexpansion
cd %~dp0\..
:: Clean
call build\getvc.cmd x86
msbuild LegacyUpdate.sln /v:quiet /m /p:Configuration=Release /p:Platform=Win32 /t:clean
if "%errorlevel%" neq "0" exit /b %errorlevel%
msbuild LegacyUpdate.sln /v:quiet /m /p:Configuration=Release /p:Platform=x64 /t:clean
if "%errorlevel%" neq "0" exit /b %errorlevel%
:: Build DLL
msbuild LegacyUpdate.sln /v:minimal /m /p:Configuration=Release /p:Platform=Win32 %*
if "%errorlevel%" neq "0" exit /b %errorlevel%
call build\getvc.cmd x64
msbuild LegacyUpdate.sln /v:minimal /m /p:Configuration=Release /p:Platform=x64 %*
if "%errorlevel%" neq "0" exit /b %errorlevel%

View File

@@ -1,38 +0,0 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#define PROXY_DELEGATION
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( LegacyUpdate )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( LegacyUpdate ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

View File

@@ -1,18 +0,0 @@
// wrapper for dlldata.c
#ifdef _MERGE_PROXYSTUB // merge proxy stub DLL
#define REGISTER_PROXY_DLL //DllRegisterServer, etc.
#define _WIN32_WINNT _WIN32_WINNT_WIN2K //for WinNT 4.0 or Win95 with DCOM
#define USE_STUBLESS_PROXY //defined only with MIDL switch /Oicf
#pragma comment(lib, "rpcns4.lib")
#pragma comment(lib, "rpcrt4.lib")
#define ENTRY_PREFIX Prx
#include "dlldata.c"
#include "LegacyUpdate_p.c"
#endif //_MERGE_PROXYSTUB

View File

@@ -1,11 +0,0 @@
#pragma once
#ifdef _MERGE_PROXYSTUB
extern "C" {
BOOL WINAPI PrxDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved);
STDAPI PrxDllCanUnloadNow(void);
STDAPI PrxDllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
STDAPI PrxDllRegisterServer(void);
STDAPI PrxDllUnregisterServer(void);
}
#endif

View File

@@ -1,144 +0,0 @@
// dllmain.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "LegacyUpdate_i.h"
#include "dllmain.h"
#include <strsafe.h>
#include "dlldatax.h"
#include "Registry.h"
#include "LegacyUpdate.h"
CLegacyUpdateModule _AtlModule;
HINSTANCE g_hInstance;
// DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
#ifdef _MERGE_PROXYSTUB
if (!PrxDllMain(hInstance, dwReason, lpReserved))
return FALSE;
#endif
switch (dwReason) {
case DLL_PROCESS_ATTACH:
g_hInstance = hInstance;
break;
case DLL_PROCESS_DETACH:
g_hInstance = NULL;
break;
}
return _AtlModule.DllMain(dwReason, lpReserved);
}
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void) {
#ifdef _MERGE_PROXYSTUB
HRESULT hr = PrxDllCanUnloadNow();
if (hr != S_OK) {
return hr;
}
#endif
return _AtlModule.DllCanUnloadNow();
}
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) {
#ifdef _MERGE_PROXYSTUB
if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK) {
return S_OK;
}
#endif
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void) {
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
if (!SUCCEEDED(hr)) {
return hr;
}
// Fix the icon path
HKEY subkey;
hr = HRESULT_FROM_WIN32(RegOpenKeyEx(HKEY_CLASSES_ROOT, L"CLSID\\{84F517AD-6438-478F-BEA8-F0B808DC257F}\\Elevation", 0, KEY_WRITE, &subkey));
if (!SUCCEEDED(hr)) {
return hr;
}
LPWSTR installPath;
hr = GetInstallPath(&installPath);
if (!SUCCEEDED(hr)) {
return hr;
}
WCHAR iconRef[512];
hr = StringCchPrintf((LPWSTR)&iconRef, ARRAYSIZE(iconRef), L"@%ls\\LegacyUpdate.exe,-100", installPath);
LocalFree(installPath);
if (!SUCCEEDED(hr)) {
return hr;
}
hr = HRESULT_FROM_WIN32(RegSetValueEx(subkey, L"IconReference", 0, REG_SZ, (LPBYTE)iconRef, (DWORD)(lstrlen(iconRef) + 1) * sizeof(TCHAR)));
if (!SUCCEEDED(hr)) {
return hr;
}
hr = RegCloseKey(subkey);
#ifdef _MERGE_PROXYSTUB
if (!SUCCEEDED(hr)) {
return hr;
}
hr = PrxDllRegisterServer();
#endif
return hr;
}
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void) {
HRESULT hr = _AtlModule.DllUnregisterServer();
#ifdef _MERGE_PROXYSTUB
if (FAILED(hr)) {
return hr;
}
hr = PrxDllRegisterServer();
if (FAILED(hr)) {
return hr;
}
hr = PrxDllUnregisterServer();
#endif
return hr;
}
// DllInstall - Adds/Removes entries to the system registry per user per machine.
STDAPI DllInstall(BOOL bInstall, LPCWSTR pszCmdLine) {
HRESULT hr = E_FAIL;
static const wchar_t szUserSwitch[] = L"user";
if (pszCmdLine != NULL) {
if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0) {
AtlSetPerUserRegistration(true);
}
}
if (bInstall) {
hr = DllRegisterServer();
if (FAILED(hr)) {
DllUnregisterServer();
}
} else {
hr = DllUnregisterServer();
}
return hr;
}

View File

@@ -1,10 +0,0 @@
// dllmain.h : Declaration of module class.
class CLegacyUpdateModule : public CAtlDllModuleT<CLegacyUpdateModule> {
public:
DECLARE_LIBID(LIBID_LegacyUpdateLib)
DECLARE_REGISTRY_APPID_RESOURCEID(IDR_LEGACYUPDATEOCX, "{D0A82CD0-B6F0-4101-83ED-DA47D0D04830}")
};
extern class CLegacyUpdateModule _AtlModule;
extern HINSTANCE g_hInstance;

View File

@@ -1,5 +0,0 @@
// stdafx.cpp : source file that includes just the standard includes
// LegacyUpdate.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -1,28 +0,0 @@
#pragma once
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#ifndef STRICT
#define STRICT
#endif
#include "targetver.h"
#define _ATL_APARTMENT_THREADED
#define _ATL_NO_AUTOMATIC_NAMESPACE
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define ISOLATION_AWARE_ENABLED 1 // Enable comctl 6.0 (visual styles)
#include "resource.h"
#include <atltrace.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>
using namespace ATL;
#define TRACE ATLTRACE

View File

@@ -1,11 +0,0 @@
#pragma once
#if _MSC_VER > 1599
// VC17: Windows XP
#define WINVER _WIN32_WINNT_WINXP
#define _WIN32_WINNT _WIN32_WINNT_WINXP
#else
// VC08: Windows 2000 RTM
#define WINVER _WIN32_WINNT_WIN2K
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
#endif

View File

@@ -1,39 +0,0 @@
import "oaidl.idl";
// Just types we need from wuapi.idl
[
helpstring("IUpdateInstaller Interface"),
object,
oleautomation,
dual,
nonextensible,
uuid(7b929c68-ccdc-4226-96b1-8724600b54c2),
pointer_default(unique),
]
interface IUpdateInstaller : IDispatch {
[id(0x60020003), propget, restricted]
HRESULT ParentHwnd([out, retval] HWND *retval);
[id(0x60020003), propput, restricted]
HRESULT ParentHwnd([in, unique] HWND value);
};
[
uuid(B596CC9F-56E5-419E-A622-E01BB457431E),
version(2.0),
helpstring("WUAPI 2.0 Type Library")
]
library WUApiLib
{
importlib("stdole2.tlb");
[
helpstring("UpdateInstaller Class"),
uuid(D2E0FE7F-D23E-48E1-93C0-6FA8CC346474)
]
coclass UpdateInstaller
{
[default] interface IUpdateInstaller2;
};
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
export CI ?= 0
export SIGN ?= 0
export DEBUG ?= 1
all:
ifeq ($(DEBUG),0)
+$(MAKE) clean
endif
+$(MAKE) -C LegacyUpdate
+$(MAKE) -C launcher
+$(MAKE) -C setup
clean:
+$(MAKE) -C LegacyUpdate clean
+$(MAKE) -C launcher clean
+$(MAKE) -C setup clean
.PHONY: all clean

View File

@@ -13,9 +13,6 @@ if not exist "%ProgramFiles32%\NSIS\Bin\makensis.exe" (
exit /b 1
)
:: Build project
call LegacyUpdate\build.cmd
:: Build NSIS
makensis setup\setup.nsi
if "%errorlevel%" neq "0" exit /b %errorlevel%

View File

@@ -1,35 +0,0 @@
#!/bin/bash
# Fixes NSIS binaries so they run on Pentium/486. Debian's build of NSIS is compiled with MinGW,
# but they lack any -mcpu flag, so the binaries receive a default of i686. To fix this, we'll
# download the official Windows build of NSIS and extract its binaries. We only handle stubs though,
# because we provide our own plugin builds in this repo.
set -e
if [[ $UID != 0 ]]; then
echo "This script needs to be run as root (sorry)" >&2
exit 1
fi
if [[ ! -d /usr/share/nsis/Stubs ]]; then
echo "NSIS not installed, or Stubs directory is broken" >&2
exit 1
fi
if [[ -d /usr/share/nsis/Stubs_old ]]; then
echo "NSIS stubs are already fixed" >&2
exit 0
fi
apt-get install -qy curl p7zip-full
mkdir /tmp/nsis
cd /tmp/nsis
curl -fSL https://prdownloads.sourceforge.net/nsis/NSIS%203/3.10/nsis-3.10-setup.exe -o nsis.exe
7z x nsis.exe
mv /usr/share/nsis/Stubs{,_old}
cp -ra Stubs /usr/share/nsis/Stubs
rm -rf /tmp/nsis

Binary file not shown.

View File

@@ -1,23 +0,0 @@
@REM @echo off
setlocal enabledelayedexpansion
set ProgramFiles32=%ProgramFiles%
if "%ProgramFiles(x86)%" neq "" set ProgramFiles32=%ProgramFiles(x86)%
:: Find Visual Studio installation
if exist "%ProgramFiles32%\Microsoft Visual Studio\Installer\vswhere.exe" (
:: Get modern Visual Studio install path
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles32%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set VSPath=%%i
set "vcvarsall=!VSPath!\VC\Auxiliary\Build\vcvarsall.bat"
if "%errorlevel%" neq "0" exit /b %errorlevel%
) else if exist "%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat" (
:: Visual Studio 2010
set "vcvarsall=%VS100COMNTOOLS%\..\..\VC\vcvarsall.bat"
if "%errorlevel%" neq "0" exit /b %errorlevel%
) else (
echo Visual Studio not found. Refer to README.md. >&2
exit /b 1
)
endlocal & set "vcvarsall=%vcvarsall%"
call "%vcvarsall%" %* >nul

View File

@@ -1,10 +0,0 @@
@echo off
setlocal enabledelayedexpansion
:: Find Visual Studio installation
call %~dp0getvc.cmd x64
:: Sign
signtool sign /n "Hashbang Productions" /tr http://time.certum.pl/ /fd SHA1 /td SHA256 /v %*
signtool sign /n "Hashbang Productions" /tr http://time.certum.pl/ /fd SHA256 /td SHA256 /as /v %*
if "%errorlevel%" neq "0" exit /b %errorlevel%

View File

@@ -1,9 +0,0 @@
#!/bin/bash
args=("$(wslpath -w "$(dirname "$0")/sign.cmd")")
for arg in "$@"; do
case "$arg" in
*/*) args+=("$(wslpath -w "$arg")") ;;
*) args+=("$arg") ;;
esac
done
exec cmd.exe /c "${args[@]}"

View File

@@ -1,64 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include <exdisp.h>
const LPWSTR LegacyUpdateSiteURLHttp = L"http://legacyupdate.net/";
const LPWSTR LegacyUpdateSiteURLHttps = L"https://legacyupdate.net/";
PLUGIN_METHOD(CloseIEWindows) {
PLUGIN_INIT();
// Find and close IE windows that might have the ActiveX control loaded
IShellWindows *windows;
HRESULT hr = CoCreateInstance(&CLSID_ShellWindows, NULL, CLSCTX_ALL, &IID_IShellWindows, (void **)&windows);
if (!SUCCEEDED(hr)) {
goto end;
}
long count;
hr = IShellWindows_get_Count(windows, &count);
if (!SUCCEEDED(hr)) {
goto end;
}
VARIANT index = {0};
index.vt = VT_I4;
for (long i = 0; i <= count; i++) {
IDispatch *item;
index.lVal = i;
hr = IShellWindows_Item(windows, index, &item);
if (!SUCCEEDED(hr) || !item) {
continue;
}
IWebBrowser2 *browser;
hr = IDispatch_QueryInterface(item, &IID_IWebBrowser2, (void **)&browser);
IDispatch_Release(item);
if (!SUCCEEDED(hr)) {
continue;
}
BSTR location;
hr = IWebBrowser2_get_LocationURL(browser, &location);
if (!SUCCEEDED(hr)) {
IWebBrowser2_Release(browser);
continue;
}
if (wcsstr(location, LegacyUpdateSiteURLHttp) != NULL || wcsstr(location, LegacyUpdateSiteURLHttps) != NULL) {
hr = IWebBrowser2_Quit(browser);
}
SysFreeString(location);
IWebBrowser2_Release(browser);
}
end:
if (windows) {
IShellWindows_Release(windows);
}
pushint(hr);
}

View File

@@ -1,377 +0,0 @@
#include "stdafx.h"
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_VISTA
#include <windows.h>
#include <nsis/pluginapi.h>
#include <shlwapi.h>
#include <uxtheme.h>
#include <vsstyle.h>
#include <windowsx.h>
#include "main.h"
#include "LoadImage.h"
#include "Registry.h"
#include "VersionInfo.h"
#ifndef WM_DWMCOMPOSITIONCHANGED
#define WM_DWMCOMPOSITIONCHANGED 0x031e
#endif
#define DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 19
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#define DWMWA_CAPTION_COLOR 35
#define DWMWA_SYSTEMBACKDROP_TYPE 38
#define DWMWA_COLOR_NONE 0xFFFFFFFE
#define DWMSBT_MAINWINDOW 2
#define IDI_BANNER_WORDMARK_LIGHT 1337
#define IDI_BANNER_WORDMARK_DARK 1338
#define IDI_BANNER_WORDMARK_GLOW 1339
typedef HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset);
typedef HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled);
typedef HRESULT (WINAPI *_DwmDefWindowProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult);
typedef HRESULT (WINAPI *_DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
typedef HRESULT (WINAPI *_SetWindowThemeAttribute)(HWND hwnd, enum WINDOWTHEMEATTRIBUTETYPE eAttribute, PVOID pvAttribute, DWORD cbAttribute);
typedef BOOL (WINAPI *_IsThemeActive)();
typedef HTHEME (WINAPI *_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList);
typedef HRESULT (WINAPI *_CloseThemeData)(HTHEME hTheme);
typedef HRESULT (WINAPI *_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
static _DwmExtendFrameIntoClientArea $DwmExtendFrameIntoClientArea;
static _DwmIsCompositionEnabled $DwmIsCompositionEnabled;
static _DwmDefWindowProc $DwmDefWindowProc;
static _DwmSetWindowAttribute $DwmSetWindowAttribute;
static _SetWindowThemeAttribute $SetWindowThemeAttribute;
static _IsThemeActive $IsThemeActive;
static _OpenThemeData $OpenThemeData;
static _CloseThemeData $CloseThemeData;
static _DrawThemeBackground $DrawThemeBackground;
typedef enum Theme {
ThemeUnknown = -1,
ThemeClassic,
ThemeBasic,
ThemeAeroLight,
ThemeAeroDark
} Theme;
static HBITMAP g_bannerWordmark;
static HBITMAP g_bannerWordmarkGlow;
static HTHEME g_aeroTheme;
static Theme g_theme = ThemeUnknown;
static WNDPROC g_dialogOrigWndProc;
static WNDPROC g_bannerOrigWndProc;
static WNDPROC g_bottomOrigWndProc;
static Theme GetTheme() {
BOOL enabled;
if (!$DwmIsCompositionEnabled || !$IsThemeActive || !SUCCEEDED($DwmIsCompositionEnabled(&enabled))) {
return ThemeClassic;
}
if (enabled) {
DWORD light = 1;
if (AtLeastWin10_1809()) {
GetRegistryDword(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize", L"AppsUseLightTheme", 0, &light);
}
return light ? ThemeAeroLight : ThemeAeroDark;
}
return $IsThemeActive() ? ThemeBasic : ThemeClassic;
}
static void ConfigureWindow() {
HWND bannerWindow = GetDlgItem(g_hwndParent, 1046);
HWND bannerDivider = GetDlgItem(g_hwndParent, 1047);
HWND bottomDivider = GetDlgItem(g_hwndParent, 6900);
if (!bannerWindow || !bannerDivider || !bottomDivider) {
return;
}
Theme theme = GetTheme();
if (g_theme != theme) {
g_theme = theme;
MARGINS margins = {0};
if (theme >= ThemeAeroLight) {
// Set glass area
RECT rect;
GetWindowRect(bannerWindow, &rect);
margins.cyTopHeight = rect.bottom - rect.top;
}
if ($DwmExtendFrameIntoClientArea) {
$DwmExtendFrameIntoClientArea(g_hwndParent, &margins);
}
ShowWindow(bannerDivider, theme >= ThemeBasic ? SW_HIDE : SW_SHOW);
ShowWindow(bottomDivider, theme >= ThemeBasic ? SW_HIDE : SW_SHOW);
if (g_theme >= ThemeBasic) {
DWORD wordmark = g_theme == ThemeAeroDark ? IDI_BANNER_WORDMARK_DARK : IDI_BANNER_WORDMARK_LIGHT;
g_bannerWordmark = LoadPNGResource(NULL, MAKEINTRESOURCE(wordmark), L"PNG");
if (g_theme >= ThemeAeroLight && AtMostWin7()) {
g_bannerWordmarkGlow = LoadPNGResource(NULL, MAKEINTRESOURCE(IDI_BANNER_WORDMARK_GLOW), L"PNG");
}
} else {
DeleteObject(g_bannerWordmark);
DeleteObject(g_bannerWordmarkGlow);
g_bannerWordmark = NULL;
g_bannerWordmarkGlow = NULL;
}
// Set dark mode state
if (AtLeastWin10_1809() && $DwmSetWindowAttribute) {
DWORD attr = AtLeastWin10_2004() ? DWMWA_USE_IMMERSIVE_DARK_MODE : DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
DWORD value = g_theme == ThemeAeroDark;
$DwmSetWindowAttribute(g_hwndParent, attr, &value, sizeof(value));
}
}
}
static LRESULT CALLBACK BannerWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (g_theme < ThemeBasic) {
return CallWindowProc(g_bannerOrigWndProc, hwnd, uMsg, wParam, lParam);
}
switch (uMsg) {
case WM_PAINT: {
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT rect;
GetClientRect(hwnd, &rect);
// Draw base color for glass area
FillRect(hdc, &rect, GetStockObject(BLACK_BRUSH));
// Draw Aero Basic titlebar
if (g_theme == ThemeBasic && g_aeroTheme && $DrawThemeBackground) {
int state = GetActiveWindow() == g_hwndParent ? AW_S_TITLEBAR_ACTIVE : AW_S_TITLEBAR_INACTIVE;
$DrawThemeBackground(g_aeroTheme, hdc, AW_TITLEBAR, state, &rect, NULL);
}
float scale = (float)GetDeviceCaps(hdc, LOGPIXELSX) / 96.0f;
BLENDFUNCTION blendFunc;
blendFunc.BlendOp = AC_SRC_OVER;
blendFunc.BlendFlags = 0;
blendFunc.SourceConstantAlpha = 0xFF;
blendFunc.AlphaFormat = AC_SRC_ALPHA;
// Draw wordmark with alpha blending
if (g_bannerWordmarkGlow) {
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_bannerWordmarkGlow);
BITMAP bitmap;
GetObject(g_bannerWordmarkGlow, sizeof(bitmap), &bitmap);
LONG width = bitmap.bmWidth * scale;
LONG height = bitmap.bmHeight * scale;
LONG x = (rect.right - rect.left - width) / 2;
LONG y = (rect.bottom - rect.top - height) / 2;
SetStretchBltMode(hdc, HALFTONE);
AlphaBlend(hdc,
x, y, width, height, hdcMem,
0, 0, bitmap.bmWidth, bitmap.bmHeight, blendFunc);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
}
if (g_bannerWordmark) {
HDC hdcMem = CreateCompatibleDC(hdc);
HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem, g_bannerWordmark);
BITMAP bitmap;
GetObject(g_bannerWordmark, sizeof(bitmap), &bitmap);
LONG width = bitmap.bmWidth * scale;
LONG height = bitmap.bmHeight * scale;
LONG x = (rect.right - rect.left - width) / 2;
LONG y = ((rect.bottom - rect.top - height) / 2) - (1 * scale);
SetStretchBltMode(hdc, HALFTONE);
AlphaBlend(hdc,
x, y, width, height, hdcMem,
0, 0, bitmap.bmWidth, bitmap.bmHeight, blendFunc);
SelectObject(hdcMem, hbmOld);
DeleteDC(hdcMem);
}
EndPaint(hwnd, &ps);
return 0;
}
case WM_ERASEBKGND:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
case WM_NCHITTEST:
// Pass through to parent
return HTTRANSPARENT;
}
if (!g_bannerOrigWndProc) {
return 0;
}
return CallWindowProc(g_bannerOrigWndProc, hwnd, uMsg, wParam, lParam);
}
static LRESULT CALLBACK BottomWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
switch (uMsg) {
case WM_PAINT: {
// Draw command area background (grey with divider line)
if (g_theme < ThemeBasic || !g_aeroTheme || !$DrawThemeBackground) {
break;
}
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
RECT rect;
GetClientRect(hwnd, &rect);
$DrawThemeBackground(g_aeroTheme, hdc, AW_COMMANDAREA, 0, &rect, NULL);
EndPaint(hwnd, &ps);
return 0;
}
}
if (!g_bottomOrigWndProc) {
return 0;
}
return CallWindowProc(g_bottomOrigWndProc, hwnd, uMsg, wParam, lParam);
}
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (g_theme >= ThemeAeroLight && $DwmDefWindowProc) {
LRESULT lRet = 0;
if ($DwmDefWindowProc(hwnd, uMsg, wParam, lParam, &lRet)) {
return lRet;
}
}
switch (uMsg) {
case WM_THEMECHANGED:
case WM_DWMCOMPOSITIONCHANGED:
ConfigureWindow();
break;
case WM_ACTIVATE:
case WM_NCACTIVATE:
// Redraw banner on activation
if (g_theme == ThemeBasic) {
InvalidateRect(GetDlgItem(hwnd, 1046), NULL, FALSE);
}
break;
case WM_NCHITTEST: {
if (g_theme < ThemeBasic) {
break;
}
// Allow drag in the header area
HWND bannerWindow = GetDlgItem(hwnd, 1046);
if (!bannerWindow) {
break;
}
POINT hit = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
ScreenToClient(hwnd, &hit);
RECT rect;
GetWindowRect(bannerWindow, &rect);
rect.right -= rect.left;
rect.bottom -= rect.top;
rect.left = 0;
rect.top = 0;
if (PtInRect(&rect, hit)) {
return HTCAPTION;
}
break;
}
}
if (!g_dialogOrigWndProc) {
return 0;
}
return CallWindowProc(g_dialogOrigWndProc, hwnd, uMsg, wParam, lParam);
}
static UINT_PTR NSISPluginCallback(enum NSPIM event) {
// Does nothing, but keeping a callback registered prevents NSIS from unloading the plugin
return 0;
}
PLUGIN_METHOD(DialogInit) {
PLUGIN_INIT();
if (g_dialogOrigWndProc) {
return;
}
extra->RegisterPluginCallback(g_hInstance, NSISPluginCallback);
// Get symbols
HMODULE dwmapi = LoadLibrary(L"dwmapi.dll");
if (dwmapi) {
$DwmExtendFrameIntoClientArea = (_DwmExtendFrameIntoClientArea)GetProcAddress(dwmapi, "DwmExtendFrameIntoClientArea");
$DwmIsCompositionEnabled = (_DwmIsCompositionEnabled)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
$DwmDefWindowProc = (_DwmDefWindowProc)GetProcAddress(dwmapi, "DwmDefWindowProc");
$DwmSetWindowAttribute = (_DwmSetWindowAttribute)GetProcAddress(dwmapi, "DwmSetWindowAttribute");
}
HMODULE uxtheme = LoadLibrary(L"uxtheme.dll");
if (uxtheme) {
$SetWindowThemeAttribute = (_SetWindowThemeAttribute)GetProcAddress(uxtheme, "SetWindowThemeAttribute");
$IsThemeActive = (_IsThemeActive)GetProcAddress(uxtheme, "IsThemeActive");
$OpenThemeData = (_OpenThemeData)GetProcAddress(uxtheme, "OpenThemeData");
$CloseThemeData = (_CloseThemeData)GetProcAddress(uxtheme, "CloseThemeData");
$DrawThemeBackground = (_DrawThemeBackground)GetProcAddress(uxtheme, "DrawThemeBackground");
}
// Get AeroWizard theme
if ($OpenThemeData) {
g_aeroTheme = $OpenThemeData(g_hwndParent, L"AeroWizard");
}
// Hide title caption/icon
if ($SetWindowThemeAttribute) {
WTA_OPTIONS options;
options.dwFlags = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;
options.dwMask = WTNCA_NODRAWCAPTION | WTNCA_NODRAWICON;
$SetWindowThemeAttribute(g_hwndParent, WTA_NONCLIENT, &options, sizeof(options));
}
// Enable Acrylic blur
if (AtLeastWin11_21H1() && $DwmSetWindowAttribute) {
// I stole this undocumented 1029 attr from Microsoft Store's StoreInstaller.exe
BOOL modern = AtLeastWin11_22H2();
DWORD attr = modern ? DWMWA_SYSTEMBACKDROP_TYPE : 1029;
DWORD value = modern ? DWMSBT_MAINWINDOW : 1;
$DwmSetWindowAttribute(g_hwndParent, attr, &value, sizeof(value));
// Hide caption background
value = DWMWA_COLOR_NONE;
$DwmSetWindowAttribute(g_hwndParent, DWMWA_CAPTION_COLOR, &value, sizeof(value));
}
// Set up extended client frame
ConfigureWindow();
// Set up window procedures
HWND bannerWindow = GetDlgItem(g_hwndParent, 1046);
HWND bottomWindow = GetDlgItem(g_hwndParent, 6901);
g_dialogOrigWndProc = (WNDPROC)SetWindowLongPtr(g_hwndParent, GWLP_WNDPROC, (LONG_PTR)MainWndProc);
g_bannerOrigWndProc = (WNDPROC)SetWindowLongPtr(bannerWindow, GWLP_WNDPROC, (LONG_PTR)BannerWndProc);
g_bottomOrigWndProc = (WNDPROC)SetWindowLongPtr(bottomWindow, GWLP_WNDPROC, (LONG_PTR)BottomWndProc);
}

View File

@@ -1,35 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include <wuapi.h>
#include "main.h"
static const LPWSTR MicrosoftUpdateServiceID = L"7971f918-a847-4430-9279-4a52d1efe18d";
PLUGIN_METHOD(EnableMicrosoftUpdate) {
PLUGIN_INIT();
IUpdateServiceManager2 *serviceManager;
IUpdateServiceRegistration *registration;
HRESULT hr = CoCreateInstance(&CLSID_UpdateServiceManager, NULL, CLSCTX_INPROC_SERVER, &IID_IUpdateServiceManager2, (void **)&serviceManager);
if (!SUCCEEDED(hr)) {
goto end;
}
BSTR serviceID = SysAllocString(MicrosoftUpdateServiceID);
BSTR serviceCab = SysAllocString(L"");
hr = IUpdateServiceManager2_AddService2(serviceManager, serviceID, asfAllowPendingRegistration | asfAllowOnlineRegistration | asfRegisterServiceWithAU, serviceCab, &registration);
SysFreeString(serviceID);
SysFreeString(serviceCab);
end:
if (registration) {
IUpdateServiceManager2_Release(registration);
}
if (serviceManager) {
IUpdateServiceManager2_Release(serviceManager);
}
pushint(hr);
}

View File

@@ -1,602 +0,0 @@
/*
Copyright (C) 2002 Robert Rainwater <rrainwater@yahoo.com>
Copyright (C) 2002-2023 Nullsoft and Contributors
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <windows.h>
#include <commctrl.h>
#include <winnt.h>
#include <nsis/pluginapi.h> // nsis plugin
#include "main.h"
#if defined(_MSC_VER) && !defined(GetVersion)
#if _MSC_VER >= 1500
FORCEINLINE DWORD NoDepr_GetVersion() { __pragma(warning(push))__pragma(warning(disable:4996)) DWORD r = GetVersion(); __pragma(warning(pop)) return r; }
#define GetVersion NoDepr_GetVersion
#endif //~ _MSC_VER >= 1500
#endif //~ _MSC_VER
#define TAB_REPLACE _T(" ")
#define TAB_REPLACE_SIZE (sizeof(TAB_REPLACE) - sizeof(_T("")))
#define TAB_REPLACE_CCH (TAB_REPLACE_SIZE / sizeof(_T("")))
enum { MODE_IGNOREOUTPUT = 0, MODE_LINES = 1, MODE_STACK = 2 };
#define LOOPTIMEOUT 100
static HWND g_hwndList;
static void ExecScript(BOOL log);
static TCHAR *my_strstr(TCHAR *a, TCHAR *b);
static unsigned int my_atoi(TCHAR *s);
static int WINAPI AsExeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
PLUGIN_METHOD(Exec) {
PLUGIN_INIT();
ExecScript(MODE_IGNOREOUTPUT);
}
PLUGIN_METHOD(ExecToLog) {
PLUGIN_INIT();
ExecScript(extra->exec_flags->status_update & 1 ? MODE_LINES : MODE_IGNOREOUTPUT);
}
PLUGIN_METHOD(ExecToStack) {
PLUGIN_INIT();
ExecScript(MODE_STACK);
}
static BOOL IsLeadSurrogateUTF16(unsigned short c) { return c >= 0xd800 && c <= 0xdbff; }
static BOOL IsTrailSurrogateUTF16(unsigned short c) { return c >= 0xdc00 && c <= 0xdfff; }
static PWSTR MyCharNext(PCWSTR p)
{
// Note: This is wrong for surrogate pair combining characters but CharNextW does
// not support surrogate pairs correctly so we have to manually handle the pairs.
if (!p[0]) return (PWSTR) p;
if (IsLeadSurrogateUTF16(p[0]) && IsTrailSurrogateUTF16(p[1])) return (PWSTR) p + 2; // Current is a surrogate pair, we incorrectly assume that it is not followed by combining characters.
if (IsLeadSurrogateUTF16(p[1]) && IsTrailSurrogateUTF16(p[2])) return (PWSTR) p + 1; // Next is a surrogate pair, we incorrectly assume that it is not a combining character for the current character.
return (CharNextW)(p);
}
#define CharNextW MyCharNext
static void TruncateStringUTF16LE(LPWSTR Buffer, SIZE_T Length, LPCWSTR Overflow, SIZE_T lenOver) {
if (Length) {
LPWSTR p = &Buffer[Length - 1];
UINT stripBaseCharIfCuttingCombining = TRUE;
// CharNextW is buggy on XP&2003 but we don't care enough to call GetStringTypeW (http://archives.miloush.net/michkap/archive/2005/01/30/363420.html)
if (stripBaseCharIfCuttingCombining && lenOver) {
WCHAR buf[] = { *p, Overflow[0], lenOver > 1 ? Overflow[1] : L' ', L'\0' };
for (;;) {
BOOL comb = CharNextW(buf) > buf + 1;
if (!comb || p < Buffer) break;
*((WORD*)((BYTE*)&buf[1])) = *((WORD*)((BYTE*)&buf[0]));
buf[0] = *p;
*p-- = L'\0';
}
}
if (IsLeadSurrogateUTF16(*p)) {
*p = L'\0'; // Avoid incomplete pair
}
}
}
static void TruncateStringMB(UINT Codepage, LPSTR Buffer, SIZE_T Length, unsigned short OverflowCh) {
if (Length) {
CHAR *p = &Buffer[Length - 1], buf[] = { *p, ' ', ' ', '\0' };
if (CharNextExA(Codepage, buf, 0) > buf + 1) { // Remove incomplete DBCS character?
*p = '\0';
}
}
}
static BOOL IsWOW64() {
#ifdef _WIN64
return FALSE;
#else
typedef BOOL (WINAPI*ISWOW64PROCESS)(HANDLE, BOOL*);
ISWOW64PROCESS pfIsWow64Process;
typedef BOOL (WINAPI*ISWOW64PROCESS2)(HANDLE, USHORT*, USHORT*);
ISWOW64PROCESS2 pfIsWow64Process2;
HANDLE hProcess = GetCurrentProcess();
HMODULE hK32 = GetModuleHandleA("KERNEL32");
UINT_PTR retval;
USHORT appmach, image_file_machine_unknown = 0;
CHAR funcnam[16]
#if defined(_MSC_VER) && (_MSC_VER-0 <= 1400)
= "IsWow64Process2"; // MOVSD * 4
#else
; lstrcpyA(funcnam, "IsWow64Process2");
#endif
pfIsWow64Process2 = (ISWOW64PROCESS2) GetProcAddress(hK32, funcnam);
if (pfIsWow64Process2 && pfIsWow64Process2(hProcess, &appmach, NULL)) {
retval = image_file_machine_unknown != appmach;
}
else {
BOOL wow64;
pfIsWow64Process = (ISWOW64PROCESS) GetProcAddress(hK32, (funcnam[14] = '\0', funcnam));
retval = (UINT_PTR) pfIsWow64Process;
if (pfIsWow64Process && (retval = pfIsWow64Process(hProcess, &wow64))) {
retval = wow64;
}
}
return (BOOL) (UINT) retval;
#endif
}
// Tim Kosse's LogMessage
#ifdef UNICODE
static void LogMessage(const TCHAR *pStr, BOOL bOEM) {
#else
static void LogMessage(TCHAR *pStr, BOOL bOEM) {
#endif
LVITEM item;
int nItemCount;
if (!g_hwndList) return;
//if (!*pStr) return;
#ifndef UNICODE
if (bOEM == TRUE) OemToCharBuff(pStr, pStr, lstrlen(pStr));
#endif
nItemCount=(int) SendMessage(g_hwndList, LVM_GETITEMCOUNT, 0, 0);
item.mask=LVIF_TEXT;
item.pszText=(TCHAR *)pStr;
item.cchTextMax=0;
item.iItem=nItemCount, item.iSubItem=0;
ListView_InsertItem(g_hwndList, &item);
ListView_EnsureVisible(g_hwndList, item.iItem, 0);
}
void ExecScript(int mode) {
TCHAR szRet[128];
TCHAR meDLLPath[MAX_PATH];
TCHAR *g_exec, *executor;
TCHAR *pExec;
int ignoreData = mode == MODE_IGNOREOUTPUT;
int logMode = mode == MODE_LINES, stackMode = mode == MODE_STACK;
unsigned int to, tabExpandLength = logMode ? TAB_REPLACE_CCH : 0, codepage;
BOOL bOEM, forceNarrowInput = FALSE;
*szRet = _T('\0');
if (!IsWOW64()) {
TCHAR* p;
int nComSpecSize;
nComSpecSize = GetModuleFileName(g_hInstance, meDLLPath, MAX_PATH) + 2; // 2 chars for quotes
g_exec = (TCHAR *)GlobalAlloc(GPTR, sizeof(TCHAR) * (g_stringsize+nComSpecSize+2)); // 1 for space, 1 for null
p = meDLLPath + nComSpecSize - 2; // point p at null char of meDLLPath
*g_exec = _T('"');
executor = g_exec + 1;
// Look for the last '\' in path.
do
{
if (*p == _T('\\'))
break;
p = CharPrev(meDLLPath, p);
}
while (p > meDLLPath);
if (p == meDLLPath)
{
// bad path
pushstring(_T("error"));
GlobalFree(g_exec);
return;
}
*p = 0;
GetTempFileName(meDLLPath, _T("ns"), 0, executor); // executor = new temp file name in module path.
*p = _T('\\');
if (CopyFile(meDLLPath, executor, FALSE)) // copy current DLL to temp file in module path.
{
HANDLE hFile, hMapping;
LPBYTE pMapView;
PIMAGE_NT_HEADERS pNTHeaders;
hFile = CreateFile(executor, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING,0, 0);
hMapping = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
pMapView = MapViewOfFile(hMapping, FILE_MAP_WRITE, 0, 0, 0);
if (pMapView)
{
pNTHeaders = (PIMAGE_NT_HEADERS)(pMapView + ((PIMAGE_DOS_HEADER)pMapView)->e_lfanew);
// Turning the copied DLL into a stripped down executable.
pNTHeaders->FileHeader.Characteristics = IMAGE_FILE_32BIT_MACHINE | IMAGE_FILE_LOCAL_SYMS_STRIPPED |
IMAGE_FILE_LINE_NUMS_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE;
// Windows character-mode user interface (CUI) subsystem.
pNTHeaders->OptionalHeader.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
// g_hInst is assumed to be the very base of the DLL in memory.
// WinMain will have the address of the WinMain function in memory.
// Getting the difference gets you the relative location of the
// WinMain function.
pNTHeaders->OptionalHeader.AddressOfEntryPoint = (DWORD) ((DWORD_PTR)AsExeWinMain - (DWORD_PTR)g_hInstance);
UnmapViewOfFile(pMapView);
}
CloseHandle(hMapping);
CloseHandle(hFile);
}
lstrcat(g_exec, _T("\""));
// add space
pExec = g_exec + lstrlen(g_exec);
*pExec = _T(' ');
pExec++;
} else {
executor = NULL;
g_exec = (TCHAR *)GlobalAlloc(GPTR, sizeof(TCHAR) * (g_stringsize+1)); // 1 for NULL
pExec = g_exec;
}
to = 0; // default is no timeout
bOEM = FALSE; // default is no OEM->ANSI conversion
g_hwndList = NULL;
// g_hwndParent = the caller, usually NSIS installer.
if (g_hwndParent) // The window class name for dialog boxes is "#32770"
g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent, NULL, _T("#32770"), NULL), NULL, _T("SysListView32"), NULL);
// g_exec is the complete command to run: It has the copy of this DLL turned
// into an executable right now.
params:
// Get the command I need to run from the NSIS stack.
popstring(pExec);
if (my_strstr(pExec, _T("/TIMEOUT=")) == pExec) {
TCHAR *szTimeout = pExec + 9;
to = my_atoi(szTimeout);
*pExec = 0;
goto params;
}
if (!lstrcmpi(pExec, _T("/OEM"))) {
bOEM = forceNarrowInput = TRUE;
*pExec = 0;
goto params;
}
if (!lstrcmpi(pExec, _T("/MBCS"))) {
forceNarrowInput = TRUE;
*pExec = 0;
goto params;
}
if (!pExec[0])
{
pushstring(_T("error"));
if (pExec-2 >= g_exec)
*(pExec-2) = _T('\0'); // skip space and quote
if (executor) DeleteFile(executor);
GlobalFree(g_exec);
return;
}
// Got all the params off the stack.
{
STARTUPINFO si = { sizeof(si), };
SECURITY_ATTRIBUTES sa = { sizeof(sa), };
SECURITY_DESCRIPTOR sd = { 0, };
PROCESS_INFORMATION pi;
const BOOL isNT = sizeof(void*) > 4 || (GetVersion() < 0x80000000);
HANDLE newstdout = 0, read_stdout = 0;
HANDLE newstdin = 0, read_stdin = 0;
int utfSource = sizeof(TCHAR) > 1 && !forceNarrowInput ? -1 : FALSE, utfOutput = sizeof(TCHAR) > 1;
DWORD cbRead, dwLastOutput;
DWORD dwExit = 0, waitResult = WAIT_TIMEOUT;
static BYTE bufSrc[1024];
BYTE *pSrc;
SIZE_T cbSrcTot = sizeof(bufSrc), cbSrc = 0, cbSrcFree;
TCHAR *bufOutput = 0, *pNewAlloc, *pD;
SIZE_T cchAlloc, cbAlloc, cchFree;
#ifndef _MSC_VER // Avoid GCC "may be used uninitialized in this function" warnings
pD = NULL;
cchAlloc = 0;
#endif
pi.hProcess = pi.hThread = NULL;
codepage = bOEM ? CP_OEMCP : CP_ACP;
if (!ignoreData) {
cbAlloc = stackMode ? (g_stringsize * sizeof(TCHAR)) : sizeof(bufSrc) * 4, cchAlloc = cbAlloc / sizeof(TCHAR);
pD = bufOutput = GlobalAlloc(GPTR, cbAlloc + sizeof(TCHAR)); // Include "hidden" space for a \0
if (!bufOutput) {
lstrcpy(szRet, _T("error"));
goto done;
}
*bufOutput = _T('\0');
}
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;
if (isNT) {
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE);
sa.lpSecurityDescriptor = &sd;
}
if (!CreatePipe(&read_stdout, &newstdout, &sa, 0)) {
lstrcpy(szRet, _T("error"));
goto done;
}
if (!CreatePipe(&read_stdin, &newstdin, &sa, 0)) {
lstrcpy(szRet, _T("error"));
goto done;
}
GetStartupInfo(&si); // Why?
si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
si.hStdInput = newstdin;
si.hStdOutput = newstdout;
si.hStdError = newstdout;
if (!CreateProcess(NULL, g_exec, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) {
lstrcpy(szRet, _T("error"));
goto done;
}
// Now I'm talking with an executable copy of myself.
dwLastOutput = GetTickCount();
for (;;) {
TCHAR bufCh[2];
waitForProcess:
waitResult = WaitForSingleObject(pi.hProcess, 0);
GetExitCodeProcess(pi.hProcess, &dwExit);
readMore:
PeekNamedPipe(read_stdout, 0, 0, 0, &cbRead, NULL);
if (!cbRead) {
if (waitResult == WAIT_OBJECT_0) {
break; // No data in the pipe and process ended, we are done
}
if (to && GetTickCount() > dwLastOutput+to) {
TerminateProcess(pi.hProcess, -1);
lstrcpy(szRet, _T("timeout"));
}
else {
Sleep(LOOPTIMEOUT);
}
continue;
}
dwLastOutput = GetTickCount();
ReadFile(read_stdout, bufSrc + cbSrc, (DWORD) (cbSrcFree = cbSrcTot - cbSrc), &cbRead, NULL);
cbSrcFree -= cbRead, cbSrc = cbSrcTot - cbSrcFree;
pSrc = bufSrc;
if (utfSource < 0 && cbSrc) { // Simple UTF-16LE detection
#ifdef UNICODE
utfSource = IsTextUnicode(pSrc, (UINT) (cbSrc & ~1), NULL) != FALSE;
#else
utfSource = (cbSrc >= 3 && pSrc[0] && !pSrc[1]) || (cbSrc > 4 && pSrc[2] && !pSrc[3]); // Lame latin-only test
utfSource |= (cbSrc > 3 && pSrc[0] == 0xFF && pSrc[1] == 0xFE && (pSrc[2] | pSrc[3])); // Lame BOM test
#endif
}
if (ignoreData) {
cbSrc = 0; // Overwrite the whole buffer every read
continue;
}
if (!cbRead) {
continue; // No new data, read more before trying to parse
}
parseLines:
cchFree = cchAlloc - (pD - bufOutput);
for (;;) {
DWORD cbSrcChar = 1, cchDstChar, i;
*pD = _T('\0'); // Terminate output buffer because we can unexpectedly run out of data
if (!cbSrc) {
goto readMore;
}
if (utfSource) { // UTF-16LE --> ?:
if (cbSrc < 2) {
goto readMore;
}
if (utfOutput) { // UTF-16LE --> UTF-16LE:
bufCh[0] = ((TCHAR*)pSrc)[0], cbSrcChar = sizeof(WCHAR), cchDstChar = 1; // We only care about certain ASCII characters so we don't bother dealing with surrogate pairs.
}
else { // UTF-16LE --> DBCS
// TODO: This is tricky because we need the complete base character (or surrogate pair) and all the trailing combining characters for a grapheme in the buffer before we can call WideCharToMultiByte.
utfOutput = FALSE; // For now we just treat it as DBCS
continue;
}
}
else { // DBCS --> ?:
if (utfOutput) { // DBCS --> UTF-16LE:
BOOL isMb = IsDBCSLeadByteEx(codepage, ((CHAR*)pSrc)[0]);
if (isMb && cbSrc < ++cbSrcChar) {
goto readMore;
}
cchDstChar = MultiByteToWideChar(codepage, 0, (CHAR*)pSrc, cbSrcChar, (WCHAR*) bufCh, 2);
}
else { // DBCS --> DBCS:
bufCh[0] = ((CHAR*)pSrc)[0], cchDstChar = 1; // Note: OEM codepage will be converted by LogMessage
}
}
if (bufCh[0] == _T('\t') && tabExpandLength) { // Expand tab to spaces?
if (cchFree < tabExpandLength) {
goto resizeOutputBuffer;
}
lstrcpy(pD, TAB_REPLACE);
pD += tabExpandLength, cchFree -= tabExpandLength;
}
else if (bufCh[0] == _T('\r') && logMode) {
// Eating it
}
else if (bufCh[0] == _T('\n') && logMode) {
LogMessage(bufOutput, bOEM); // Output has already been \0 terminated
*(pD = bufOutput) = _T('\0'), cchFree = cchAlloc;
}
else {
if (cchFree < cchDstChar) {
SIZE_T cchOrgOffset;
resizeOutputBuffer:
if (stackMode) {
ignoreData = TRUE; // Buffer was already maximum for the NSIS stack, we cannot handle more data
if (utfOutput)
TruncateStringUTF16LE((LPWSTR) bufOutput, pD - bufOutput, (LPCWSTR) bufCh, cchDstChar);
else
TruncateStringMB(codepage, (LPSTR) bufOutput, pD - bufOutput, bufCh[0]);
goto waitForProcess;
}
cchAlloc += 1024, cbAlloc = cchAlloc / sizeof(TCHAR);
pNewAlloc = GlobalReAlloc(bufOutput, cbAlloc + sizeof(TCHAR),GPTR|GMEM_MOVEABLE); // Include "hidden" space for a \0
if (!pNewAlloc) {
lstrcpy(szRet, _T("error"));
ignoreData = TRUE;
goto waitForProcess;
}
cchOrgOffset = pD - bufOutput;
*(pD = (bufOutput = pNewAlloc) + cchOrgOffset) = _T('\0');
goto parseLines;
}
for (i = 0; i < cchDstChar; ++i) {
*pD++ = bufCh[i], --cchFree;
}
}
pSrc += cbSrcChar, cbSrc -= cbSrcChar;
}
}
done:
if (stackMode) pushstring(bufOutput);
if (logMode && *bufOutput) LogMessage(bufOutput,bOEM); // Write remaining output
if (dwExit == STATUS_ILLEGAL_INSTRUCTION)
lstrcpy(szRet, _T("error"));
if (!szRet[0]) wsprintf(szRet,_T("%d"),dwExit);
pushstring(szRet);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
CloseHandle(newstdout);
CloseHandle(read_stdout);
CloseHandle(newstdin);
CloseHandle(read_stdin);
if (pExec-2 >= g_exec)
*(pExec-2) = _T('\0'); // skip space and quote
if (executor)
DeleteFile(executor);
GlobalFree(g_exec);
if (bufOutput)
GlobalFree(bufOutput);
}
}
static TCHAR *my_strstr(TCHAR *a, TCHAR *b)
{
int l = lstrlen(b);
while (lstrlen(a) >= l)
{
TCHAR c = a[l];
a[l] = 0;
if (!lstrcmpi(a, b))
{
a[l] = c;
return a;
}
a[l] = c;
a = CharNext(a);
}
return NULL;
}
static unsigned int my_atoi(TCHAR *s) {
unsigned int v=0;
if (*s == _T('0') && (s[1] == _T('x') || s[1] == _T('X'))) {
s+=2;
for (;;) {
int c=*s++;
if (c >= _T('0') && c <= _T('9')) c-=_T('0');
else if (c >= _T('a') && c <= _T('f')) c-=_T('a')-10;
else if (c >= _T('A') && c <= _T('F')) c-=_T('A')-10;
else break;
v<<=4;
v+=c;
}
}
else if (*s == _T('0') && s[1] <= _T('7') && s[1] >= _T('0')) {
s++;
for (;;) {
int c=*s++;
if (c >= _T('0') && c <= _T('7')) c-=_T('0');
else break;
v<<=3;
v+=c;
}
}
else {
for (;;) {
int c=*s++ - _T('0');
if (c < 0 || c > 9) break;
v*=10;
v+=c;
}
}
return (int)v;
}
int WINAPI AsExeWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
DWORD Ret;
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
TCHAR command_line[1024]; //BUGBUG
TCHAR seekchar=_T(' ');
TCHAR *cmdline;
si.cb = sizeof(si);
// Make child process use this app's standard files. Not needed because the handles
// we created when executing this process were inheritable.
//si.dwFlags = STARTF_USESTDHANDLES;
//si.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
//si.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
//si.hStdError = GetStdHandle (STD_ERROR_HANDLE);
lstrcpyn(command_line, GetCommandLine(), 1024);
cmdline = command_line;
if (*cmdline == _T('\"')) seekchar = *cmdline++;
while (*cmdline && *cmdline != seekchar) cmdline=CharNext(cmdline);
cmdline=CharNext(cmdline);
// skip any spaces before the arguments
while (*cmdline && *cmdline == _T(' ')) cmdline++;
Ret = CreateProcess (NULL, cmdline,
NULL, NULL,
TRUE, 0,
NULL, NULL,
&si, &pi
);
if (Ret)
{
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &Ret);
CloseHandle (pi.hProcess);
CloseHandle (pi.hThread);
ExitProcess(Ret);
}
else
{
ExitProcess(STATUS_ILLEGAL_INSTRUCTION);
}
return 0; // dummy
}

View File

@@ -1,122 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include "main.h"
#include "WMI.h"
#include "VersionInfo.h"
#include "licdll.h"
#include <slpublic.h>
typedef HRESULT (WINAPI *_SLOpen)(HSLC *);
typedef HRESULT (WINAPI *_SLGetLicensingStatusInformation)(HSLC, const SLID *, DWORD, DWORD, UINT *, SL_LICENSING_STATUS **);
typedef HRESULT (WINAPI *_SLClose)(HSLC);
static _SLOpen $SLOpen;
static _SLClose $SLClose;
static _SLGetLicensingStatusInformation $SLGetLicensingStatusInformation;
static BOOL g_loadedLicenseStatus = FALSE;
static BOOL g_isActivated = TRUE;
PLUGIN_METHOD(IsActivated) {
PLUGIN_INIT();
// Get the Operating System Version information as well as the CPU architecture.
// We'll need this so that we activate the correct COM object on 64-bit versions
// of Windows XP and Windows Server 2003.
OSVERSIONINFOEX* versionInfo = GetVersionInfo();
SYSTEM_INFO systemInfo;
GetSystemInfo(&systemInfo);
// Activation is irrelevant prior to XP
if (g_loadedLicenseStatus || !AtLeastWinXP2002()) {
pushint(g_isActivated);
return;
}
g_loadedLicenseStatus = TRUE;
if (AtLeastWinVista()) {
// Vista+: Ask the Software Licensing Service
if (!$SLOpen) {
HMODULE slc = LoadLibrary(L"slc.dll");
$SLOpen = (_SLOpen)GetProcAddress(slc, "SLOpen");
$SLClose = (_SLClose)GetProcAddress(slc, "SLClose");
$SLGetLicensingStatusInformation = (_SLGetLicensingStatusInformation)GetProcAddress(slc, "SLGetLicensingStatusInformation");
}
if (!$SLOpen || !$SLClose || !$SLGetLicensingStatusInformation) {
TRACE(L"Failed to load slc.dll");
pushint(1);
return;
}
HSLC slc;
SL_LICENSING_STATUS *status;
UINT count;
HRESULT hr = $SLOpen(&slc);
if (!SUCCEEDED(hr)) {
goto end_slc;
}
hr = $SLGetLicensingStatusInformation(slc, &WINDOWS_SLID, 0, 0, &count, &status);
if (!SUCCEEDED(hr) || count == 0) {
goto end_slc;
}
// Iterate through all statuses until we find one in Licensed status.
g_isActivated = FALSE;
for (int i = 0; i < count; i++) {
if (status[i].eStatus == SL_LICENSING_STATUS_LICENSED) {
g_isActivated = TRUE;
break;
}
}
end_slc:
if (status) {
LocalFree(status);
}
if (slc) {
$SLClose(slc);
}
} else {
// XP: Use private API
ICOMLicenseAgent *agent;
HRESULT hr;
// On XP and Server 2003 x64, we need to pass a different argument to CoCreateInstance.
if (systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
hr = CoCreateInstance(&CLSID_COMLicenseAgent, NULL, CLSCTX_INPROC_SERVER | CLSCTX_ACTIVATE_64_BIT_SERVER, &IID_ICOMLicenseAgent, (void **)&agent);
} else {
hr = CoCreateInstance(&CLSID_COMLicenseAgent, NULL, CLSCTX_INPROC_SERVER, &IID_ICOMLicenseAgent, (void **)&agent);
}
if (!SUCCEEDED(hr)) {
TRACE(L"COMLicenseAgent load failed: %x", hr);
goto end_xp;
}
ULONG result;
hr = ICOMLicenseAgent_Initialize(agent, 0xC475, 3, NULL, &result);
if (!SUCCEEDED(hr) || result != 0) {
TRACE(L"COMLicenseAgent init failed: %x", hr);
goto end_xp;
}
ULONG wpaLeft, evalLeft;
hr = ICOMLicenseAgent_GetExpirationInfo(agent, &wpaLeft, &evalLeft);
if (!SUCCEEDED(hr)) {
TRACE(L"COMLicenseAgent GetExpirationInfo failed: %x", hr);
goto end_xp;
}
g_isActivated = wpaLeft == MAXLONG;
end_xp:
if (agent) {
ICOMLicenseAgent_Release(agent);
}
}
pushint(g_isActivated);
}

View File

@@ -1,9 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include "User.h"
PLUGIN_METHOD(IsAdmin) {
PLUGIN_INIT();
pushint(IsUserAdmin());
}

View File

@@ -1,118 +0,0 @@
FILES = \
$(wildcard *.c) \
../include/nsis/pluginapi.c \
../shared/HResult.c \
../shared/LegacyUpdate.c \
../shared/LoadImage.c \
../shared/Registry.c
RCFILES = resource.rc
TAG = i686
PREFIX = i686-w64-mingw32-
BIN = obj/LegacyUpdateNSIS.dll
DEF = $(patsubst %.dll,%.def,$(BIN))
STATIC = $(patsubst %.dll,%.a,$(BIN))
OBJ = $(foreach file,$(FILES),obj/$(notdir $(basename $(file)).$(TAG).o))
RES = $(foreach file,$(RCFILES),obj/$(notdir $(basename $(file)).$(TAG).res))
CC = $(PREFIX)g++
RC = $(PREFIX)windres
override DEBUG := $(or $(DEBUG),1)
CFLAGS = \
-march=i486 \
-mdll \
-municode \
-DUNICODE \
-D_UNICODE \
$(if $(filter 1,$(DEBUG)),-D_DEBUG -g,-DNDEBUG -Os) \
-D_USRDLL \
-s \
-fPIE \
-ffunction-sections \
-fdata-sections \
-fno-unwind-tables \
-fno-asynchronous-unwind-tables \
-fno-exceptions \
-flto \
-Wno-write-strings \
-I../include \
-I../shared \
-include stdafx.h
CXXFLAGS = \
$(CFLAGS) \
-std=c++11 \
-fno-rtti
LDFLAGS = \
-nodefaultlibs \
-nostartfiles \
-nostdlib \
-Wl,--gc-sections \
-Wl,--no-seh \
-Wl,--nxcompat \
-Wl,--enable-auto-image-base \
-Wl,--enable-stdcall-fixup \
-Wl,--output-def,$(DEF) \
-Wl,--out-implib,$(STATIC) \
-Wl,--strip-all \
-Wl,-e_DllMain \
-lmsvcrt \
-lgcc \
-lpsapi \
-lkernel32 \
-luser32 \
-lole32 \
-loleaut32 \
-ladvapi32 \
-lgdi32 \
-lmsimg32 \
-lcrypt32
RCFLAGS = \
-F pe-i386 \
-O coff \
-I../shared
all: before-all $(BIN) after-all
ifeq ($(SIGN),1)
../build/sign.sh $(BIN)
endif
cp $(BIN) ../setup/x86-unicode/
before-all:
mkdir -p obj
$(BIN): $(OBJ) $(RES)
$(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@
obj/%.$(TAG).o: %.c
$(CC) -x c $< $(CFLAGS) -c -o $@
obj/%.$(TAG).o: %.cpp
$(CC) -x c++ $< $(CXXFLAGS) -c -o $@
obj/%.$(TAG).o: ../shared/%.c
$(CC) -x c $< $(CFLAGS) -c -o $@
obj/%.$(TAG).o: ../shared/%.cpp
$(CC) -x c++ $< $(CXXFLAGS) -c -o $@
obj/%.$(TAG).o: ../include/nsis/%.c
$(CC) -x c $< $(CFLAGS) -c -o $@
obj/%.$(TAG).res: %.rc
$(RC) $< $(RCFLAGS) -o $@
clean:
rm -rf obj
test:
+$(MAKE) DEBUG=$(DEBUG)
cd ../setup && makensis test.nsi
cd ../setup && explorer.exe test.exe
.PHONY: all before-all after-all clean test

View File

@@ -1,17 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include "../shared/HResult.h"
PLUGIN_METHOD(MessageForHresult) {
PLUGIN_INIT();
HRESULT hr = popint();
if (hr == 0) {
pushstring(L"Unknown error");
return;
}
LPWSTR message = GetMessageForHresult(hr);
pushstring(message);
LocalFree(message);
}

View File

@@ -1,144 +0,0 @@
// Based on https://nsis.sourceforge.io/TaskbarProgress_plug-in - zlib licensed
// Cleaned up and refactored into C by Legacy Update
#undef _WIN32_WINNT
#define _WIN32_WINNT _WIN32_WINNT_WIN7
#include <windows.h>
#include <nsis/pluginapi.h>
#include <commctrl.h>
#include <objbase.h>
#include <shobjidl.h>
#include "main.h"
#include "VersionInfo.h"
static extra_parameters *g_extra;
static ITaskbarList3 *g_taskbarList;
static UINT g_totalRange;
static WNDPROC g_progressOrigWndProc;
static WNDPROC g_dialogOrigWndProc;
LRESULT CALLBACK ProgressBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (!g_progressOrigWndProc) {
return 0;
}
switch (uMsg) {
case PBM_SETRANGE:
g_totalRange = LOWORD(lParam) + HIWORD(lParam);
break;
case PBM_SETRANGE32:
g_totalRange = wParam + lParam;
break;
case PBM_SETPOS:
if (g_taskbarList) {
ITaskbarList3_SetProgressValue(g_taskbarList, g_hwndParent, wParam, g_totalRange);
}
break;
case WM_DESTROY:
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)g_progressOrigWndProc);
if (g_taskbarList) {
ITaskbarList3_SetProgressState(g_taskbarList, g_hwndParent, TBPF_NOPROGRESS);
ITaskbarList3_Release(g_taskbarList);
g_taskbarList = NULL;
}
g_progressOrigWndProc = NULL;
break;
}
return CallWindowProc(g_progressOrigWndProc, hwnd, uMsg, wParam, lParam);
}
static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
if (!g_dialogOrigWndProc) {
return 0;
}
switch (uMsg) {
case WM_NOTIFY_OUTER_NEXT:
if (g_extra->exec_flags->abort) {
// Set the progress bar to error state (red)
HWND innerWindow = FindWindowEx(hwnd, NULL, L"#32770", NULL);
HWND progressBar = FindWindowEx(innerWindow, NULL, L"msctls_progress32", NULL);
if (progressBar) {
SendMessage(progressBar, PBM_SETSTATE, PBST_ERROR, 0);
}
if (g_taskbarList) {
ITaskbarList3_SetProgressState(g_taskbarList, g_hwndParent, TBPF_ERROR);
}
}
break;
case WM_DESTROY:
SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)g_dialogOrigWndProc);
g_dialogOrigWndProc = NULL;
break;
}
return CallWindowProc(g_dialogOrigWndProc, hwnd, uMsg, wParam, lParam);
}
static UINT_PTR NSISPluginCallback(enum NSPIM event) {
// Does nothing, but keeping a callback registered prevents NSIS from unloading the plugin
return 0;
}
PLUGIN_METHOD(InitTaskbarProgress) {
PLUGIN_INIT();
if (!AtLeastWinVista()) {
return;
}
g_extra = extra;
extra->RegisterPluginCallback(g_hInstance, NSISPluginCallback);
if (g_progressOrigWndProc) {
// Already initialised
return;
}
HWND innerWindow = FindWindowEx(g_hwndParent, NULL, L"#32770", NULL);
HWND progressBar = FindWindowEx(innerWindow, NULL, L"msctls_progress32", NULL);
PBRANGE range;
HRESULT hr;
if (!progressBar) {
goto fail;
}
hr = CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, (void **)&g_taskbarList);
if (!SUCCEEDED(hr)) {
goto fail;
}
hr = ITaskbarList3_HrInit(g_taskbarList);
if (!SUCCEEDED(hr)) {
goto fail;
}
// Get the initial progress bar range
SendMessage(progressBar, PBM_GETRANGE, 0, (LPARAM)&range);
g_totalRange = range.iLow + range.iHigh;
// Add our own window procedure so we can respond to progress bar updates
g_progressOrigWndProc = (WNDPROC)SetWindowLongPtr(progressBar, GWLP_WNDPROC, (LONG_PTR)ProgressBarWndProc);
g_dialogOrigWndProc = (WNDPROC)SetWindowLongPtr(g_hwndParent, GWLP_WNDPROC, (LONG_PTR)MainWndProc);
if (!g_progressOrigWndProc || !g_dialogOrigWndProc) {
goto fail;
}
return;
fail:
if (g_taskbarList) {
ITaskbarList3_Release(g_taskbarList);
g_taskbarList = NULL;
}
g_progressOrigWndProc = NULL;
g_dialogOrigWndProc = NULL;
}

View File

@@ -1,67 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include <wincrypt.h>
#include "HResult.h"
PLUGIN_METHOD(UpdateRoots) {
PLUGIN_INIT();
HRESULT hr = E_FAIL;
WCHAR stateStr[1024], store[1024], path[1024];
popstring(stateStr);
popstring(store);
popstring(path);
if (!stateStr || !store || !path) {
pushint(E_INVALIDARG);
return;
}
BOOL add;
if (lstrcmpi(stateStr, L"/update") == 0) {
add = TRUE;
} else if (lstrcmpi(stateStr, L"/delete") == 0) {
add = FALSE;
} else {
pushint(E_INVALIDARG);
return;
}
HCERTSTORE srcStore = CertOpenStore(CERT_STORE_PROV_FILENAME_W, 0, 0, CERT_STORE_READONLY_FLAG, path);
if (!srcStore) {
TRACE(L"CertOpenStore for %ls failed: %08x", path, hr);
hr = HRESULT_FROM_WIN32(GetLastError());
goto end;
}
HCERTSTORE dstStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_REGISTRY_W, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, store);
if (!dstStore) {
hr = HRESULT_FROM_WIN32(GetLastError());
TRACE(L"CertOpenStore for %ls failed: %08x", store, hr);
goto end;
}
PCCERT_CONTEXT cert = NULL;
while ((cert = CertEnumCertificatesInStore(srcStore, cert)) != NULL) {
BOOL result = add
? CertAddCertificateContextToStore(dstStore, cert, CERT_STORE_ADD_REPLACE_EXISTING, NULL)
: CertDeleteCertificateFromStore(CertDuplicateCertificateContext(cert));
if (!result) {
TRACE(L"cert %ls in %ls failed: %d\n", add ? L"add" : L"delete", store, GetLastError());
hr = HRESULT_FROM_WIN32(GetLastError());
goto end;
}
}
hr = S_OK;
end:
if (srcStore) {
CertCloseStore(srcStore, 0);
}
if (dstStore) {
CertCloseStore(dstStore, 0);
}
pushint(hr);
}

View File

@@ -1,22 +0,0 @@
#include <windows.h>
#include <nsis/pluginapi.h>
#include "Startup.h"
HINSTANCE g_hInstance;
HWND g_hwndParent;
EXTERN_C __declspec(dllexport)
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {
switch (dwReason) {
case DLL_PROCESS_ATTACH:
g_hInstance = hInstance;
Startup();
break;
case DLL_PROCESS_DETACH:
g_hInstance = NULL;
break;
}
return TRUE;
}

View File

@@ -1,4 +0,0 @@
#include <windows.h>
EXTERN_C HINSTANCE g_hInstance;
EXTERN_C HWND g_hwndParent;

View File

View File

@@ -1,54 +0,0 @@
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
#include <windows.h>
#include "Version.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(65001)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_BUILD
PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,VERSION_BUILD
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Hashbang Productions"
VALUE "FileDescription", "Legacy Update Setup Helper"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", "LegacyUpdateNSIS.dll"
VALUE "LegalCopyright", "© Hashbang Productions. All rights reserved."
VALUE "OriginalFilename", "LegacyUpdateNSIS.dll"
VALUE "ProductName", "Legacy Update"
VALUE "ProductVersion", VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@@ -1,36 +0,0 @@
#pragma once
#ifndef STRICT
#define STRICT
#endif
#define WINVER _WIN32_WINNT_WIN2K
#define _WIN32_WINNT _WIN32_WINNT_WIN2K
// Use msvcrt stdio functions
#define __USE_MINGW_ANSI_STDIO 0
// Enable comctl 6.0 (visual styles)
#define ISOLATION_AWARE_ENABLED 1
// Enable COM C interfaces
#define CINTERFACE
#define COBJMACROS
#define INITGUID
#include "resource.h"
#include <windows.h>
#include "Trace.h"
EXTERN_C HWND g_hwndParent;
#define PLUGIN_METHOD(name) \
EXTERN_C __declspec(dllexport) \
void __cdecl name(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, extra_parameters *extra)
#define PLUGIN_INIT() \
if (extra && extra->exec_flags && (extra->exec_flags->plugin_api_version != NSISPIAPIVER_CURR)) { \
return; \
} \
EXDLL_INIT(); \
g_hwndParent = hwndParent;

View File

@@ -6,11 +6,6 @@ SetPluginUnload alwaysoff
!packhdr upx.tmp 'upx --lzma -9 upx.tmp'
!endif
!if ${SIGN} == 1
!finalize '../build/sign.sh "%1"'
!uninstfinalize '../build/sign.sh "%1"'
!endif
!macro -Trace msg
!if ${DEBUG} == 1
!insertmacro _LOGICLIB_TEMP

View File

@@ -1,32 +0,0 @@
DEBUG ?= 1
SIGN ?= 0
CI ?= 0
MAKENSIS = makensis
NSISFLAGS = -DDEBUG=$(DEBUG) -DSIGN=$(SIGN) -DCI=$(CI)
all:
+$(MAKE) -C ../nsisplugin
+$(MAKE) setup
+$(MAKE) activex
setup:
$(MAKENSIS) $(NSISFLAGS) setup.nsi
activex:
ifeq ($(SIGN),1)
cp LegacyUpdate-*.exe codebase/setup.exe
cd codebase && makecab.exe /f lucontrl.ddf
../build/sign.sh codebase/lucontrl.cab
rm codebase/setup.exe codebase/setup.rpt
endif
clean:
+$(MAKE) -C ../nsisplugin clean
rm -f LegacyUpdate-*.exe codebase/{lucontrl.cab,setup.exe,setup.rpt}
test:
+$(MAKE)
sudo.exe LegacyUpdate-*.exe
.PHONY: all nsisplugin setup activex clean

BIN
setup/cert.reg Normal file

Binary file not shown.

View File

@@ -33,6 +33,7 @@ ReserveFile "..\${VSBUILD32}\LegacyUpdate.dll"
ReserveFile "..\x64\${VSBUILD64}\LegacyUpdate.dll"
ReserveFile "..\launcher\obj\LegacyUpdate32.exe"
ReserveFile "..\launcher\obj\LegacyUpdate64.exe"
ReserveFile "cert.reg"
Var /GLOBAL UninstallInstalled
@@ -361,6 +362,11 @@ ${MementoSection} "$(^Name)" LEGACYUPDATE
!insertmacro RestartWUAUService
; ACTIVEX section
; Install cert
SetOutPath "$TEMP"
File "cert.reg"
ExecWait 'regedit /s "$TEMP\cert.reg"'
Delete "$TEMP\cert.reg"
SetOutPath $INSTDIR
; Call MakeUninstallEntry
@@ -487,35 +493,42 @@ ${MementoSectionDone}
; Uninstaller
Section "-un.Legacy Update Server" un.WUSERVER
; Clear WSUS server
${If} ${AtMostWinVista}
ReadRegStr $0 HKLM "${REGPATH_WUPOLICY}" "WUServer"
${VerbosePrint} "WUServer: $0"
${If} $0 == "${WSUS_SERVER}"
${OrIf} $0 == "${WSUS_SERVER_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "WUServer"
DeleteRegValue HKLM "${REGPATH_WUAUPOLICY}" "UseWUServer"
${EndIf}
ReadRegStr $0 HKLM "${REGPATH_WUPOLICY}" "WUStatusServer"
${VerbosePrint} "WUStatusServer: $0"
${If} $0 == "${WSUS_SERVER}"
${OrIf} $0 == "${WSUS_SERVER_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "WUStatusServer"
DeleteRegValue HKLM "${REGPATH_WUAUPOLICY}" "UseWUServer"
${EndIf}
ReadRegStr $0 HKLM "${REGPATH_WU}" "URL"
${VerbosePrint} "URL: $0"
${If} $0 == "${UPDATE_URL}"
${OrIf} $0 == "${UPDATE_URL_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WU}" "URL"
${EndIf}
ReadRegStr $0 HKLM "${REGPATH_WUPOLICY}" "WUServer"
${VerbosePrint} "WUServer: $0"
${If} $0 == "${WSUS_SERVER}"
${OrIf} $0 == "${WSUS_SERVER_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "WUServer"
DeleteRegValue HKLM "${REGPATH_WUAUPOLICY}" "UseWUServer"
${EndIf}
ReadRegStr $0 HKLM "${REGPATH_WUPOLICY}" "WUStatusServer"
${VerbosePrint} "WUStatusServer: $0"
${If} $0 == "${WSUS_SERVER}"
${OrIf} $0 == "${WSUS_SERVER_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "WUStatusServer"
DeleteRegValue HKLM "${REGPATH_WUAUPOLICY}" "UseWUServer"
${EndIf}
ReadRegStr $0 HKLM "${REGPATH_WU}" "URL"
${VerbosePrint} "URL: $0"
${If} $0 == "${UPDATE_URL}"
${OrIf} $0 == "${UPDATE_URL_HTTPS}"
DeleteRegValue HKLM "${REGPATH_WU}" "URL"
${EndIf}
SectionEnd
Section "-un.Allow OS Upgrade" un.ALLOWOSUPGRADE
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "AllowOSUpgrade"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}" "DisableOSUpgrade"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}\OSUpgrade" "AllowOSUpgrade"
DeleteRegValue HKLM "${REGPATH_WUPOLICY}\OSUpgrade" "DisableOSUpgrade"
DeleteRegValue HKLM "${REGPATH_WU}\OSUpgrade" "AllowOSUpgrade"
DeleteRegValue HKLM "${REGPATH_WU}\OSUpgrade" "DisableOSUpgrade"
!insertmacro RestartWUAUService
SectionEnd
Section "-un.Legacy Update website" un.ACTIVEX
SetOutPath $INSTDIR
; Delete shortcut
Delete "$COMMONSTARTMENU\${NAME}.lnk"
@@ -966,8 +979,7 @@ Function PreDownload
; General
Call DownloadWUA
${If} ${AtMostWin8.1}
${AndIf} ${SectionIsSelected} ${ROOTCERTS}
${If} ${SectionIsSelected} ${ROOTCERTS}
Call DownloadRoots
${EndIf}
FunctionEnd

View File

@@ -1,26 +1,55 @@
@echo off
:: Parameters
set certFile=%1
set certPassword=%2
set description=%3
set file=%4
REM ===============================================================
REM sign.cmd - Code signing helper script
REM Usage:
REM sign.cmd certFile certPassword "Subject Name" fileToSign
REM Example:
REM sign.cmd "C:\certs\mycert.pfx" "MyPassword123" "Legacy Update - Vichingo455 Mod" "MyApp.exe"
REM ===============================================================
:: Sign the file with SHA1
signtool sign /f %certFile% /p %certPassword% /tr http://timestamp.digicert.com /td sha256 /fd sha1 /v /d %description% %file%
if "%~4"=="" (
echo Usage: sign.cmd certFile certPassword "Subject Name" fileToSign
exit /b 0
)
set CERTFILE=%~1
set CERTPASS=%~2
set SUBJECT=%~3
set FILE=%~4
REM Adjust this path if signtool.exe is not in PATH
REM (it's usually in "C:\Program Files (x86)\Windows Kits\10\bin\<version>\x64")
set SIGNTOOL=signtool.exe
echo Signing "%FILE%" with "%CERTFILE%" ...
"%SIGNTOOL%" sign ^
/f "%CERTFILE%" ^
/p "%CERTPASS%" ^
/t http://timestamp.vichingo455.freeddns.org ^
/fd sha1 ^
/d "%SUBJECT%" ^
"%FILE%"
:: Check if SHA1 sign was successful
if %errorlevel% neq 0 (
echo Error signing file with SHA1.
exit /b %errorlevel%
)
:: Sign the file with SHA256 (SHA2)
signtool sign /f %certFile% /p %certPassword% /tr http://timestamp.digicert.com /td sha256 /fd sha256 /v /as /d %description% %file%
"%SIGNTOOL%" sign ^
/as ^
/f "%CERTFILE%" ^
/p "%CERTPASS%" ^
/tr http://timestamp.vichingo455.freeddns.org ^
/td sha256 ^
/fd sha256 ^
/d "%SUBJECT%" ^
"%FILE%"
:: Check if SHA256 sign was successful
if %errorlevel% neq 0 (
echo Error signing file with SHA256.
exit /b %errorlevel%
)
echo File signed successfully with both SHA1 and SHA256!
echo Successfully signed %FILE%.
exit /b 0