From 6a2a2ebc713675a65f5aaddfc908c1b350e9a21a Mon Sep 17 00:00:00 2001 From: Andreas Mohr Date: Mon, 2 Oct 2000 22:16:34 +0000 Subject: [PATCH] Make sure that we skip tasks with missing hInstance. --- loader/task.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/loader/task.c b/loader/task.c index a5b6be1e4e7..46f676a272c 100644 --- a/loader/task.c +++ b/loader/task.c @@ -1566,8 +1566,15 @@ BOOL16 WINAPI TaskNext16( TASKENTRY *lpte ) 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;