[ros-diffs] [jimtabor] 38752: - Added stubs to timers, tooling up to change over to handled timers. This is related to just about everything. From Carets to window positions.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Wed Jan 14 03:02:27 CET 2009


Author: jimtabor
Date: Tue Jan 13 20:02:26 2009
New Revision: 38752

URL: http://svn.reactos.org/svn/reactos?rev=38752&view=rev
Log:
- Added stubs to timers, tooling up to change over to handled timers. This is related to just about everything. From Carets to window positions.

Modified:
    trunk/reactos/subsystems/win32/win32k/include/timer.h
    trunk/reactos/subsystems/win32/win32k/ntuser/object.c
    trunk/reactos/subsystems/win32/win32k/ntuser/timer.c

Modified: trunk/reactos/subsystems/win32/win32k/include/timer.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/include/timer.h?rev=38752&r1=38751&r2=38752&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/timer.h [iso-8859-1] Tue Jan 13 20:02:26 2009
@@ -28,5 +28,7 @@
 UINT_PTR FASTCALL IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer);
 PTIMER FASTCALL FindSystemTimer(PMSG);
 BOOL FASTCALL ValidateTimerCallback(PW32THREADINFO,PWINDOW_OBJECT,WPARAM,LPARAM);
+VOID CALLBACK SystemTimerProc(HWND,UINT,UINT_PTR,DWORD);
+UINT_PTR FASTCALL SetSystemTimer(HWND,UINT_PTR,UINT,TIMERPROC);
 
 #endif /* _WIN32K_TIMER_H */

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/object.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/object.c?rev=38752&r1=38751&r2=38752&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/object.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/object.c [iso-8859-1] Tue Jan 13 20:02:26 2009
@@ -70,7 +70,7 @@
    {
 /**/
       int i, iFree = 0, iWindow = 0, iMenu = 0, iCursorIcon = 0,
-          iHook = 0, iCallProc = 0, iAccel = 0, iMonitor = 0;
+          iHook = 0, iCallProc = 0, iAccel = 0, iMonitor = 0, iTimer = 0;
  /**/
       DPRINT1("Out of user handles! Used -> %i, NM_Handle -> %d\n", usedHandles, ht->nb_handles);
 //#if 0
@@ -102,12 +102,15 @@
            case otMonitor:
             iMonitor++;
             break;
+           case otTimer:
+            iMonitor++;
+            break;
            default:
             break;
          }
       }
-      DPRINT1("Handle Count by Type:\n Free = %d Window = %d Menu = %d CursorIcon = %d Hook = %d\n CallProc = %d Accel = %d Monitor = %d\n",
-      iFree, iWindow, iMenu, iCursorIcon, iHook, iCallProc, iAccel, iMonitor );
+      DPRINT1("Handle Count by Type:\n Free = %d Window = %d Menu = %d CursorIcon = %d Hook = %d\n CallProc = %d Accel = %d Monitor = %d Timer = %d\n",
+      iFree, iWindow, iMenu, iCursorIcon, iHook, iCallProc, iAccel, iMonitor, iTimer );
 //#endif
       return NULL;
 #if 0

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/timer.c?rev=38752&r1=38751&r2=38752&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Tue Jan 13 20:02:26 2009
@@ -54,6 +54,72 @@
   ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&Mutex)
 
 /* FUNCTIONS *****************************************************************/
+PTIMER
+FASTCALL
+CreateTimer(VOID)
+{
+  HANDLE Handle;
+  PTIMER Ret = NULL;
+
+  if (!FirstpTmr)
+  {
+      FirstpTmr = UserCreateObject(gHandleTable, &Handle, otTimer, sizeof(TIMER));
+      if (FirstpTmr) InitializeListHead(&FirstpTmr->ptmrList);
+      Ret = FirstpTmr;
+  }
+  else
+  {
+      Ret = UserCreateObject(gHandleTable, &Handle, otTimer, sizeof(TIMER));
+      if (Ret) InsertTailList(&FirstpTmr->ptmrList, &Ret->ptmrList);
+  } 
+  return Ret;
+}
+
+static
+BOOL
+FASTCALL
+RemoveTimer(PTIMER pTmr)
+{
+  if (pTmr)
+  {
+     RemoveEntryList(&pTmr->ptmrList);
+     UserDeleteObject( USER_BODY_TO_HEADER(pTmr)->hSelf, otTimer);
+     return TRUE;
+  }
+  return FALSE;
+}
+
+PTIMER
+FASTCALL
+FindTimer(PWINDOW_OBJECT Window,
+          UINT_PTR nID,
+          UINT flags,
+          BOOL Distroy)
+{
+  PTIMER pTmr = FirstpTmr;
+  KeEnterCriticalRegion();
+  do
+  {
+    if (!pTmr) break;
+
+    if ( pTmr->nID == nID &&
+         pTmr->pWnd == Window &&
+        (pTmr->flags & (TMRF_SYSTEM|TMRF_RIT)) == (flags & (TMRF_SYSTEM|TMRF_RIT)))
+    {
+       if (Distroy)
+       {
+          RemoveTimer(pTmr);
+          pTmr = (PTIMER)1; // We are here to remove the timer.
+       }
+       break;
+    }
+
+    pTmr = (PTIMER)pTmr->ptmrList.Flink;
+  } while (pTmr != FirstpTmr);
+  KeLeaveCriticalRegion();
+
+  return pTmr;
+}
 
 PTIMER
 FASTCALL
@@ -104,6 +170,41 @@
   return TRUE;
 }
 
+// Rename it to IntSetTimer after move.
+UINT_PTR FASTCALL
+InternalSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer)
+{
+  return 0;
+}
+
+//
+// Process system timers.
+//
+VOID
+CALLBACK
+SystemTimerProc(HWND hwnd,
+                UINT uMsg,
+         UINT_PTR idEvent,
+             DWORD dwTime)
+{
+}
+
+UINT_PTR
+FASTCALL
+SetSystemTimer( HWND hWnd,
+                UINT_PTR nIDEvent,
+                UINT uElapse,
+                TIMERPROC lpTimerFunc) 
+{
+  return 0;
+}
+
+
+//
+//
+// Old Timer Queueing
+//
+//
 UINT_PTR FASTCALL
 IntSetTimer(HWND Wnd, UINT_PTR IDEvent, UINT Elapse, TIMERPROC TimerFunc, BOOL SystemTimer)
 {
@@ -268,12 +369,6 @@
    /* yes we need this, since ExAllocatePool isn't supposed to zero out allocated memory */
    RtlClearAllBits(&WindowLessTimersBitMap);
 
-   if (!FirstpTmr)
-   {
-      FirstpTmr = ExAllocatePoolWithTag(PagedPool, sizeof(TIMER), TAG_TIMERBMP);
-      if (FirstpTmr) InitializeListHead(&FirstpTmr->ptmrList);
-   }
-
    return STATUS_SUCCESS;
 }
 
@@ -337,6 +432,7 @@
    DPRINT("Enter NtUserSetSystemTimer\n");
    UserEnterExclusive();
 
+   // This is wrong, lpTimerFunc is NULL!
    RETURN(IntSetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc, TRUE));
 
 CLEANUP:



More information about the Ros-diffs mailing list