diff --git a/smartmontools/ChangeLog b/smartmontools/ChangeLog
index fcef77210254767bed88b0ba8cac5a6d1825380e..ef376c9b56aa5cf99f4da0616929de3bbc052cce 100644
--- a/smartmontools/ChangeLog
+++ b/smartmontools/ChangeLog
@@ -2,6 +2,10 @@ $Id$
 
 2022-04-30  Christian Franke  <franke@computer.org>
 
+	Makefile.am: Windows: Ensure that advapi32 is linked before kernel32.
+	This keeps backward compatibility with old versions of Windows if
+	recent versions MinGW-w64 are used.
+
 	Makefile.am: config-vc: Remove HAVE___INT128 from generated config.h.
 
 	Makefile.am: Support 'svnversion' with CR/LF instead of LF output.
diff --git a/smartmontools/Makefile.am b/smartmontools/Makefile.am
index c70b0cb3a023467babd391bb0045119b934098d5..06bad4ac0df5cd9ef56f28943cf324cd54cfa75e 100644
--- a/smartmontools/Makefile.am
+++ b/smartmontools/Makefile.am
@@ -282,6 +282,12 @@ smartd_SOURCES += \
 smartctl_LDADD += -lole32 -loleaut32
 smartd_LDADD   += -lole32 -loleaut32
 
+# Some versions of the MinGW-w64 import lib for kernel32.dll include some symbols
+# duplicated from advapi32.dll.  Older versions of windows provide these symbols
+# only in advapi32.dll.  Ensure that the advapi32 lib is linked first.
+smartctl_LDADD += -ladvapi32
+smartd_LDADD   += -ladvapi32
+
 endif
 
 if OS_SOLARIS