예제 #1
0
BOOL FASTCALL co_UserHideCaret(PWND Window OPTIONAL)
{
   PTHREADINFO pti;
   PUSER_MESSAGE_QUEUE ThreadQueue;

   if (Window) ASSERT_REFS_CO(Window);

   if(Window && Window->head.pti->pEThread != PsGetCurrentThread())
   {
      EngSetLastError(ERROR_ACCESS_DENIED);
      return FALSE;
   }

   pti = PsGetCurrentThreadWin32Thread();
   ThreadQueue = pti->MessageQueue;

   if(Window && ThreadQueue->CaretInfo->hWnd != Window->head.h)
   {
      EngSetLastError(ERROR_ACCESS_DENIED);
      return FALSE;
   }

   if(ThreadQueue->CaretInfo->Visible)
   {
      PWND pwnd = UserGetWindowObject(ThreadQueue->CaretInfo->hWnd);
      IntKillTimer(pwnd, IDCARETTIMER, TRUE);

      co_IntHideCaret(ThreadQueue->CaretInfo);
      ThreadQueue->CaretInfo->Visible = 0;
      ThreadQueue->CaretInfo->Showing = 0;
   }

   return TRUE;
}
예제 #2
0
BOOL
APIENTRY
NtUserKillTimer
(
   HWND hWnd,
   UINT_PTR uIDEvent
)
{
   PWND Window;
   DECLARE_RETURN(BOOL);

   TRACE("Enter NtUserKillTimer\n");
   UserEnterExclusive();
   Window = UserGetWindowObject(hWnd);
   UserLeave();

   RETURN(IntKillTimer(Window, uIDEvent, FALSE));

CLEANUP:
   TRACE("Leave NtUserKillTimer, ret=%i\n", _ret_);
   END_CLEANUP;
}
예제 #3
0
DWORD
APIENTRY
NtUserCallHwndParam(
   HWND hWnd,
   DWORD Param,
   DWORD Routine)
{

   switch (Routine)
   {
      case HWNDPARAM_ROUTINE_KILLSYSTEMTIMER:
          return IntKillTimer(hWnd, (UINT_PTR)Param, TRUE);

      case HWNDPARAM_ROUTINE_SETWNDCONTEXTHLPID:
      {
         PWND Window;

         UserEnterExclusive();
         if(!(Window = UserGetWindowObject(hWnd)))
         {
            UserLeave();
            return FALSE;
         }

         if ( Param )
            IntSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
         else
            IntRemoveProp(Window, gpsi->atomContextHelpIdProp);

         UserLeave();
         return TRUE;
      }

      case HWNDPARAM_ROUTINE_SETDIALOGPOINTER:
      {
         PWND pWnd;
         USER_REFERENCE_ENTRY Ref;

         UserEnterExclusive();

         if (!(pWnd = UserGetWindowObject(hWnd)))
         {
            UserLeave();
            return 0;
         }
         UserRefObjectCo(pWnd, &Ref);

         if (pWnd->head.pti->ppi == PsGetCurrentProcessWin32Process() &&
             pWnd->cbwndExtra == DLGWINDOWEXTRA && 
             !(pWnd->state & WNDS_SERVERSIDEWINDOWPROC))
         {
            if (Param)
            {
               if (!pWnd->fnid) pWnd->fnid = FNID_DIALOG;
               pWnd->state |= WNDS_DIALOGWINDOW;
            }
            else
            {
               pWnd->fnid |= FNID_DESTROY;
               pWnd->state &= ~WNDS_DIALOGWINDOW;
            }
         }
         
         UserDerefObjectCo(pWnd);
         UserLeave();
         return 0;
      }

      case HWNDPARAM_ROUTINE_ROS_NOTIFYWINEVENT:
      {
         PWND pWnd;
         PNOTIFYEVENT pne;
         UserEnterExclusive();
         pne = (PNOTIFYEVENT)Param;
         if (hWnd)
            pWnd = UserGetWindowObject(hWnd);
         else
            pWnd = NULL;
         IntNotifyWinEvent(pne->event, pWnd, pne->idObject, pne->idChild, pne->flags);
         UserLeave();
         return 0;
      }
   }

   STUB;

   return 0;
}
예제 #4
0
BOOL
APIENTRY
NtUserCreateCaret(
   HWND hWnd,
   HBITMAP hBitmap,
   int nWidth,
   int nHeight)
{
   PWND Window;
   PTHREADINFO pti;
   PUSER_MESSAGE_QUEUE ThreadQueue;
   DECLARE_RETURN(BOOL);

   TRACE("Enter NtUserCreateCaret\n");
   UserEnterExclusive();

   if(!(Window = UserGetWindowObject(hWnd)))
   {
      RETURN(FALSE);
   }

   if(Window->head.pti->pEThread != PsGetCurrentThread())
   {
      EngSetLastError(ERROR_ACCESS_DENIED);
      RETURN(FALSE);
   }

   pti = PsGetCurrentThreadWin32Thread();
   ThreadQueue = pti->MessageQueue;

   if (ThreadQueue->CaretInfo->Visible)
   {
      IntKillTimer(Window, IDCARETTIMER, TRUE);
      co_IntHideCaret(ThreadQueue->CaretInfo);
   }

   ThreadQueue->CaretInfo->hWnd = hWnd;
   if(hBitmap)
   {
      ThreadQueue->CaretInfo->Bitmap = hBitmap;
      ThreadQueue->CaretInfo->Size.cx = ThreadQueue->CaretInfo->Size.cy = 0;
   }
   else
   {
      if (nWidth == 0)
      {
          nWidth = UserGetSystemMetrics(SM_CXBORDER);
      }
      if (nHeight == 0)
      {
          nHeight = UserGetSystemMetrics(SM_CYBORDER);
      }
      ThreadQueue->CaretInfo->Bitmap = (HBITMAP)0;
      ThreadQueue->CaretInfo->Size.cx = nWidth;
      ThreadQueue->CaretInfo->Size.cy = nHeight;
   }
   ThreadQueue->CaretInfo->Visible = 0;
   ThreadQueue->CaretInfo->Showing = 0;

   IntSetTimer( Window, IDCARETTIMER, gpsi->dtCaretBlink, CaretSystemTimerProc, TMRF_SYSTEM );

   IntNotifyWinEvent(EVENT_OBJECT_CREATE, Window, OBJID_CARET, CHILDID_SELF, 0);

   RETURN(TRUE);

CLEANUP:
   TRACE("Leave NtUserCreateCaret, ret=%i\n",_ret_);
   UserLeave();
   END_CLEANUP;
}
예제 #5
0
//
// Process win32k system timers.
//
VOID
CALLBACK
SystemTimerProc(HWND hwnd,
                UINT uMsg,
         UINT_PTR idEvent,
             DWORD dwTime)
{
  PDESKTOP pDesk;
  PWND pWnd = NULL;

  if (hwnd)
  {
     pWnd = UserGetWindowObject(hwnd);
     if (!pWnd)
     {
        ERR( "System Timer Proc has invalid window handle! 0x%x Id: %d\n", hwnd, idEvent);
        return;
     }
  }
  else
  {
     TRACE( "Windowless Timer Running!\n" );
     return;
  }

  switch (idEvent)
  {
/*
   Used in NtUserTrackMouseEvent.
 */
     case ID_EVENT_SYSTIMER_MOUSEHOVER:
       {
          POINT Point;
          UINT Msg;
          WPARAM wParam;

          pDesk = pWnd->head.rpdesk;
          if ( pDesk->dwDTFlags & DF_TME_HOVER &&
               pWnd == pDesk->spwndTrack )
          {
             Point = gpsi->ptCursor;
             if ( RECTL_bPointInRect(&pDesk->rcMouseHover, Point.x, Point.y) )
             {
                if (pDesk->htEx == HTCLIENT) // In a client area.
                {
                   wParam = get_key_state();
                   Msg = WM_MOUSEHOVER;

                   if (pWnd->ExStyle & WS_EX_LAYOUTRTL)
                   {
                      Point.x = pWnd->rcClient.right - Point.x - 1;
                   }
                   else
                      Point.x -= pWnd->rcClient.left;
                   Point.y -= pWnd->rcClient.top;
                }
                else
                {
                   wParam = pDesk->htEx; // Need to support all HTXYZ hits.
                   Msg = WM_NCMOUSEHOVER;
                }
                UserPostMessage(hwnd, Msg, wParam, MAKELPARAM(Point.x, Point.y));
                pDesk->dwDTFlags &= ~DF_TME_HOVER;
                break; // Kill this timer.
             }
          }
       }
       return; // Not this window so just return.

     default:
       ERR( "System Timer Proc invalid id %d!\n", idEvent );
       break;
  }
  IntKillTimer(pWnd, idEvent, TRUE);
}