Compare commits
11 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dd12c02a5 | ||
|
|
49ee9b1079 | ||
|
|
a22a3b0cfd | ||
|
|
4490dd1599 | ||
|
|
346a14a25a | ||
|
|
bbfa313804 | ||
|
|
6cc07f5bac | ||
|
|
747b509a0c | ||
|
|
744062944d | ||
|
|
8916b0c348 | ||
|
|
46c466a864 |
13 changed files with 84 additions and 27 deletions
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
|
|
@ -13,6 +13,7 @@ jobs:
|
|||
env:
|
||||
solution: AmagnoVirtualPrinter.sln
|
||||
configuration: Release
|
||||
certificatepassword: ${{ secrets.CERTIFICATEPASSWORD }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
|
@ -24,8 +25,14 @@ jobs:
|
|||
run: msbuild $env:solution /m /t:Restore /p:Configuration=$env:configuration
|
||||
- name: Build solution
|
||||
run: msbuild $env:solution /m /t:Rebuild /p:Configuration=$env:configuration
|
||||
- name: Create msi from PowerShell Script
|
||||
- name: Sign setup files with PowerShell Script
|
||||
shell: powershell
|
||||
run: powershell -file .\$GITHUB_WORKSPACE\sign_files.ps1 -Path .\$GITHUB_WORKSPACE\Files -CertPath .\$GITHUB_WORKSPACE\codeSigningCert.pfx -CertPwd $env:certificatepassword
|
||||
- name: Create msi with PowerShell Script
|
||||
run: pwsh -command ".\$GITHUB_WORKSPACE\create_msi.ps1"
|
||||
- name: Sign msi with PowerShell Script
|
||||
shell: powershell
|
||||
run: powershell -file .\$GITHUB_WORKSPACE\sign_setup.ps1 -CertPath .\$GITHUB_WORKSPACE\codeSigningCert.pfx -CertPwd $env:certificatepassword
|
||||
- name: Upload files artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
|
|||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -8,7 +8,7 @@ on:
|
|||
jobs:
|
||||
call-build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
|
||||
secrets: inherit
|
||||
release:
|
||||
runs-on: windows-latest
|
||||
needs: call-build
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -17,6 +17,7 @@
|
|||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
*.msi
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
|
|
@ -235,7 +236,6 @@ ClientBin/
|
|||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -147,7 +147,7 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
var machine = job.MachineName?.TrimStart('\\');
|
||||
var username = job.UserName;
|
||||
|
||||
LogDebug($"Searching for session of {domain}\\{username} on {machine} !");
|
||||
LogDebug($"Searching for session of {domain}\\{username} on {machine}!");
|
||||
|
||||
if (domain == null || machine == null || username == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
[NotNull]
|
||||
private readonly IJobProcessor _jobProcessor;
|
||||
|
||||
private IDirectoryHelper _directoryHelper;
|
||||
[NotNull]
|
||||
private readonly IDirectoryHelper _directoryHelper;
|
||||
|
||||
private TcpListener _socket;
|
||||
private FileSystemWatcher _watcher;
|
||||
private string _outputDir;
|
||||
|
|
@ -101,19 +103,20 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
|
||||
LogDebug($"{remote} --> {local}");
|
||||
job = _jobFactory.Create(printer, client.GetStream());
|
||||
if (job == null)
|
||||
{
|
||||
LogError("Job could not be created.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogDebug($"Temporarily printed '{job.RawDataPath}'!");
|
||||
socket.BeginAcceptTcpClient(HandleClient, ar.AsyncState);
|
||||
|
||||
_jobService.Start(job);
|
||||
|
||||
RestartFileWatcherIfNeeded(job.SessionInfo.Sid);
|
||||
|
||||
if (job == null)
|
||||
{
|
||||
LogError("Job could not be created. Check your Printer Settings.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug($"Temporarily printed '{job.RawDataPath}'!");
|
||||
_jobService.Start(job);
|
||||
RestartFileWatcherIfNeeded(job.SessionInfo.Sid);
|
||||
}
|
||||
}
|
||||
|
||||
private void RestartFileWatcherIfNeeded(string sid)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace AmagnoVirtualPrinter.Utils
|
|||
}
|
||||
|
||||
[ContractAnnotation("key:null => void")]
|
||||
private void CheckForNull(RegistryKey key, string keyName)
|
||||
private static void CheckForNull(RegistryKey key, string keyName)
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,14 @@ namespace AmagnoVirtualPrinter.SetupDriver
|
|||
try
|
||||
{
|
||||
Console.WriteLine(exe + " " + args);
|
||||
using(var proc = Process.Start(exe, args))
|
||||
|
||||
var processStartInfo = new ProcessStartInfo(exe, args)
|
||||
{
|
||||
Verb = "runas",
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
using(var proc = Process.Start(processStartInfo))
|
||||
{
|
||||
proc?.WaitForExit();
|
||||
}
|
||||
|
|
|
|||
14
README.md
14
README.md
|
|
@ -17,22 +17,22 @@ There are two ways of using the _AmagnoVirtualPrinter_:
|
|||
2. [Usage](#usage)
|
||||
1. [Configure](#configure)
|
||||
2. [Debugging](#debugging)
|
||||
3. [License](#license)
|
||||
3. [Create Release](#create-release)
|
||||
|
||||
## Installation
|
||||
|
||||
### From MSI
|
||||
|
||||
If you want to use the official installer, you can download it [here](https://amagno.de) or use the latest release in GitHub. Make sure to run the installer with extended rights. After installation, you may need to [configure](#configure) the _AmagnoVirtualPrinter_.
|
||||
If you want to use the official installer, you can download it [here](https://amagno.de/clients) or use the latest release in GitHub. Make sure to run the installer with extended rights. After installation, you may need to [configure](#configure) the _AmagnoVirtualPrinter_.
|
||||
After installation, a new printer with the name set in _Defaults.cs_ can be located under _Printer & Scanner_ in the Microsoft® Windows settings.
|
||||
|
||||
### From Source
|
||||
|
||||
#### **_Dependencies_**
|
||||
#### Dependencies
|
||||
|
||||
To compile the installer, please make sure the Wix Toolset is installed. The [WixSharp library](https://github.com/oleg-shilo/wixsharp) is used to define the package in `AmagnoVirtualPrinter.WixSharpInstaller`.
|
||||
|
||||
#### **_Create MSI package_**
|
||||
#### Create MSI package
|
||||
|
||||
To install the driver from source, build the project in release mode. When the build is run successfully, open up powershell and navigate to `C:\[Git]\AmagnoVirtualPrinter\Files`. Then run the `AmagnoPrinterInstaller.exe "/MSBUILD:C:\[Git]\AmagnoVirtualPrinter\Installer\AmagnoVirtualPrinter.WixSharpInstaller" "/p:C:\[Git]\AmagnoVirtualPrinter\"` where `/p:` is the output directory for the msi and working directory for the WixSharp project. Make sure the given working directory contains a `Files` folder with all binaries needed for _AmagnoVirtualPrinter_. This command will use WixSharp to create the msi package right next to the AmagnoPrinterInstaller.exe called **AmagnoPrinterInstaller.msi**.
|
||||
|
||||
|
|
@ -54,7 +54,5 @@ The output directory can be set in `Computer\HKEY_CURRENT_USER\SOFTWARE\vpd\Prin
|
|||
|
||||
To debug the _AmagnoVirtualPrinter_, run the msi. After installation, go to _Windows Services_ and stop the _AmagnoPrinterService_. In your IDE, select the AmagnoVirtualPrinter.Agent.Console as startup project and run in debug mode. To start a test print (and debug the solution) start PowerShell or cmd and navigate to the root folder of the repository. Go to `Files` and run `.\setupdrv.exe test`, which will create a test page and send it to the virtual printer. Or just print any document you want to.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
|
||||
## Create Release
|
||||
To create a release, you have to tag a commit. Then the release pipeline compiles the source code, builds the installation, and creates the release on GitHub.
|
||||
|
|
|
|||
BIN
codeSigningCert.pfx
Normal file
BIN
codeSigningCert.pfx
Normal file
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
Set-Location $PSScriptRoot
|
||||
|
||||
$args = "/MSBUILD:$PSScriptRoot\Installer\AmagnoVirtualPrinter.WixSharpInstaller", "/p:$PSScriptRoot"
|
||||
$arguments = "/MSBUILD:$PSScriptRoot\Installer\AmagnoVirtualPrinter.WixSharpInstaller", "/p:$PSScriptRoot"
|
||||
Remove-Item -Path "$PSScriptRoot\Files\*" -Filter '*.pdb' -Force
|
||||
Start-Process -FilePath "$PSScriptRoot\Files\AmagnoPrinterInstaller.exe" -ArgumentList $args -wait
|
||||
Start-Process -FilePath "$PSScriptRoot\Files\AmagnoPrinterInstaller.exe" -ArgumentList $arguments -wait
|
||||
26
sign_files.ps1
Normal file
26
sign_files.ps1
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$path,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$certPath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$certPwd
|
||||
)
|
||||
|
||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPwd)
|
||||
|
||||
$files = Get-ChildItem -Path $path |
|
||||
Where-Object { $_.Extension -in '.dll', '.exe' } |
|
||||
Select-Object -ExpandProperty FullName |
|
||||
Get-AuthenticodeSignature |
|
||||
Where-Object { $_.Status -eq "NotSigned" } |
|
||||
Select-Object -ExpandProperty Path
|
||||
|
||||
foreach($file in $files){
|
||||
Write-Host "Signing... $file"
|
||||
Set-AuthenticodeSignature $file -Certificate $cert -TimestampServer "http://timestamp.digicert.com"
|
||||
}
|
||||
16
sign_setup.ps1
Normal file
16
sign_setup.ps1
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$certPath,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]
|
||||
$certPwd
|
||||
)
|
||||
|
||||
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($certPath, $certPwd)
|
||||
|
||||
$file = "AmagnoPrinterInstaller.msi"
|
||||
|
||||
Write-Host "Signing... $file"
|
||||
Set-AuthenticodeSignature $file -Certificate $cert -TimestampServer "http://timestamp.digicert.com"
|
||||
Loading…
Add table
Add a link
Reference in a new issue