Bug 552980 - [Win32] Fix missing Taskbar detection on Windows Server Core

Change-Id: I6a15b2c2e8a10d6df2979964f25f0462188c29b5
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
index 68e9818..1bff66d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/win32/org/eclipse/swt/internal/ole/win32/COM.java
@@ -196,6 +196,7 @@
 	public static final int OLEEMBEDDED = 1;
 	public static final int OLELINKED = 0;
 	public static final int OLERENDER_DRAW = 1;
+	public static final int REGDB_E_CLASSNOTREG = 0x80040154;
 	public static final int S_FALSE = 1;
 	public static final int S_OK = 0;
 	public static final int STGC_DEFAULT = 0;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index 9e9fd84..e2e735f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -2538,7 +2538,15 @@
 	checkDevice ();
 	if (taskBar != null) return taskBar;
 	if (OS.WIN32_VERSION >= OS.VERSION (6, 1)) {
-		taskBar = new TaskBar (this, SWT.NONE);
+		try {
+			taskBar = new TaskBar (this, SWT.NONE);
+		} catch (SWTError e) {
+			if (e.code == SWT.ERROR_NOT_IMPLEMENTED) {
+				// Windows Server Core doesn't have a Taskbar
+				return null;
+			}
+			throw e;
+		}
 	}
 	return taskBar;
 }
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
index 3048ea1..2e0f35c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/TaskBar.java
@@ -72,6 +72,7 @@
 void createHandle () {
 	long[] ppv = new long [1];
 	int hr = COM.CoCreateInstance (COM.CLSID_TaskbarList, 0, COM.CLSCTX_INPROC_SERVER, COM.IID_ITaskbarList3, ppv);
+	if (hr == COM.REGDB_E_CLASSNOTREG) error (SWT.ERROR_NOT_IMPLEMENTED);
 	if (hr != OS.S_OK) error (SWT.ERROR_NO_HANDLES);
 	mTaskbarList3 = new ITaskbarList3 (ppv [0]);
 }