diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index 6e7f21e9522bc50d871c6ebc54d02050a8a6e318..2b2e7da0a219d7f28aac37ba8fc9093c22f8dbc4 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -1,5 +1,10 @@
 $Id$
 
+2024-01-19  Christian Franke  <franke@computer.org>
+
+	os_win32/installer.nsi: Avoid that code signing invalidates the
+	uninstaller.
+
 2024-01-17  Christian Franke  <franke@computer.org>
 
 	utility.cpp: Add git commit hash to '-V' output if available.
diff --git a/smartmontools/os_win32/installer.nsi b/smartmontools/os_win32/installer.nsi
index fc3fd5dd3c13c43f0be96b8e6210c63f2a2fa75a..460ec9e61118f04e32ae165f5f0f0bd2feb713a8 100644
--- a/smartmontools/os_win32/installer.nsi
+++ b/smartmontools/os_win32/installer.nsi
@@ -3,7 +3,7 @@
 ;
 ; Home page of code is: https://www.smartmontools.org
 ;
-; Copyright (C) 2006-23 Christian Franke
+; Copyright (C) 2006-24 Christian Franke
 ;
 ; SPDX-License-Identifier: GPL-2.0-or-later
 ;
@@ -261,6 +261,17 @@ Section "Uninstaller" UNINST_SECTION
 
 SectionEnd
 
+; Run dummy "signing" command after creation of the uninstaller.
+; This avoids that the uninstaller inherits the file header
+; from the installer.  Otherwise some header fields (checksum,
+; security directory entry) of the uninstaller would be invalid if
+; the installer file is later modified by code signing.
+!if "${NSIS_PACKEDVERSION}" >= 0x03008000 ; Requires NSIS >= 3.08
+  !uninstfinalize "echo uninstfinalize %1"
+!else
+  !warning "NSIS ${NSIS_VERSION} (< v3.08): uninstaller may not work if installer is signed"
+!endif
+
 Section "Start Menu Shortcuts" MENU_SECTION
 
   SectionIn ${FULL_TYPES}