Index: /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk	(revision 71784)
@@ -400,5 +400,9 @@
 # This one is global shared GUI library:
 ifdef VBOX_GUI_WITH_SHARED_LIBRARY
- VirtualBox_LIBS += $(PATH_STAGE_DLL)/VBoxGlobal$(VBOX_SUFF_DLL)
+ ifeq ($(KBUILD_TARGET),win)
+  VirtualBox_LIBS += $(PATH_STAGE_LIB)/VBoxGlobal$(VBOX_SUFF_LIB)
+ else
+  VirtualBox_LIBS += $(PATH_STAGE_DLL)/VBoxGlobal$(VBOX_SUFF_DLL)
+ endif
 endif
 
@@ -413,4 +417,8 @@
 VBoxGlobal_LIBS.solaris += Xinerama
 VBoxGlobal_LIBS.freebsd += Xinerama
+
+# Various Windows hosts libraries:
+VBoxGlobal_LIBS.win = \
+	$(PATH_SDK_$(VBOX_WINPSDK)_LIB)/Htmlhelp.Lib
 
 # VBox keyboard shared library for X11 hosts:
@@ -1102,6 +1110,5 @@
 VirtualBox_SOURCES.win += \
 	src/platform/win/VirtualBox.rc \
-	src/platform/win/UIDesktopServices_win.cpp \
-	src/platform/win/WinKeyboard.cpp
+	src/platform/win/UIDesktopServices_win.cpp
 
 VirtualBox_SOURCES.darwin += \
@@ -1215,5 +1222,6 @@
 
  VirtualBox_SOURCES.win += \
-	src/platform/win/VBoxUtils-win.cpp
+	src/platform/win/VBoxUtils-win.cpp \
+	src/platform/win/WinKeyboard.cpp
 
  VirtualBox_SOURCES.darwin += \
@@ -1313,5 +1321,6 @@
 
 VBoxGlobal_SOURCES.win += \
-	src/platform/win/VBoxUtils-win.cpp
+	src/platform/win/VBoxUtils-win.cpp \
+	src/platform/win/WinKeyboard.cpp
 
 VBoxGlobal_SOURCES.darwin += \
@@ -1454,5 +1463,5 @@
 	$(QUIET)$(RM) -f -- "$@" "$(PATH_TARGET)/VirtualBoxComWrapperFiles.dep"
 	$(QUIET)$(VBOX_XSLTPROC) -o $@ \
-                $(VBOX_VIRTUALBOX_SRC)/src/globals/COMWrappers.xsl $<
+		$(VBOX_VIRTUALBOX_SRC)/src/globals/COMWrappers.xsl $<
 	$(QUIET)$(VBOX_FILESPLIT) $@ $(VirtualBox_0_OUTDIR)/include \
 		$(PATH_TARGET)/VirtualBoxComWrapperFiles.dep VirtualBox_VBOX_COMWRAPPERS
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/QIWithRetranslateUI.h	(revision 71784)
@@ -25,4 +25,7 @@
 #include <QObject>
 #include <QWidget>
+
+/* GUI includes: */
+#include "UILibraryDefs.h"
 
 
@@ -60,4 +63,15 @@
     virtual void retranslateUi() = 0;
 };
+
+#ifdef VBOX_GUI_WITH_SHARED_LIBRARY
+/** Explicit QIWithRetranslateUI instantiation for QWidget class.
+  * @note  On Windows it's important that all template cases are instantiated just once across
+  *        the linking space. In case we have particular template case instantiated from both
+  *        library and executable sides, - we have multiple definition case and need to strictly
+  *        ask compiler to do it just once and link such cases against library only.
+  *        I would also note that it would be incorrect to just make whole the template exported
+  *        to library because latter can have lack of required instantiations (current case). */
+template class SHARED_LIBRARY_STUFF QIWithRetranslateUI<QWidget>;
+#endif
 
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h	(revision 71784)
@@ -642,4 +642,10 @@
     UIThreadPool *m_pThreadPool;
 
+#if defined(VBOX_WS_WIN) && defined(VBOX_GUI_WITH_SHARED_LIBRARY)
+    /** Holds the ATL module instance (for use with VBoxGlobal shared library only).
+      * @note  Required internally by ATL (constructor records instance in global variable). */
+    ATL::CComModule _Module;
+#endif
+
     /** Holds the singleton VBoxGlobal instance. */
     static VBoxGlobal *s_pInstance;
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp	(revision 71784)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- * VBox Qt GUI - Utility classes and functions for handling Win specific tasks.
+ * VBox Qt GUI - Declarations of utility classes and functions for handling Windows specific tasks.
  */
 
 /*
- * Copyright (C) 2010-2017 Oracle Corporation
+ * Copyright (C) 2010-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -16,18 +16,18 @@
  */
 
-/* Includes: */
+/* GUI includes: */
 #include "VBoxUtils-win.h"
 
-/* Namespace for native window sub-system functions: */
+
+/** Namespace for native window sub-system functions. */
 namespace NativeWindowSubsystem
 {
-    /* Enumerates visible always-on-top (top-most) windows: */
+    /** Enumerates visible always-on-top (top-most) windows. */
     BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
-    /* Contain visible top-most-window rectangles: */
+    /** Contains visible top-most-window rectangles. */
     QList<QRect> topMostRects;
 }
 
-/* Enumerates visible always-on-top (top-most) windows: */
-BOOL CALLBACK NativeWindowSubsystem::EnumWindowsProc(HWND hWnd, LPARAM /* lParam */)
+BOOL CALLBACK NativeWindowSubsystem::EnumWindowsProc(HWND hWnd, LPARAM)
 {
     /* Ignore NULL HWNDs: */
@@ -60,5 +60,4 @@
 }
 
-/* Returns area covered by visible always-on-top (top-most) windows: */
 const QRegion NativeWindowSubsystem::areaCoveredByTopMostWindows()
 {
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.h	(revision 71784)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- * VBox Qt GUI - Declarations of utility classes and functions for handling Win specific tasks.
+ * VBox Qt GUI - Declarations of utility classes and functions for handling Windows specific tasks.
  */
 
 /*
- * Copyright (C) 2011-2017 Oracle Corporation
+ * Copyright (C) 2011-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -16,11 +16,14 @@
  */
 
-#ifndef ___VBoxUtils_WIN_h___
-#define ___VBoxUtils_WIN_h___
+#ifndef ___VBoxUtils_win_h___
+#define ___VBoxUtils_win_h___
 
 /* Qt includes: */
 #include <QRegion>
 
-/* Platform includes: */
+/* GUI includes: */
+#include "UILibraryDefs.h"
+
+/* External includes: */
 #include <iprt/win/windows.h>
 
@@ -29,7 +32,6 @@
 {
     /* Returns area covered by visible always-on-top (top-most) windows: */
-    const QRegion areaCoveredByTopMostWindows();
+    SHARED_LIBRARY_STUFF const QRegion areaCoveredByTopMostWindows();
 }
 
-#endif
-
+#endif /* !___VBoxUtils_win_h___ */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.cpp	(revision 71784)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- * VBox Qt GUI - Windows keyboard handling..
+ * VBox Qt GUI - Declarations of utility functions for handling Windows Keyboard specific tasks.
  */
 
 /*
- * Copyright (C) 2014-2017 Oracle Corporation
+ * Copyright (C) 2014-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -16,10 +16,15 @@
  */
 
+/* Defines: */
 #define LOG_GROUP LOG_GROUP_GUI
 
+/* GUI includes: */
 #include "WinKeyboard.h"
+
+/* Other VBox includes: */
 #include <iprt/assert.h>
 #include <VBox/log.h>
 
+/* External includes: */
 #include <stdio.h>
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h	(revision 71783)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/platform/win/WinKeyboard.h	(revision 71784)
@@ -1,9 +1,9 @@
 /* $Id$ */
 /** @file
- * VBox Qt GUI - Windows keyboard handling..
+ * VBox Qt GUI - Declarations of utility functions for handling Windows Keyboard specific tasks.
  */
 
 /*
- * Copyright (C) 2014-2017 Oracle Corporation
+ * Copyright (C) 2014-2018 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -19,12 +19,15 @@
 #define ___WinKeyboard_h___
 
-/* Platform includes: */
+/* GUI includes: */
+#include "UILibraryDefs.h"
+
+/* Other VBox includes: */
 #include <iprt/win/windows.h>
 
-void * WinHidDevicesKeepLedsState(void);
-void   WinHidDevicesApplyAndReleaseLedsState(void *pData);
-void   WinHidDevicesBroadcastLeds(bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
+SHARED_LIBRARY_STUFF void * WinHidDevicesKeepLedsState(void);
+SHARED_LIBRARY_STUFF void   WinHidDevicesApplyAndReleaseLedsState(void *pData);
+SHARED_LIBRARY_STUFF void   WinHidDevicesBroadcastLeds(bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
 
-bool winHidLedsInSync(bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
+SHARED_LIBRARY_STUFF bool winHidLedsInSync(bool fNumLockOn, bool fCapsLockOn, bool fScrollLockOn);
 
 /** Helper class to deal with Windows AltGr handling.
@@ -39,5 +42,5 @@
   * unwanted event at source, it should still make guest system keyboard handling
   * work correctly. */
-class WinAltGrMonitor
+class SHARED_LIBRARY_STUFF WinAltGrMonitor
 {
 public:
