diff --git a/accessible/ipc/win/handler/moz.build b/accessible/ipc/win/handler/moz.build
index 4e99d4e687729a052c40f34e8f02f362d1d0410c..1242bb6b8c02fa9d65b2c59561639c2c66ad34c0 100644
--- a/accessible/ipc/win/handler/moz.build
+++ b/accessible/ipc/win/handler/moz.build
@@ -92,8 +92,11 @@ USE_LIBS += [
 ]
 
 OS_LIBS += [
+    "advapi32",
+    "uuid",
     "rpcrt4",
     "oleacc",
+    "user32",
 ]
 
 RCINCLUDE = "AccessibleHandler.rc"
diff --git a/browser/app/moz.build b/browser/app/moz.build
index c3ca45a770fab608ee4748e41851dadf3302be8d..f280dbd909691070d6f09ed2cab51e2b78fb32b2 100644
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -78,6 +78,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
     LOCAL_INCLUDES += [
         "/browser/app/winlauncher",
     ]
+    OS_LIBS += [
+        "advapi32",
+        "uuid",
+    ]
     DELAYLOAD_DLLS += [
         "advapi32.dll",
         "oleaut32.dll",
@@ -115,6 +119,9 @@ if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT":
         "sandbox_s",
     ]
 
+    OS_LIBS += [
+        "winmm",
+    ]
     DELAYLOAD_DLLS += [
         "winmm.dll",
         "user32.dll",
diff --git a/browser/components/migration/tests/unit/insertIEHistory/moz.build b/browser/components/migration/tests/unit/insertIEHistory/moz.build
index 33c261c74688e2bd3f282887e6beaca71a45e7c1..61ca96d48a953f113299ef7464793b81a9d3450f 100644
--- a/browser/components/migration/tests/unit/insertIEHistory/moz.build
+++ b/browser/components/migration/tests/unit/insertIEHistory/moz.build
@@ -9,6 +9,7 @@ FINAL_TARGET = "_tests/xpcshell/browser/components/migration/tests/unit"
 Program("InsertIEHistory")
 OS_LIBS += [
     "ole32",
+    "uuid",
 ]
 SOURCES += [
     "InsertIEHistory.cpp",
diff --git a/config/external/nspr/pr/moz.build b/config/external/nspr/pr/moz.build
index 4e06a37323a41c8c80f3729028a0c5f3962cc4a8..dc9fa0aefc3631b82e4c9e8b69ec235097fe6399 100644
--- a/config/external/nspr/pr/moz.build
+++ b/config/external/nspr/pr/moz.build
@@ -69,6 +69,7 @@ elif CONFIG["OS_TARGET"] == "SunOS":
 elif CONFIG["OS_TARGET"] == "WINNT":
     OS_LIBS += [
         "advapi32",
+        "wsock32",
         "ws2_32",
         "mswsock",
         "winmm",
diff --git a/dom/media/fake-cdm/moz.build b/dom/media/fake-cdm/moz.build
index 00faf01c75e9b1ed8e9f685cdd7fa8ffbabfefaf..6c7aafd9b4bbd47b17172d0b68f5963f7765ec46 100644
--- a/dom/media/fake-cdm/moz.build
+++ b/dom/media/fake-cdm/moz.build
@@ -23,6 +23,7 @@ SharedLibrary("fake")
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
         "ole32",
+        "user32",
     ]
 
 USE_STATIC_LIBS = True
diff --git a/ipc/app/moz.build b/ipc/app/moz.build
index dd63c7f75da8dfeda5c89fab8736a8576c56320c..69bf726c042233bbe68b1f726e0923ec8939cbdf 100644
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -37,7 +37,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
         ]
 
         OS_LIBS += [
+            "advapi32",
+            "user32",
             "version",
+            "winmm",
         ]
 
         USE_LIBS += [
diff --git a/js/src/moz.build b/js/src/moz.build
index ffac6bfc447a5d4bb664dc6102d7276bb142c709..bb4148408609b25d0e60948f3b10714e372f459a 100755
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -509,6 +509,10 @@ if CONFIG["ENABLE_TRACE_LOGGING"]:
     ]
 
 if CONFIG["OS_ARCH"] == "WINNT":
+    OS_LIBS += [
+        "advapi32",
+        "winmm",
+    ]
     UNIFIED_SOURCES += [
         "threading/windows/CpuCount.cpp",
         "threading/windows/WindowsThread.cpp",
diff --git a/js/src/old-configure.in b/js/src/old-configure.in
index 5419a9b2cec77e3be95d33802e591f7ca65b1dc0..6ab5e7b9b2be757f3c15917dd138d2f94c506b27 100644
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -404,8 +404,6 @@ case "$target" in
         fi
 
         DSO_LDOPTS='-shared'
-        # mingw doesn't require kernel32, user32, and advapi32 explicitly
-        LIBS="$LIBS -lusp10 -lgdi32 -lwinmm -lwsock32"
         MOZ_FIX_LINK_PATHS=
 
         # Silence problematic clang warnings
@@ -522,7 +520,6 @@ case "$target" in
         # warning insists on complaining about the latter case, which
         # is annoying, and rather noisy.
         CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
-        LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
         MOZ_DEBUG_LDFLAGS='-DEBUG'
         if test "$HOST_OS_ARCH" != "WINNT"; then
           # %_PDB% is a special signal to emit only the PDB basename. This
diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build
index 5048fa7608aec1758f6f43599ef72052f190f8e5..de3b050b79723b6a08cefff304e22bc221d98c2b 100644
--- a/js/xpconnect/shell/moz.build
+++ b/js/xpconnect/shell/moz.build
@@ -39,7 +39,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
         ]
 
         OS_LIBS += [
+            "advapi32",
+            "user32",
             "version",
+            "winmm",
         ]
 
         USE_LIBS += [
diff --git a/media/gmp-clearkey/0.1/moz.build b/media/gmp-clearkey/0.1/moz.build
index 15348d8386dd119876b15298a51bd08b28d8f7c4..928abd6cfb1fd73f05e38838a5e53ca7c03dee28 100644
--- a/media/gmp-clearkey/0.1/moz.build
+++ b/media/gmp-clearkey/0.1/moz.build
@@ -37,6 +37,7 @@ if CONFIG["OS_ARCH"] == "WINNT":
 
     OS_LIBS += [
         "mfuuid",
+        "uuid",
     ]
 
     DEFINES["ENABLE_WMF"] = True
diff --git a/memory/replace/logalloc/replay/moz.build b/memory/replace/logalloc/replay/moz.build
index 7a6f2098e24c1c72909083ee05bf342e5767c0fd..8f6291aa860a4e69e9fcecea3c59829fe47efca3 100644
--- a/memory/replace/logalloc/replay/moz.build
+++ b/memory/replace/logalloc/replay/moz.build
@@ -33,6 +33,7 @@ if CONFIG["MOZ_REPLACE_MALLOC_STATIC"] and (CONFIG["MOZ_DMD"] or CONFIG["MOZ_PHC
 
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
+        "advapi32",
         "dbghelp",
     ]
 
diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
index f0862de290230208beea10473fff877056a97fda..e27c323d1c0c084940fa71d248d2bf58e991bd71 100644
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -38,6 +38,12 @@ if CONFIG["MOZ_TSAN"]:
 if CONFIG["OS_TARGET"] == "WINNT":
     if CONFIG["MOZ_MEMORY"]:
         DEFFILE = "mozglue.def"
+    OS_LIBS += [
+        "advapi32",
+        "user32",
+        "winmm",
+        "uuid",
+    ]
     # We'll break the DLL blocklist if we immediately load user32.dll.
     # For the same reason, we delayload these other DLLs to avoid eager
     # dependencies on user32.dll.
diff --git a/old-configure.in b/old-configure.in
index 92f72cc0020907c6fbfc0a992b46b69be0896b35..f76c90f0a7d2dc0069f7457c746cb80952d4e50b 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -478,8 +478,6 @@ case "$target" in
         fi
 
         DSO_LDOPTS='-shared'
-        # mingw doesn't require kernel32, user32, and advapi32 explicitly
-        LIBS="$LIBS -luuid -lusp10 -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
         MOZ_FIX_LINK_PATHS=
 
         MOZ_OPTIMIZE_FLAGS="-O2"
@@ -598,7 +596,6 @@ case "$target" in
         CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
         # Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
         CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
-        LIBS="$LIBS user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
         MOZ_DEBUG_LDFLAGS='-DEBUG'
         if test "$HOST_OS_ARCH" != "WINNT"; then
           # %_PDB% is a special signal to emit only the PDB basename. This
diff --git a/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build b/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build
index 57c1f919cef40257dd43546c0c37ba79caf94b22..f338eae36453ed7585062706c908c652ff9470fc 100644
--- a/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build
+++ b/security/manager/ssl/ipcclientcerts/dynamic-library/moz.build
@@ -24,6 +24,7 @@ if CONFIG["OS_TARGET"] == "Android":
 
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
+        "advapi32",
         "userenv",
         "ws2_32",
     ]
diff --git a/security/manager/ssl/osclientcerts/dynamic-library/moz.build b/security/manager/ssl/osclientcerts/dynamic-library/moz.build
index abd66ba6af029fce7f1fcf79a3aaee12daccb553..f68e5c0d3991269c5c65995503ab34cb16118e01 100644
--- a/security/manager/ssl/osclientcerts/dynamic-library/moz.build
+++ b/security/manager/ssl/osclientcerts/dynamic-library/moz.build
@@ -12,6 +12,7 @@ UNIFIED_SOURCES += [
 
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
+        "advapi32",
         "crypt32",
         "kernel32",
         "ncrypt",
diff --git a/testing/tools/screenshot/moz.build b/testing/tools/screenshot/moz.build
index 829405856f1b7de65e1d7987184fd4551895974c..eb87b72f64c5470c52f3fac181ed86a3e9f08623 100644
--- a/testing/tools/screenshot/moz.build
+++ b/testing/tools/screenshot/moz.build
@@ -23,7 +23,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
     if CONFIG["CC_TYPE"] in ("clang", "gcc"):
         WIN32_EXE_LDFLAGS += ["-municode"]
     OS_LIBS += [
+        "advapi32",
+        "gdi32",
         "gdiplus",
+        "user32",
     ]
 
 NO_PGO = True
diff --git a/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build b/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build
index d98b6c33d5219eae7f3cc122bf77ec393ee340d1..aec43210f75b4613cda19f8c74245a83a7be5f41 100644
--- a/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build
+++ b/toolkit/components/aboutthirdparty/tests/TestShellEx/moz.build
@@ -20,6 +20,12 @@ USE_LIBS += [
     "mozglue",
 ]
 
+if CONFIG["OS_ARCH"] == "WINNT":
+    OS_LIBS += [
+        "advapi32",
+        "uuid",
+    ]
+
 if CONFIG["COMPILE_ENVIRONMENT"]:
     shared_library = "!%sTestShellEx%s" % (CONFIG["DLL_PREFIX"], CONFIG["DLL_SUFFIX"])
     TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.components.aboutthirdparty.tests.browser += [
diff --git a/toolkit/components/maintenanceservice/moz.build b/toolkit/components/maintenanceservice/moz.build
index db8a7ba8bd4cc6e2aa08974d7a83bd37d6a94cff..a4dae3f8baf757eed22b7f529ee78a557f8afa21 100644
--- a/toolkit/components/maintenanceservice/moz.build
+++ b/toolkit/components/maintenanceservice/moz.build
@@ -50,6 +50,9 @@ OS_LIBS += [
     "ws2_32",
     "shell32",
     "shlwapi",
+    "user32",
+    "userenv",
+    "uuid",
 ]
 
 if CONFIG["ENABLE_TESTS"]:
diff --git a/toolkit/crashreporter/client/moz.build b/toolkit/crashreporter/client/moz.build
index 48c4499914d7194c209aeba69f0c1e2835212461..c52a7ebe715db5afcbebf692061386aa23959708 100644
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -44,11 +44,14 @@ if CONFIG["OS_ARCH"] == "WINNT":
         "nss",
     ]
     OS_LIBS += [
+        "advapi32",
         "comctl32",
+        "gdi32",
         "ole32",
         "shell32",
         "wininet",
         "shlwapi",
+        "user32",
     ]
 elif CONFIG["OS_ARCH"] == "Darwin":
     UNIFIED_SOURCES += [
diff --git a/toolkit/crashreporter/mozwer/moz.build b/toolkit/crashreporter/mozwer/moz.build
index a3d4736e80666dfff29a21dff4f956f0dd16faf2..1f6418fd48829bdcf1f7f6e8077abeb1c87772a8 100644
--- a/toolkit/crashreporter/mozwer/moz.build
+++ b/toolkit/crashreporter/mozwer/moz.build
@@ -7,6 +7,7 @@ USE_LIBS += [
 ]
 
 OS_LIBS += [
+    "advapi32",
     "bcrypt",
 ]
 
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index cb04762bf632e11e9d63d6894af83954b6523265..b2c1ab78befe5766b724e62a382739eac8d94b80 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -269,11 +269,14 @@ if CONFIG["OS_ARCH"] == "FreeBSD":
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
         "crypt32",
+        "gdi32",
         "shell32",
         "ntdll",
         "ole32",
         "version",
         "winspool",
+        "userenv",
+        "uuid",
     ]
 
 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build
index 689bd1853e08d716bbfe87624cebd8bb5b266364..1a52a88b5fcbfa3352e4447fbb690aa48960ba6f 100644
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -40,6 +40,8 @@ LOCAL_INCLUDES += [
 if CONFIG["OS_ARCH"] == "WINNT":
     OS_LIBS += [
         "shlwapi",
+        "user32",
+        "uuid",
     ]
 
 USE_LIBS += [
diff --git a/toolkit/mozapps/update/updater/updater-common.build b/toolkit/mozapps/update/updater/updater-common.build
index 95d1ab892485af7dbf7b2d60bb625da3c267f710..7c58d374bbc29fa1e8a65e6dab1f6a0290ac19e4 100644
--- a/toolkit/mozapps/update/updater/updater-common.build
+++ b/toolkit/mozapps/update/updater/updater-common.build
@@ -38,6 +38,10 @@ if CONFIG["OS_ARCH"] == "WINNT":
         "shlwapi",
         "crypt32",
         "advapi32",
+        "gdi32",
+        "user32",
+        "userenv",
+        "uuid",
     ]
 
 USE_LIBS += [
diff --git a/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build b/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build
index 57fae737c420fd3b7dd60d4f630ff9ca959f9847..e9a10a150a3677cde6fb349268a067e6bd6775ae 100644
--- a/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build
+++ b/toolkit/xre/dllservices/tests/gtest/TestDllBlocklist_NoOpEntryPoint/moz.build
@@ -15,3 +15,7 @@ RCFILE = "TestDllBlocklist_NoOpEntryPoint.rc"
 
 if CONFIG["COMPILE_ENVIRONMENT"]:
     TEST_HARNESS_FILES.gtest += ["!TestDllBlocklist_NoOpEntryPoint.dll"]
+
+OS_LIBS += [
+    "uuid",
+]
diff --git a/toolkit/xre/dllservices/tests/moz.build b/toolkit/xre/dllservices/tests/moz.build
index f79a2667940bb195832811c996673c340b1fb28c..eee1b22ae30360f72e98f0286a90bf2863791d22 100644
--- a/toolkit/xre/dllservices/tests/moz.build
+++ b/toolkit/xre/dllservices/tests/moz.build
@@ -23,10 +23,12 @@ if CONFIG["CPU_ARCH"] in ("x86", "x86_64"):
     )
 
 OS_LIBS += [
+    "advapi32",
     "ntdll",
     "ole32",
     "shlwapi",
     "user32",
+    "uuid",
 ]
 
 DELAYLOAD_DLLS += [
diff --git a/toolkit/xre/test/win/moz.build b/toolkit/xre/test/win/moz.build
index 8dbdbe5389fc9f70d75a3418c05bc7d0c4dc5c4f..93faee0e7f7f44902b565ad9814c07adc819313e 100644
--- a/toolkit/xre/test/win/moz.build
+++ b/toolkit/xre/test/win/moz.build
@@ -27,8 +27,10 @@ DisableStlWrapping()
 USE_STATIC_LIBS = True
 
 OS_LIBS += [
+    "advapi32",
     "comctl32",
     "shell32",
+    "userenv",
     "ws2_32",
 ]
 
diff --git a/widget/windows/tests/moz.build b/widget/windows/tests/moz.build
index 8d6c88c5e2c8a87c3214233ea7ba921459fd23b0..60e83d34a5b7d9d9711b64403a1748dfcc4adf5e 100644
--- a/widget/windows/tests/moz.build
+++ b/widget/windows/tests/moz.build
@@ -19,6 +19,7 @@ OS_LIBS += [
     "shell32",
     "shlwapi",
     "urlmon",
+    "uuid",
 ]
 
 if CONFIG["OS_TARGET"] == "WINNT" and CONFIG["CC_TYPE"] in ("gcc", "clang"):
diff --git a/xpcom/windbgdlg/moz.build b/xpcom/windbgdlg/moz.build
index 2361552ad614bce159ff6cb8d553e3ae645a58cc..7d1798b545a8cf885a268ef4ced2dc0fe72da60b 100644
--- a/xpcom/windbgdlg/moz.build
+++ b/xpcom/windbgdlg/moz.build
@@ -5,3 +5,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SimplePrograms(["windbgdlg"])
+
+OS_LIBS += [
+    "advapi32",
+    "user32",
+]