Make sure that we skip tasks with missing hInstance.

diff --git a/loader/task.c b/loader/task.c
index a5b6be1..46f676a 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -1566,8 +1566,15 @@
 
     TRACE_(toolhelp)("(%p): task=%04x\n", lpte, lpte->hNext );
     if (!lpte->hNext) return FALSE;
-    pTask = (TDB *)GlobalLock16( lpte->hNext );
-    if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
+
+    /* make sure that task and hInstance are valid (skip initial Wine task !) */
+    while (1) {
+        pTask = (TDB *)GlobalLock16( lpte->hNext );
+        if (!pTask || pTask->magic != TDB_MAGIC) return FALSE;
+        if (pTask->hInstance)
+            break;
+        lpte->hNext = pTask->hNext;
+    }
     pInstData = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( GlobalHandleToSel16(pTask->hInstance), 0 );
     lpte->hTask         = lpte->hNext;
     lpte->hTaskParent   = pTask->hParent;