- Fix the window handle De/Reference throttler issue. Used mIrc.

svn path=/trunk/; revision=45096
This commit is contained in:
James Tabor 2010-01-16 05:56:22 +00:00
parent 683078276e
commit 95f100163d

View file

@ -396,37 +396,26 @@ UserCreateObject( PUSER_HANDLE_TABLE ht,
BOOL BOOL
FASTCALL FASTCALL
UserDereferenceObject(PVOID obj) UserDereferenceObject(PVOID object)
{
ASSERT(((PHEAD)obj)->cLockObj >= 1);
if (--((PHEAD)obj)->cLockObj <= 0)
{
return TRUE;
}
return FALSE;
}
BOOL
FASTCALL
UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle )
{ {
PUSER_HANDLE_ENTRY entry; PUSER_HANDLE_ENTRY entry;
PVOID object;
USER_OBJECT_TYPE type; USER_OBJECT_TYPE type;
if (!(entry = handle_to_entry( ht, handle ))) ASSERT(((PHEAD)object)->cLockObj >= 1);
{
SetLastNtError( STATUS_INVALID_HANDLE );
return FALSE;
}
entry->flags = HANDLEENTRY_INDESTROY; if ((INT)--((PHEAD)object)->cLockObj <= 0)
if (UserDereferenceObject(entry->ptr))
{ {
entry = handle_to_entry(gHandleTable, ((PHEAD)object)->h );
DPRINT("warning! Dereference to zero! Obj -> 0x%x\n", object);
((PHEAD)object)->cLockObj = 0;
if (!(entry->flags & HANDLEENTRY_INDESTROY))
return TRUE;
type = entry->type; type = entry->type;
object = free_user_entry(ht, entry ); free_user_entry(gHandleTable, entry );
switch (type) switch (type)
{ {
@ -444,6 +433,23 @@ UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle )
return FALSE; return FALSE;
} }
BOOL
FASTCALL
UserFreeHandle(PUSER_HANDLE_TABLE ht, HANDLE handle )
{
PUSER_HANDLE_ENTRY entry;
if (!(entry = handle_to_entry( ht, handle )))
{
SetLastNtError( STATUS_INVALID_HANDLE );
return FALSE;
}
entry->flags = HANDLEENTRY_INDESTROY;
return UserDereferenceObject(entry->ptr);
}
BOOL BOOL
FASTCALL FASTCALL
UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type ) UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type )