-/*
- * ReactOS W32 Subsystem
- * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* INCLUDES ******************************************************************/
-#include <w32k.h>
+#include <win32k.h>
#define NDEBUG
#include <debug.h>
if (!FirstpTmr)
{
- FirstpTmr = UserCreateObject(gHandleTable, &Handle, otTimer, sizeof(TIMER));
+ FirstpTmr = UserCreateObject(gHandleTable, NULL, &Handle, otTimer, sizeof(TIMER));
if (FirstpTmr) InitializeListHead(&FirstpTmr->ptmrList);
Ret = FirstpTmr;
}
else
{
- Ret = UserCreateObject(gHandleTable, &Handle, otTimer, sizeof(TIMER));
+ Ret = UserCreateObject(gHandleTable, NULL, &Handle, otTimer, sizeof(TIMER));
if (Ret) InsertTailList(&FirstpTmr->ptmrList, &Ret->ptmrList);
}
return Ret;
if (pTmr)
{
RemoveEntryList(&pTmr->ptmrList);
- UserDeleteObject( USER_BODY_TO_HEADER(pTmr)->hSelf, otTimer);
+ UserDeleteObject( UserHMGetHandle(pTmr), otTimer);
return TRUE;
}
return FALSE;
UINT flags,
BOOL Distroy)
{
+ PLIST_ENTRY pLE;
PTIMER pTmr = FirstpTmr;
KeEnterCriticalRegion();
do
break;
}
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
} while (pTmr != FirstpTmr);
KeLeaveCriticalRegion();
FASTCALL
FindSystemTimer(PMSG pMsg)
{
+ PLIST_ENTRY pLE;
PTIMER pTmr = FirstpTmr;
KeEnterCriticalRegion();
do
(pTmr->flags & TMRF_SYSTEM) )
break;
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
} while (pTmr != FirstpTmr);
KeLeaveCriticalRegion();
WPARAM wParam,
LPARAM lParam)
{
+ PLIST_ENTRY pLE;
PTIMER pTmr = FirstpTmr;
if (!pTmr) return FALSE;
{
if ( (lParam == (LPARAM)pTmr->pfn) &&
(pTmr->flags & (TMRF_SYSTEM|TMRF_RIT)) &&
- (pTmr->pti->ThreadInfo->ppi == pti->ThreadInfo->ppi) )
+ (pTmr->pti->ppi == pti->ppi) )
break;
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
} while (pTmr != FirstpTmr);
KeLeaveCriticalRegion();
if (!pTmr) return 0;
if (Window && (Type & TMRF_TIFROMWND))
- pTmr->pti = Window->OwnerThread->Tcb.Win32Thread;
+ pTmr->pti = Window->pti->pEThread->Tcb.Win32Thread;
else
{
if (Type & TMRF_RIT)
UINT_PTR
FASTCALL
-SetSystemTimer( PWINDOW_OBJECT Window,
+SystemTimerSet( PWINDOW_OBJECT Window,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc)
{
- if (Window && Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
+ if (Window && Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
{
SetLastWin32Error(ERROR_ACCESS_DENIED);
return 0;
BOOL
FASTCALL
-PostTimerMessages(HWND hWnd)
+PostTimerMessages(PWINDOW_OBJECT Window)
{
+ PLIST_ENTRY pLE;
PUSER_MESSAGE_QUEUE ThreadQueue;
MSG Msg;
PTHREADINFO pti;
- PWINDOW_OBJECT pWnd = NULL;
BOOL Hit = FALSE;
PTIMER pTmr = FirstpTmr;
if (!pTmr) return FALSE;
- if (hWnd)
+ ASSERT(Window);
+
+ if (Window && ((ULONG_PTR)Window != 1))
{
- pWnd = UserGetWindowObject(hWnd);
- if (!pWnd || !pWnd->Wnd) return FALSE;
+ if (!Window->Wnd) return FALSE;
}
pti = PsGetCurrentThreadWin32Thread();
{
if ( (pTmr->flags & TMRF_READY) &&
(pTmr->pti == pti) &&
- (pTmr->pWnd == pWnd))
+ (pTmr->pWnd == Window))
{
- Msg.hwnd = hWnd;
+ ASSERT((ULONG_PTR)Window != 1);
+ Msg.hwnd = Window->hSelf;
Msg.message = (pTmr->flags & TMRF_SYSTEM) ? WM_SYSTIMER : WM_TIMER;
Msg.wParam = (WPARAM) pTmr->nID;
Msg.lParam = (LPARAM) pTmr->pfn;
Hit = TRUE;
}
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
} while (pTmr != FirstpTmr);
KeLeaveCriticalRegion();
{
LARGE_INTEGER TickCount, DueTime;
LONG Time;
+ PLIST_ENTRY pLE;
PTIMER pTmr = FirstpTmr;
if (!pTmr) return;
{
if (pTmr->flags & TMRF_WAITING)
{
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
continue;
}
else
pTmr->cmsCountdown -= Time - TimeLast;
}
- pTmr = (PTIMER)pTmr->ptmrList.Flink;
+ pLE = pTmr->ptmrList.Flink;
+ pTmr = CONTAINING_RECORD(pLE, TIMER, ptmrList);
} while (pTmr != FirstpTmr);
// Restart the timer thread!
return 0;
}
- if (Window->OwnerThread->ThreadsProcess != PsGetCurrentProcess())
+ if (Window->pti->pEThread->ThreadsProcess != PsGetCurrentProcess())
{
DPRINT1("Trying to set timer for window in another process (shatter attack?)\n");
SetLastWin32Error(ERROR_ACCESS_DENIED);
}
Ret = IDEvent;
- MessageQueue = Window->MessageQueue;
+ MessageQueue = Window->pti->MessageQueue;
}
#if 0
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER))
{
// Give it another chance to find the timer.
- if (Window && !( MsqKillTimer(Window->MessageQueue, Wnd,
+ if (Window && !( MsqKillTimer(Window->pti->MessageQueue, Wnd,
IDEvent, SystemTimer ? WM_SYSTIMER : WM_TIMER)))
{
DPRINT1("Unable to locate timer in message queue for Window.\n");
ASSERT(RtlAreBitsSet(&WindowLessTimersBitMap, IDEvent - 1, 1));
RtlClearBits(&WindowLessTimersBitMap, IDEvent - 1, 1);
+ HintIndex = IDEvent - 1;
+
IntUnlockWindowlessTimerBitmap();
}