Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

Fix/printer printable area (#12433)

fufesou6e62c10fa06b
diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml
index b1d751520..3a7a5e826 100644
--- a/.github/workflows/flutter-build.yml
+++ b/.github/workflows/flutter-build.yml
@@ -177,24 +177,24 @@ jobs:
# Download printer driver files and extract them to ./rustdesk
try {
- Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/rustdesk_printer_driver_v4.zip -OutFile rustdesk_printer_driver_v4.zip
+ Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/rustdesk_printer_driver_v4-1.4.zip -OutFile rustdesk_printer_driver_v4-1.4.zip
Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/printer_driver_adapter.zip -OutFile printer_driver_adapter.zip
Invoke-WebRequest -Uri https://github.com/rustdesk/hbb_common/releases/download/driver/sha256sums -OutFile sha256sums
# Check and move the files
- $checksum_driver = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*rustdesk_printer_driver_v4\.zip$').Matches.Groups[1].Value
- $downloadsum_driver = Get-FileHash -Path rustdesk_printer_driver_v4.zip -Algorithm SHA256
- $checksum_dll = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*printer_driver_adapter\.zip$').Matches.Groups[1].Value
- $downloadsum_dll = Get-FileHash -Path printer_driver_adapter.zip -Algorithm SHA256
- if ($checksum_driver -eq $downloadsum_driver.Hash -and $checksum_dll -eq $downloadsum_dll.Hash) {
- Write-Output "rustdesk_printer_driver_v4, checksums match, extract the file."
- Expand-Archive rustdesk_printer_driver_v4.zip -DestinationPath .
+ $checksum_driver = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*rustdesk_printer_driver_v4-1.4\.zip$').Matches.Groups[1].Value
+ $downloadsum_driver = Get-FileHash -Path rustdesk_printer_driver_v4-1.4.zip -Algorithm SHA256
+ $checksum_adapter = (Select-String -Path .\sha256sums -Pattern '^([a-fA-F0-9]{64}) \*printer_driver_adapter\.zip$').Matches.Groups[1].Value
+ $downloadsum_adapter = Get-FileHash -Path printer_driver_adapter.zip -Algorithm SHA256
+ if ($checksum_driver -eq $downloadsum_driver.Hash -and $checksum_adapter -eq $downloadsum_adapter.Hash) {
+ Write-Output "rustdesk_printer_driver_v4-1.4, checksums match, extract the file."
+ Expand-Archive rustdesk_printer_driver_v4-1.4.zip -DestinationPath .
mkdir ./rustdesk/drivers
- mv -Force .\rustdesk_printer_driver_v4 ./rustdesk/drivers/RustDeskPrinterDriver
+ mv -Force .\rustdesk_printer_driver_v4-1.4 ./rustdesk/drivers/RustDeskPrinterDriver
Expand-Archive printer_driver_adapter.zip -DestinationPath .
mv -Force .\printer_driver_adapter.dll ./rustdesk
} elseif ($checksum_driver -ne $downloadsum_driver.Hash) {
- Write-Output "rustdesk_printer_driver_v4, checksums do not match, ignore the file."
+ Write-Output "rustdesk_printer_driver_v4-1.4, checksums do not match, ignore the file."
} else {
Write-Output "printer_driver_adapter.dll, checksums do not match, ignore the file."
}
diff --git a/res/msi/CustomActions/CustomActions.cpp b/res/msi/CustomActions/CustomActions.cpp
index fafbab6b5..1b825398d 100644
--- a/res/msi/CustomActions/CustomActions.cpp
+++ b/res/msi/CustomActions/CustomActions.cpp
@@ -765,6 +765,16 @@ void TryCreateStartServiceByShell(LPWSTR svcName, LPWSTR svcBinary, LPWSTR szSvc
WcaLog(LOGMSG_STANDARD, "Service \"%ls\" is created with shell.", svcName);
}
+ hr = StringCchPrintfW(szCmd, cchCmd, L"/c sc config %ls start= delayed-auto", svcName);
+ if (FAILED(hr)) {
+ WcaLog(LOGMSG_STANDARD, "Failed to format delayed auto-start command for service: %ls, HRESULT: 0x%08X", svcName, hr);
+ } else {
+ hi = ShellExecuteW(NULL, L"open", L"cmd.exe", szCmd, NULL, SW_HIDE);
+ if ((int)hi <= 32) {
+ WcaLog(LOGMSG_STANDARD, "Failed to configure delayed auto-start for service with shell: %d, last error: 0x%08X.", (int)hi, GetLastError());
+ }
+ }
+
// Query and log if the service is running.
for (int k = 0; k < 10; ++k) {
if (!QueryServiceStatusExW(svcName, &svcStatus)) {
diff --git a/res/msi/CustomActions/ServiceUtils.cpp b/res/msi/CustomActions/ServiceUtils.cpp
index 38d0d1d48..0d534d6f0 100644
--- a/res/msi/CustomActions/ServiceUtils.cpp
+++ b/res/msi/CustomActions/ServiceUtils.cpp
@@ -49,6 +49,15 @@ bool MyCreateServiceW(LPCWSTR serviceName, LPCWSTR displayName, LPCWSTR binaryPa
WcaLog(LOGMSG_STANDARD, "Service installed successfully\n");
}
+ SERVICE_DELAYED_AUTO_START_INFO delayedStart = { TRUE };
+ if (!ChangeServiceConfig2W(
+ schService,
+ SERVICE_CONFIG_DELAYED_AUTO_START_INFO,
+ &delayedStart
+ )) {
+ WcaLog(LOGMSG_STANDARD, "Failed to configure delayed auto-start for service: %ls, Error: %d\n", serviceName, GetLastError());
+ }
+
CloseServiceHandle(schService);
CloseServiceHandle(schSCManager);
return true;
diff --git a/src/platform/windows.rs b/src/platform/windows.rs
index a00e9906b..5237b95f8 100644
--- a/src/platform/windows.rs
+++ b/src/platform/windows.rs
@@ -2885,6 +2885,7 @@ fn get_import_config(exe: &str) -> String {
sc stop {app_name}
sc delete {app_name}
sc create {app_name} binpath= \"\\\"{exe}\\\" --import-config \\\"{config_path}\\\"\" start= auto DisplayName= \"{app_name} Service\"
+sc config {app_name} start= delayed-auto
sc start {app_name}
sc stop {app_name}
sc delete {app_name}
@@ -2906,6 +2907,7 @@ if exist \"%PROGRAMDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\{ap
} else {
format!("
sc create {app_name} binpath= \"\\\"{exe}\\\" --service\" start= auto DisplayName= \"{app_name} Service\"
+sc config {app_name} start= delayed-auto
sc start {app_name}
",
app_name = crate::get_app_name())