[KERNEL32]: Fix RemoveHandles, CloseAllProcessHandles...again.

svn path=/trunk/; revision=52814
This commit is contained in:
Alex Ionescu 2011-07-23 18:43:49 +00:00
parent 90e2e1bad0
commit 89fc754845

View file

@ -300,11 +300,12 @@ WINAPI
RemoveHandles(IN DWORD dwProcessId, RemoveHandles(IN DWORD dwProcessId,
IN DWORD dwThreadId) IN DWORD dwThreadId)
{ {
PDBGSS_THREAD_DATA ThreadData, ThisData; PDBGSS_THREAD_DATA *ThreadData;
PDBGSS_THREAD_DATA ThisData;
/* Loop all thread data events */ /* Loop all thread data events */
ThreadData = DbgSsGetThreadData(); ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved;
for (ThisData = ThreadData; ThisData; ThisData = ThisData->Next) for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next)
{ {
/* Check if this one matches */ /* Check if this one matches */
if ((ThisData->HandleMarked) && if ((ThisData->HandleMarked) &&
@ -315,7 +316,7 @@ RemoveHandles(IN DWORD dwProcessId,
if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle); if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle);
/* Unlink the thread data */ /* Unlink the thread data */
ThreadData->Next = ThisData->Next; *ThreadData = ThisData->Next;
/* Free it*/ /* Free it*/
RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData); RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData);
@ -323,7 +324,7 @@ RemoveHandles(IN DWORD dwProcessId,
else else
{ {
/* Move to the next one */ /* Move to the next one */
ThreadData = ThisData; ThreadData = &ThisData->Next;
} }
} }
} }
@ -332,11 +333,12 @@ VOID
WINAPI WINAPI
CloseAllProcessHandles(IN DWORD dwProcessId) CloseAllProcessHandles(IN DWORD dwProcessId)
{ {
PDBGSS_THREAD_DATA ThreadData, ThisData; PDBGSS_THREAD_DATA *ThreadData;
PDBGSS_THREAD_DATA ThisData;
/* Loop all thread data events */ /* Loop all thread data events */
ThreadData = DbgSsGetThreadData(); ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved;
for (ThisData = ThreadData; ThisData; ThisData = ThisData->Next) for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next)
{ {
/* Check if this one matches */ /* Check if this one matches */
if (ThisData->ProcessId == dwProcessId) if (ThisData->ProcessId == dwProcessId)
@ -346,7 +348,7 @@ CloseAllProcessHandles(IN DWORD dwProcessId)
if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle); if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle);
/* Unlink the thread data */ /* Unlink the thread data */
ThreadData->Next = ThisData->Next; *ThreadData = ThisData->Next;
/* Free it*/ /* Free it*/
RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData); RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData);
@ -354,7 +356,7 @@ CloseAllProcessHandles(IN DWORD dwProcessId)
else else
{ {
/* Move to the next one */ /* Move to the next one */
ThreadData = ThisData; ThreadData = &ThisData->Next;
} }
} }
} }