mirror of
https://github.com/dorssel/usbipd-win.git
synced 2026-11-10 14:43:56 +08:00
Refactor DIFx
- remove deprecated DIFx - add driver custom actions
This commit is contained in:
25 files changed
+391
-47
No files matched your search
@@ -22,9 +22,16 @@
|
||||
*.cs text eol=crlf
|
||||
*.props text
|
||||
|
||||
*.vcxproj text
|
||||
*.filters text
|
||||
*.cpp text
|
||||
*.h text
|
||||
*.def text
|
||||
|
||||
*.wixproj text
|
||||
*.wxs text
|
||||
*.xslt text
|
||||
*.ico binary
|
||||
*.png binary
|
||||
*.xcf binary
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ jobs:
|
||||
env:
|
||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
|
||||
- name: Build (CustomActions)
|
||||
run: msbuild -p:Configuration=Release CustomActions
|
||||
|
||||
- name: Build (Installer)
|
||||
run: dotnet build --configuration Release Installer
|
||||
|
||||
|
||||
@@ -62,13 +62,10 @@ jobs:
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
# - name: Autobuild
|
||||
# uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -81,5 +78,14 @@ jobs:
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
- name: Install dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Build
|
||||
run: dotnet build --configuration Release --no-restore
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
@@ -0,0 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
set noparent
|
||||
linelength=160
|
||||
|
||||
# incompatible with pre-compiled headers
|
||||
filter=-build/include_subdir
|
||||
@@ -0,0 +1,9 @@
|
||||
; SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
;
|
||||
; SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
InstallDrivers
|
||||
UninstallDrivers
|
||||
@@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
-->
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{cbc206bd-0e45-4514-b148-9035c7459268}</ProjectGuid>
|
||||
<RootNamespace>CustomActions</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>false</GenerateManifest>
|
||||
<OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>obj\$(Platform)\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;CUSTOMACTIONS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>CustomActions.def</ModuleDefinitionFile>
|
||||
<SetChecksum>true</SetChecksum>
|
||||
<MinimumRequiredVersion>10.0</MinimumRequiredVersion>
|
||||
<ImportLibrary />
|
||||
<IncrementalLinkDatabaseFile />
|
||||
<ManifestFile />
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile />
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
<ProfileGuidedDatabase />
|
||||
<LinkTimeCodeGenerationObjectFile />
|
||||
<TypeLibraryResourceID />
|
||||
<AdditionalOptions>/NOIMPLIB /NOEXP %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="actions.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CustomActions.def" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="actions.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CustomActions.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,103 @@
|
||||
// SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
using std::wstring;
|
||||
|
||||
|
||||
static void log(MSIHANDLE hInstall, wstring fmt, ...) {
|
||||
auto hRecord = MsiCreateRecord(0);
|
||||
if (!hRecord) {
|
||||
return;
|
||||
}
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
size_t len = _vscwprintf(fmt.c_str(), ap_copy);
|
||||
va_end(ap_copy);
|
||||
wstring message;
|
||||
message.resize(len);
|
||||
vswprintf_s(message.data(), len + 1, fmt.c_str(), ap);
|
||||
va_end(ap);
|
||||
MsiRecordSetString(hRecord, 0, (L"CustomActions: " + message).c_str());
|
||||
MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRecord);
|
||||
MsiCloseHandle(hRecord);
|
||||
}
|
||||
|
||||
|
||||
static void require_reboot(MSIHANDLE hInstall) {
|
||||
log(hInstall, L"Requesting reboot");
|
||||
// This is what WixCheckRebootRequired looks for after InstallFinalize.
|
||||
GlobalAddAtom(L"WcaDeferredActionRequiresReboot");
|
||||
}
|
||||
|
||||
|
||||
static wstring get_property(MSIHANDLE hInstall, const wstring& name) {
|
||||
DWORD valueSize = 0;
|
||||
if (MsiGetProperty(hInstall, name.c_str(), (LPWSTR)L"", &valueSize) != ERROR_MORE_DATA) {
|
||||
return wstring();
|
||||
}
|
||||
++valueSize; // add NUL
|
||||
auto value = std::make_unique<WCHAR[]>(valueSize);
|
||||
if (MsiGetProperty(hInstall, name.c_str(), value.get(), &valueSize) != ERROR_SUCCESS) {
|
||||
return wstring();
|
||||
}
|
||||
return wstring(value.get(), valueSize);
|
||||
}
|
||||
|
||||
|
||||
// This action must run deferred, between InstallFiles and InstallFinalize.
|
||||
UINT __stdcall InstallDrivers(MSIHANDLE hInstall) {
|
||||
auto data = get_property(hInstall, L"CustomActionData");
|
||||
BOOL request_reboot = FALSE;
|
||||
{
|
||||
BOOL need_reboot = FALSE;
|
||||
log(hInstall, L"Installing VBoxUSBMon");
|
||||
if (!DiInstallDriver(NULL, (data + L"Drivers\\VBoxUSBMon\\VBoxUSBMon.inf").c_str(), DIIRFLAG_FORCE_INF, &need_reboot)) {
|
||||
log(hInstall, L"ERROR installing VBoxUSBMon: 0x%08x", GetLastError());
|
||||
return ERROR_INSTALL_FAILURE;
|
||||
}
|
||||
request_reboot |= need_reboot;
|
||||
}
|
||||
{
|
||||
BOOL need_reboot = FALSE;
|
||||
log(hInstall, L"Installing VBoxUSB");
|
||||
if (!DiInstallDriver(NULL, (data + L"Drivers\\VBoxUSB\\VBoxUSB.inf").c_str(), DIIRFLAG_FORCE_INF, &need_reboot)) {
|
||||
log(hInstall, L"ERROR installing VBoxUSB: 0x%08x", GetLastError());
|
||||
return ERROR_INSTALL_FAILURE;
|
||||
}
|
||||
request_reboot |= need_reboot;
|
||||
}
|
||||
if (request_reboot) {
|
||||
require_reboot(hInstall);
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
// This action must run deferred, between InstallFiles and InstallFinalize.
|
||||
UINT __stdcall UninstallDrivers(MSIHANDLE hInstall) {
|
||||
auto data = get_property(hInstall, L"CustomActionData");
|
||||
{
|
||||
BOOL need_reboot = FALSE;
|
||||
log(hInstall, L"Uninstalling VBoxUSB");
|
||||
if (!DiUninstallDriver(NULL, (data + L"Drivers\\VBoxUSB\\VBoxUSB.inf").c_str(), 0, &need_reboot)) {
|
||||
log(hInstall, L"ERROR uninstalling VBoxUSB: 0x%08x", GetLastError());
|
||||
// continue
|
||||
}
|
||||
// ignore need_reboot
|
||||
}
|
||||
{
|
||||
BOOL need_reboot = FALSE;
|
||||
log(hInstall, L"Uninstalling VBoxUSBMon");
|
||||
if (!DiUninstallDriver(NULL, (data + L"Drivers\\VBoxUSBMon\\VBoxUSBMon.inf").c_str(), 0, &need_reboot)) {
|
||||
log(hInstall, L"ERROR uninstalling VBoxUSBMon: 0x%08x", GetLastError());
|
||||
// continue
|
||||
}
|
||||
// ignore need_reboot
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#include "stdafx.h"
|
||||
@@ -0,0 +1,23 @@
|
||||
// SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdarg>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Target Windows 10 or newer (including Windows Server 2019) only
|
||||
#define WINVER 0x0A00
|
||||
#define _WIN32_WINNT 0x0A00
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
// Windows Header Files
|
||||
#include <Windows.h>
|
||||
#include <Msi.h>
|
||||
#include <MsiQuery.h>
|
||||
#pragma comment(lib, "msi.lib")
|
||||
#include <Newdev.h>
|
||||
#pragma comment(lib, "newdev.lib")
|
||||
@@ -62,9 +62,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GitVersion.MsBuild">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="GitVersion.MsBuild" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -18,7 +18,6 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<!-- Usbipd.PowerShell -->
|
||||
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
|
||||
<!-- Installer -->
|
||||
<PackageVersion Include="WixToolset.DifxApp.wixext" Version="4.0.3" />
|
||||
<PackageVersion Include="WixToolset.Firewall.wixext" Version="4.0.3" />
|
||||
<PackageVersion Include="WixToolset.UI.wixext" Version="4.0.3" />
|
||||
<PackageVersion Include="WixToolset.Util.wixext" Version="4.0.3" />
|
||||
|
||||
+8
-13
@@ -4,10 +4,7 @@ SPDX-FileCopyrightText: 2020 Frans van Dorsselaer
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
-->
|
||||
<Wix
|
||||
xmlns="http://wixtoolset.org/schemas/v4/wxs"
|
||||
xmlns:difx="http://wixtoolset.org/schemas/v4/wxs/difxapp"
|
||||
>
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Fragment>
|
||||
<DirectoryRef Id="APPLICATIONFOLDER">
|
||||
<Directory Id="Drivers" Name="Drivers" />
|
||||
@@ -16,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<Fragment>
|
||||
<DirectoryRef Id="Drivers" FileSource="$(var.DriversDir)">
|
||||
<Component Id="Drivers_README.md">
|
||||
<File Name="README.md" />
|
||||
<File Id="Drivers_README.md" Name="README.md" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
</Fragment>
|
||||
@@ -24,14 +21,13 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<DirectoryRef Id="Drivers" FileSource="$(var.DriversDir)">
|
||||
<Directory Id="VBoxUSB" Name="VBoxUSB">
|
||||
<Component Id="VBoxUSB.cat">
|
||||
<File Name="VBoxUSB.cat" />
|
||||
<File Id="VBoxUSB.cat" Name="VBoxUSB.cat" />
|
||||
</Component>
|
||||
<Component Id="VBoxUSB.sys" Bitness="always64">
|
||||
<File Name="VBoxUSB.sys" />
|
||||
<File Id="VBoxUSB.sys" Name="VBoxUSB.sys" />
|
||||
</Component>
|
||||
<Component Id="VBoxUSB.inf">
|
||||
<File Name="VBoxUSB.inf" />
|
||||
<difx:Driver AddRemovePrograms="no" PlugAndPlayPrompt="no" />
|
||||
<File Id="VBoxUSB.inf" Name="VBoxUSB.inf" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</DirectoryRef>
|
||||
@@ -40,14 +36,13 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<DirectoryRef Id="Drivers" FileSource="$(var.DriversDir)">
|
||||
<Directory Id="VBoxUSBMon" Name="VBoxUSBMon">
|
||||
<Component Id="VBoxUSBMon.cat">
|
||||
<File Name="VBoxUSBMon.cat" />
|
||||
<File Id="VBoxUSBMon.cat" Name="VBoxUSBMon.cat" />
|
||||
</Component>
|
||||
<Component Id="VBoxUSBMon.sys" Bitness="always64">
|
||||
<File Name="VBoxUSBMon.sys" />
|
||||
<File Id="VBoxUSBMon.sys" Name="VBoxUSBMon.sys" />
|
||||
</Component>
|
||||
<Component Id="VBoxUSBMon.inf">
|
||||
<File Name="VBoxUSBMon.inf" />
|
||||
<difx:Driver AddRemovePrograms="no" PlugAndPlayPrompt="no" />
|
||||
<File Id="VBoxUSBMon.inf" Name="VBoxUSBMon.inf" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</DirectoryRef>
|
||||
|
||||
@@ -12,12 +12,9 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<PublishDir>..\Usbipd\bin\publish</PublishDir>
|
||||
<PowerShellDir>..\Usbipd.PowerShell\bin\$(Configuration)\netstandard2.0</PowerShellDir>
|
||||
<DefineConstants>PublishDir=$(PublishDir);PowerShellDir=$(PowerShellDir);DriversDir=..\Drivers;Year=$([System.DateTime]::UtcNow.ToString("yyyy"))</DefineConstants>
|
||||
<!-- Suppress WIX1130: DifxApp Driver is deprecated -->
|
||||
<SuppressSpecificWarnings>1130</SuppressSpecificWarnings>
|
||||
<Pedantic>true</Pedantic>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.DifxApp.wixext" />
|
||||
<PackageReference Include="WixToolset.Firewall.wixext" />
|
||||
<PackageReference Include="WixToolset.UI.wixext" />
|
||||
<PackageReference Include="WixToolset.Util.wixext" />
|
||||
|
||||
@@ -13,10 +13,10 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<Fragment>
|
||||
<DirectoryRef Id="PowerShell" FileSource="$(PowerShellDir)">
|
||||
<Component Id="Usbipd.Automation.dll">
|
||||
<File Name="Usbipd.Automation.dll" />
|
||||
<File Id="Usbipd.Automation.dll" Name="Usbipd.Automation.dll" />
|
||||
</Component>
|
||||
<Component Id="Usbipd.PowerShell.dll">
|
||||
<File Name="Usbipd.PowerShell.dll" />
|
||||
<File Id="Usbipd.PowerShell.dll" Name="Usbipd.PowerShell.dll" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
</Fragment>
|
||||
|
||||
+22
-5
@@ -16,7 +16,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
and firewall rule do not use the '-win' postfix.
|
||||
-->
|
||||
<Component Id="usbipd.exe">
|
||||
<File Name="usbipd.exe">
|
||||
<File Id="usbipd.exe" Name="usbipd.exe">
|
||||
<fw:FirewallException
|
||||
Id="usbipd"
|
||||
Name="usbipd"
|
||||
@@ -75,27 +75,44 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
</Component>
|
||||
|
||||
<Component Id="COPYING.md">
|
||||
<File Name="COPYING.md" />
|
||||
<File Id="COPYING.md" Name="COPYING.md" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
<Binary Id="CustomActions" SourceFile="../CustomActions/bin/x64/Release/CustomActions.dll" />
|
||||
|
||||
<!-- This will restore the original Windows drivers for devices that were forced bound. -->
|
||||
<SetProperty Id="RestoreDrivers" Value=""[#usbipd.exe]" unbind --all" Sequence="execute" Before="RestoreDrivers" />
|
||||
<SetProperty Id="RestoreDrivers" Value=""[#usbipd.exe]" unbind --all" Sequence="execute" Before="RestoreDrivers" Condition="(?usbipd.exe=3) AND ($usbipd.exe=2)" />
|
||||
<CustomAction Id="RestoreDrivers" BinaryRef="Wix4UtilCA_X64" DllEntry="WixQuietExec" Return="ignore" Impersonate="no" Execute="deferred" />
|
||||
|
||||
<!-- This will uninstall the drivers. -->
|
||||
<SetProperty Id="UninstallDrivers" Value="[APPLICATIONFOLDER]" Sequence="execute" Before="UninstallDrivers" Condition="(?usbipd.exe=3) AND ($usbipd.exe=2)" />
|
||||
<CustomAction Id="UninstallDrivers" BinaryRef="CustomActions" DllEntry="UninstallDrivers" Impersonate="no" Execute="deferred" />
|
||||
|
||||
<!-- This will install the drivers and report any required reboot. -->
|
||||
<SetProperty Id="InstallDrivers" Value="[APPLICATIONFOLDER]" Sequence="execute" Before="InstallDrivers" Condition="$usbipd.exe=3" />
|
||||
<CustomAction Id="InstallDrivers" BinaryRef="CustomActions" DllEntry="InstallDrivers" Impersonate="no" Execute="deferred" />
|
||||
<CustomAction Id="WixCheckRebootRequired" BinaryRef="Wix4UtilCA_X64" DllEntry="WixCheckRebootRequired" Return="ignore" Execute="immediate" />
|
||||
|
||||
<!--
|
||||
This will *try to* start the service. However, unlike ServiceControl, it will not fail if it can't.
|
||||
Now that usbipd depends on VBoxUsbMon, sometimes Windows requires a reboot before the service can start.
|
||||
The CLI tool will inform the user if the service is not running and that a reboot should fix that.
|
||||
-->
|
||||
<SetProperty Id="TryStartService" Value=""[System64Folder]\sc.exe" start usbipd" Sequence="execute" Before="TryStartService" />
|
||||
<SetProperty Id="TryStartService" Value=""[System64Folder]\sc.exe" start usbipd" Sequence="execute" Before="TryStartService" Condition="$usbipd.exe=3" />
|
||||
<CustomAction Id="TryStartService" BinaryRef="Wix4UtilCA_X64" DllEntry="WixQuietExec" Return="ignore" Impersonate="no" Execute="deferred" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<!-- Condition: usbipd.exe is installed and will be uninstalled -->
|
||||
<Custom Action="RestoreDrivers" After="StopServices" Condition="(?usbipd.exe=3) AND ($usbipd.exe=2)" />
|
||||
<!-- Condition: usbipd.exe is installed and will be uninstalled -->
|
||||
<Custom Action="UninstallDrivers" After="RestoreDrivers" Condition="(?usbipd.exe=3) AND ($usbipd.exe=2)" />
|
||||
<!-- Condition: usbipd.exe will be (or remains) installed -->
|
||||
<Custom Action="TryStartService" Before="InstallFinalize" Condition="$usbipd.exe=3" />
|
||||
<Custom Action="InstallDrivers" Before="InstallServices" Condition="$usbipd.exe=3" />
|
||||
<!-- Condition: usbipd.exe will be (or remains) installed -->
|
||||
<Custom Action="TryStartService" After="StartServices" Condition="$usbipd.exe=3" />
|
||||
<!-- Condition: usbipd.exe will be (or remains) installed (i.e., don't bother the user with reboots for uninstall) -->
|
||||
<Custom Action="WixCheckRebootRequired" After="InstallFinalize" Condition="$usbipd.exe=3" />
|
||||
</InstallExecuteSequence>
|
||||
</Fragment>
|
||||
<Fragment>
|
||||
|
||||
@@ -89,6 +89,13 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
-->
|
||||
<Binary Id="banner.png" SourceFile="banner.png" />
|
||||
|
||||
<!--
|
||||
The Error dialog has an icon control. At runtime, msiexec will replace the image with
|
||||
the correct one for the message. However, at dialog creation time a valid default (dummy) icon
|
||||
has to be present, or else msiexec will log an error (even though the default image is actually never shown/used).
|
||||
-->
|
||||
<Binary Id="dummy.ico" SourceFile="dummy.ico" />
|
||||
|
||||
<!--
|
||||
These are the nearest to FluentUI as recommended by https://docs.microsoft.com/en-us/windows/uwp/design/style/typography.
|
||||
-->
|
||||
@@ -532,7 +539,7 @@ Published under the terms of the <a href="https://www.gnu.org/licenses/g
|
||||
<!--
|
||||
The image will be replaced by MSI.
|
||||
-->
|
||||
<Control Id="ErrorIcon" Type="Icon" X="19" Y="20" Width="24" Height="24" FixedSize="yes" IconSize="32" Text="banner.png" />
|
||||
<Control Id="ErrorIcon" Type="Icon" X="19" Y="20" Width="24" Height="24" FixedSize="yes" IconSize="32" Text="dummy.ico" />
|
||||
</Dialog>
|
||||
|
||||
<!--
|
||||
|
||||
+13
-5
@@ -14,13 +14,13 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
<Fragment>
|
||||
<DirectoryRef Id="WSL" FileSource="$(var.PublishDir)\WSL">
|
||||
<Component Id="WSL_README.md">
|
||||
<File Name="README.md" />
|
||||
<File Id="WSL_README.md" Name="README.md" />
|
||||
</Component>
|
||||
<Component Id="usbip">
|
||||
<File Name="usbip" />
|
||||
<File Id="usbip" Name="usbip" />
|
||||
</Component>
|
||||
<Component Id="auto_attach.sh">
|
||||
<File Name="auto-attach.sh" />
|
||||
<File Id="auto_attach.sh" Name="auto-attach.sh" />
|
||||
</Component>
|
||||
</DirectoryRef>
|
||||
|
||||
@@ -32,7 +32,11 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
NOTE: Add the following for any non-executable files.
|
||||
-->
|
||||
<!--
|
||||
<SetProperty Id="FixExecutionRights_file.id" Value=""[System64Folder]\icacls.exe" "[#file.id]" /deny "*S-1-1-0:(X)"" Sequence="execute" Before="FixExecutionRights_file.id" />
|
||||
<SetProperty
|
||||
Id="FixExecutionRights_file.id"
|
||||
Value=""[System64Folder]\icacls.exe" "[#file.id]" /deny "*S-1-1-0:(X)""
|
||||
Sequence="execute" Before="FixExecutionRights_file.id" Condition="$file.id=3"
|
||||
/>
|
||||
<CustomAction Id="FixExecutionRights_file.id" BinaryRef="Wix4UtilCA_X64" DllEntry="WixQuietExec" Return="ignore" Impersonate="no" Execute="deferred" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
@@ -40,7 +44,11 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
</InstallExecuteSequence>
|
||||
-->
|
||||
|
||||
<SetProperty Id="FixExecutionRights_WSL_README.md" Value=""[System64Folder]\icacls.exe" "[#WSL_README.md]" /deny "*S-1-1-0:(X)"" Sequence="execute" Before="FixExecutionRights_WSL_README.md" />
|
||||
<SetProperty
|
||||
Id="FixExecutionRights_WSL_README.md"
|
||||
Value=""[System64Folder]\icacls.exe" "[#WSL_README.md]" /deny "*S-1-1-0:(X)""
|
||||
Sequence="execute" Before="FixExecutionRights_WSL_README.md" Condition="$WSL_README.md=3"
|
||||
/>
|
||||
<CustomAction Id="FixExecutionRights_WSL_README.md" BinaryRef="Wix4UtilCA_X64" DllEntry="WixQuietExec" Return="ignore" Impersonate="no" Execute="deferred" />
|
||||
|
||||
<InstallExecuteSequence>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2024 Frans van Dorsselaer
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
@@ -14,9 +14,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" PrivateAssets="all" />
|
||||
<PackageReference Include="Moq" />
|
||||
<PackageReference Include="MSTest.TestAdapter" />
|
||||
<PackageReference Include="MSTest.TestFramework" />
|
||||
|
||||
@@ -11,9 +11,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="PowerShellStandard.Library">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PowerShellStandard.Library" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -27,9 +27,7 @@ SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" PrivateAssets="all" />
|
||||
<PackageReference Include="System.CommandLine" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Installer", "Installer\Inst
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3C3ED2C8-54D0-48D4-8BF4-78220D4A9E20} = {3C3ED2C8-54D0-48D4-8BF4-78220D4A9E20}
|
||||
{5CE75792-6F4F-4B16-83E6-29052C6E0D8D} = {5CE75792-6F4F-4B16-83E6-29052C6E0D8D}
|
||||
{CBC206BD-0E45-4514-B148-9035C7459268} = {CBC206BD-0E45-4514-B148-9035C7459268}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{03DA15B4-7F40-4EF3-814B-9050C7A671B5}"
|
||||
@@ -35,6 +36,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Usbipd.Automation", "Usbipd
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UsbIds", "UsbIds\UsbIds.csproj", "{FC600539-9D82-4822-B2A0-7157D166A444}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CustomActions", "CustomActions\CustomActions.vcxproj", "{CBC206BD-0E45-4514-B148-9035C7459268}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
@@ -63,6 +66,9 @@ Global
|
||||
{FC600539-9D82-4822-B2A0-7157D166A444}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{FC600539-9D82-4822-B2A0-7157D166A444}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{FC600539-9D82-4822-B2A0-7157D166A444}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CBC206BD-0E45-4514-B148-9035C7459268}.Debug|x64.ActiveCfg = Release|x64
|
||||
{CBC206BD-0E45-4514-B148-9035C7459268}.Debug|x64.Build.0 = Release|x64
|
||||
{CBC206BD-0E45-4514-B148-9035C7459268}.Release|x64.ActiveCfg = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
Reference in new issue
Block a user